diff --git a/package-updates/package-updates-lib.pl b/package-updates/package-updates-lib.pl index 64c075f97..74d0f3091 100644 --- a/package-updates/package-updates-lib.pl +++ b/package-updates/package-updates-lib.pl @@ -46,7 +46,7 @@ if (!$get_software_packages_cache) { return $get_software_packages_cache; } -# list_current(nocache) +# list_current([nocache]) # Returns a list of packages and versions for installed software. Keys are : # name - The my package name (ie. CSWapache2) # update - Name used to refer to it by the updates system (ie. apache2) @@ -418,15 +418,16 @@ if (defined(&software::update_system_operations)) { return ( ); } -# list_possible_updates([nocache]) +# list_possible_updates([nocache], [nocache-no-data]) # Returns a list of updates that are available. Each element in the array # is a hash ref containing a name, version, description and severity flag. # Intended for calling from themes. Nocache 0=cache everything, 1=flush all -# caches, 2=flush only current +# caches, 2=flush only current. Nocache-no-data prohibits collecting data sub list_possible_updates { -my ($nocache) = @_; +my ($nocache, $nocache_no_data) = @_; my @rv; +return @rv if ($nocache_no_data); my @current = &list_current($nocache); if (&supports_updates_available()) { # Software module supplies a function that can list just packages @@ -676,10 +677,13 @@ return $mode eq 'updates' || $mode eq 'security' ? &list_possible_updates($nocache) : &list_available($nocache); } -# check_reboot_required(after-flag) +# check_reboot_required([no-collect]) # Returns 1 if the package system thinks a reboot is needed +# If the no-collect flag is set, then check won't happen sub check_reboot_required { +my ($no_collect) = @_; +return 0 if ($no_collect); if ($gconfig{'os_type'} eq 'debian-linux') { return -e "/var/run/reboot-required" ? 1 : 0; } diff --git a/package-updates/update.cgi b/package-updates/update.cgi index b5f45d7a1..f019a4bd3 100755 --- a/package-updates/update.cgi +++ b/package-updates/update.cgi @@ -108,7 +108,7 @@ else { } else { # Check if a reboot was required before - $reboot_before = &check_reboot_required(0); + $reboot_before = &check_reboot_required(); # Do it $msg = $in{'mode'} eq 'new' ? 'update_pkg2' : 'update_pkg'; @@ -165,7 +165,7 @@ else { } # Check if a reboot is required now - if (!$reboot_before && &check_reboot_required(1) && + if (!$reboot_before && &check_reboot_required() && &foreign_check("init")) { print &ui_form_start( "@{[&get_webprefix()]}/init/reboot.cgi"); diff --git a/system-status/system-status-lib.pl b/system-status/system-status-lib.pl index b227c5612..2df92a54c 100755 --- a/system-status/system-status-lib.pl +++ b/system-status/system-status-lib.pl @@ -24,7 +24,8 @@ our $get_collected_info_cache; # Returns a hash reference containing system information sub collect_system_info { -my ($manual) = @_; +my ($manual, $modskip) = @_; +$modskip ||= []; my $info = { }; if (&foreign_check("proc")) { @@ -64,9 +65,11 @@ if (&foreign_check("mount")) { # Available package updates if (&foreign_installed("package-updates") && $config{'collect_pkgs'}) { &foreign_require("package-updates"); - my @poss = &package_updates::list_possible_updates(2, 1); + my $poss_collect_blocked = (&indexof('package-updates', @{$modskip}) > -1); + my $poss_current = !$poss_collect_blocked ? 2 : undef; + my @poss = &package_updates::list_possible_updates(undef, $poss_collect_blocked); $info->{'poss'} = \@poss; - $info->{'reboot'} = &package_updates::check_reboot_required(); + $info->{'reboot'} = &package_updates::check_reboot_required($poss_collect_blocked); } # CPU and drive temps @@ -105,7 +108,7 @@ return $info; # Returns the most recently collected system information, or the current info sub get_collected_info { -my ($manual) = @_; +my ($manual, $modskip) = @_; if (!defined($manual) || defined($manual) && $manual ne 'manual') { if ($get_collected_info_cache) { @@ -124,7 +127,7 @@ if (!defined($manual) || } } } -$get_collected_info_cache ||= &collect_system_info($manual); +$get_collected_info_cache ||= &collect_system_info($manual, $modskip); return $get_collected_info_cache; } diff --git a/system-status/system_info.pl b/system-status/system_info.pl index fa3340b3c..21ffedc52 100644 --- a/system-status/system_info.pl +++ b/system-status/system_info.pl @@ -10,7 +10,8 @@ our (%text, %gconfig, $module_name, %config); # Returns general information about the system, such as available disk space sub list_system_info { -my $info = &get_collected_info(); +my ($data, $in, $modskip) = @_; +my $info = &get_collected_info(undef, $modskip); my @rv; my @table; my @raw = $info; diff --git a/web-lib-funcs.pl b/web-lib-funcs.pl index b94d648aa..3426f77bf 100755 --- a/web-lib-funcs.pl +++ b/web-lib-funcs.pl @@ -12103,7 +12103,7 @@ return { 'type' => 'item', 'link' => '/'.$minfo->{'dir'}.'/' }; } -=head2 list_combined_system_info(&data, &in) +=head2 list_combined_system_info(&data, &in, [&modskip]) Returns an array of objects, each representing a block of system information to display. Each is a hash ref with the following keys : @@ -12179,20 +12179,22 @@ use where a system info block has a form that submits to itself. =cut sub list_combined_system_info { -my ($data, $in) = @_; +my ($data, $in, $modskip) = @_; &load_theme_library(); +$modskip ||= []; foreach my $m (&get_all_module_infos()) { + next if (&indexof($m->{'dir'}, @{$modskip}) > -1); my $dir = &module_root_directory($m->{'dir'}); my $mfile = "$dir/system_info.pl"; next if (!-r $mfile); &foreign_require($m->{'dir'}, "system_info.pl"); foreach my $i (&foreign_call($m->{'dir'}, "list_system_info", - $data, $in)) { + $data, $in, $modskip)) { $i->{'module'} = $m->{'dir'}; push(@rv, $i); } } -if (&foreign_available("webmin")) { +if ((&indexof('webmin', @{$modskip}) == -1) && &foreign_available("webmin")) { # Merge in old-style notification API &foreign_require("webmin"); foreach my $n (&webmin::get_webmin_notifications()) { diff --git a/webmin/webmin-lib.pl b/webmin/webmin-lib.pl index 456eb5dc7..21377c4f4 100755 --- a/webmin/webmin-lib.pl +++ b/webmin/webmin-lib.pl @@ -1305,7 +1305,7 @@ if (&foreign_check("package-updates") && &foreign_available("init")) { } } } - if (&package_updates::check_reboot_required() && $allow_reboot_required) { + if ($allow_reboot_required && &package_updates::check_reboot_required()) { push(@notifs, &ui_form_start("@{[&get_webprefix()]}/init/reboot.cgi"). $text{'notif_reboot'}."

\n".