Simplify and clean up code

This commit is contained in:
Jamie Cameron
2025-03-02 10:54:00 -08:00
parent 576fef7c76
commit f6fe748647

View File

@ -7,36 +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) {
# Running for specified modules # Running for specified modules
foreach $a (@ARGV) { foreach my $a (@ARGV) {
local %minfo = &get_module_info($a); my %minfo = &get_module_info($a);
if (!%minfo) { %minfo = &get_theme_info($a) if (!%minfo);
# Try for a theme push(@mods, \%minfo) if (%minfo);
($tinfo) = grep { $_->{'dir'} eq $a } @themes;
if ($tinfo) {
push(@mods, $tinfo);
}
}
else {
push(@mods, \%minfo);
}
} }
} }
else { else {
# Running on all modules and themes # Running on all modules and themes
@mods = ( &get_all_module_infos(), @themes ); @mods = ( &get_all_module_infos(), &list_themes() );
} }
foreach $m (@mods) { foreach my $m (@mods) {
$mdir = &module_root_directory($m->{'dir'}); my $mdir = &module_root_directory($m->{'dir'});
if (&check_os_support($m) && if (&check_os_support($m) &&
-r "$mdir/postinstall.pl") { -r "$mdir/postinstall.pl") {
# Call this module's postinstall function # Call this module's postinstall function
eval { eval {
$main::error_must_die = 1; local $main::error_must_die = 1;
&foreign_require($m->{'dir'}, "postinstall.pl"); &foreign_require($m->{'dir'}, "postinstall.pl");
&foreign_call($m->{'dir'}, "module_install"); &foreign_call($m->{'dir'}, "module_install");
}; };