mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Speedup table setup, no io if EJABBERD_SCHEMA_PATH not set (#1461)
This commit is contained in:
parent
c7476875e6
commit
2ce6d49a40
@ -117,19 +117,15 @@ merge(TabDef, CustomDef) ->
|
|||||||
lists:ukeysort(1, CleanDef)).
|
lists:ukeysort(1, CleanDef)).
|
||||||
|
|
||||||
parse(Module) ->
|
parse(Module) ->
|
||||||
Path = case os:getenv("EJABBERD_SCHEMA_PATH") of
|
case os:getenv("EJABBERD_SCHEMA_PATH") of
|
||||||
false ->
|
false ->
|
||||||
case code:priv_dir(ejabberd) of
|
{error, undefined};
|
||||||
{error, _} -> "schema"; % $SPOOL_DIR/schema
|
Path ->
|
||||||
Priv -> filename:join(Priv, "schema")
|
File = filename:join(Path, atom_to_list(Module)++".mnesia"),
|
||||||
end;
|
case file:consult(File) of
|
||||||
CustomDir ->
|
{ok, Terms} -> parse(Terms, []);
|
||||||
CustomDir
|
Error -> Error
|
||||||
end,
|
end
|
||||||
File = filename:join(Path, atom_to_list(Module)++".mnesia"),
|
|
||||||
case file:consult(File) of
|
|
||||||
{ok, Terms} -> parse(Terms, []);
|
|
||||||
Error -> Error
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
parse([], Acc) ->
|
parse([], Acc) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user