diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2016-11-28 17:15:57 +0100 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2016-11-28 17:15:57 +0100 |
commit | fc7e52df71b0b02fb2a0f34fcb5db03e04cfac22 (patch) | |
tree | 0839bcafa900667a6aea48d8f4047454a82c9cb3 /src | |
parent | Improve translation of some messages (diff) |
Adds optional post_install and pre_uninstall hooks (thanks Igor Manturov Jr.)(#1300)
Diffstat (limited to 'src')
-rw-r--r-- | src/ext_mod.erl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ext_mod.erl b/src/ext_mod.erl index 071fb827c..5b970623b 100644 --- a/src/ext_mod.erl +++ b/src/ext_mod.erl @@ -170,7 +170,10 @@ install(Package) when is_binary(Package) -> ok -> code:add_patha(module_ebin_dir(Module)), ejabberd_config:reload_file(), - ok; + case erlang:function_exported(Module, post_install, 0) of + true -> Module:post_install(); + _ -> ok + end; Error -> delete_path(module_lib_dir(Module)), Error @@ -183,6 +186,10 @@ uninstall(Package) when is_binary(Package) -> case installed(Package) of true -> Module = jlib:binary_to_atom(Package), + case erlang:function_exported(Module, pre_uninstall, 0) of + true -> Module:pre_uninstall(); + _ -> ok + end, [catch gen_mod:stop_module(Host, Module) || Host <- ejabberd_config:get_myhosts()], code:purge(Module), |