mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 09:49:18 +02:00
ext_mod: When upgrading module, clean also the compiled directories
This commit is contained in:
parent
c20d745028
commit
5def9cef9f
1 changed files with 13 additions and 1 deletions
|
@ -148,7 +148,8 @@ get_commands_spec() ->
|
||||||
#ejabberd_commands{name = module_upgrade,
|
#ejabberd_commands{name = module_upgrade,
|
||||||
tags = [modules],
|
tags = [modules],
|
||||||
desc = "Upgrade the running code of an installed module",
|
desc = "Upgrade the running code of an installed module",
|
||||||
longdesc = "In practice, this uninstalls and installs the module",
|
longdesc = "In practice, this uninstalls, cleans the compiled files, and installs the module",
|
||||||
|
note = "improved in 25.xx",
|
||||||
module = ?MODULE, function = upgrade,
|
module = ?MODULE, function = upgrade,
|
||||||
args_desc = ["Module name"],
|
args_desc = ["Module name"],
|
||||||
args_example = [<<"mod_rest">>],
|
args_example = [<<"mod_rest">>],
|
||||||
|
@ -289,8 +290,19 @@ upgrade(Module) when is_atom(Module) ->
|
||||||
upgrade(misc:atom_to_binary(Module));
|
upgrade(misc:atom_to_binary(Module));
|
||||||
upgrade(Package) when is_binary(Package) ->
|
upgrade(Package) when is_binary(Package) ->
|
||||||
uninstall(Package),
|
uninstall(Package),
|
||||||
|
clean(Package),
|
||||||
install(Package).
|
install(Package).
|
||||||
|
|
||||||
|
clean(Package) ->
|
||||||
|
Spec = [S || {Mod, S} <- available(), misc:atom_to_binary(Mod)==Package],
|
||||||
|
case Spec of
|
||||||
|
[] ->
|
||||||
|
{error, not_available};
|
||||||
|
[Attrs] ->
|
||||||
|
Path = proplists:get_value(path, Attrs),
|
||||||
|
[delete_path(SubPath) || SubPath <- filelib:wildcard(Path++"/{deps,ebin}")]
|
||||||
|
end.
|
||||||
|
|
||||||
add_sources(Path) when is_list(Path) ->
|
add_sources(Path) when is_list(Path) ->
|
||||||
add_sources(iolist_to_binary(module_name(Path)), Path).
|
add_sources(iolist_to_binary(module_name(Path)), Path).
|
||||||
add_sources(_, "") ->
|
add_sources(_, "") ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue