Uninstall scripts can exist for themes too

This commit is contained in:
Jamie Cameron 2021-12-28 21:00:10 -08:00
parent 0e3b7e4d94
commit 41800b10f9

View File

@ -7,12 +7,27 @@ BEGIN { push(@INC, "."); };
$no_acl_check++; $no_acl_check++;
use WebminCore; use WebminCore;
&init_config(); &init_config();
@themes = &list_themes();
if (@ARGV > 0) { if (@ARGV > 0) {
@mods = map { local %minfo = &get_module_info($_); \%minfo } @ARGV; # Running for specified modules
foreach $a (@ARGV) {
local %minfo = &get_module_info($a);
if (!%minfo) {
# Try for a theme
($tinfo) = grep { $_->{'dir'} eq $a } @themes;
if ($tinfo) {
push(@mods, $tinfo);
}
}
else {
push(@mods, \%minfo);
}
}
} }
else { else {
@mods = &get_all_module_infos(); # Running on all modules and themes
@mods = ( &get_all_module_infos(), @themes );
} }
foreach $m (@mods) { foreach $m (@mods) {
@ -26,7 +41,7 @@ foreach $m (@mods) {
&foreign_call($m->{'dir'}, "module_uninstall"); &foreign_call($m->{'dir'}, "module_uninstall");
}; };
if ($@) { if ($@) {
print STDERR "$m->{'dir'}/postinstall.pl failed : $@\n"; print STDERR "$m->{'dir'}/uninstall.pl failed : $@\n";
} }
} }
} }