Document and example of pre_uninstall/0 (processone/ejabberd#3548)

This commit is contained in:
Badlop 2021-03-16 16:32:36 +01:00
parent 4cde5d84f2
commit 2aea4659cc
2 changed files with 9 additions and 0 deletions

View File

@ -64,3 +64,7 @@ The following organization has been set up for the development:
- Module developers should note in the `README.txt` file whether the
module has requirements or known incompatibilities with other modules.
- If your module project contains several erlang modules, you should export a
function pre_uninstall/0 in the main one listing the other ones.
See mod_statsdx as an example.

View File

@ -15,6 +15,7 @@
-export([start/2, stop/1, depends/2, mod_opt_type/1, mod_options/1]).
-export([loop/1, get_statistic/2,
pre_uninstall/0,
received_response/3,
%% Commands
getstatsdx/1, getstatsdx/2,
@ -79,6 +80,10 @@ stop(Host) ->
_ -> ?PROCNAME ! {stop, Host}
end.
pre_uninstall() ->
[{code:purge(M), code:delete(M)}
|| M <- [mod_stats2file]].
depends(_Host, _Opts) ->
[].