From 599cddfb6724c6f4c3719c47dcc92af66c2c5f59 Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 9 Jan 2024 13:27:28 +0100 Subject: [PATCH] ejabberd_sql_schema: Rewrite recent commit cb49fcf lists:search is available since OTP 21.0, and ejabberd is said to support since OTP 20.0. Also, that code wouldn't work if ejabberd uses different database types (MySQL, PgSQL, ...), as this would only update the first database. --- src/ejabberd_sql_schema.erl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ejabberd_sql_schema.erl b/src/ejabberd_sql_schema.erl index af9743f82..0960e1c29 100644 --- a/src/ejabberd_sql_schema.erl +++ b/src/ejabberd_sql_schema.erl @@ -773,14 +773,10 @@ should_update_schema(Host) -> case ejabberd_sql:use_new_schema() of true -> %% TODO: not efficient when there are many hosts - case lists:search( - fun(H) -> - lists:member( - sql, ejabberd_option:auth_method(H)) - end, ejabberd_option:hosts()) of - {value, Host} -> + case lists:member(sql, ejabberd_option:auth_method(Host)) of + true -> true; - _ -> + false -> false end; false ->