diff options
Diffstat (limited to 'modules-available/systemstatus/hooks/main-warning.inc.php')
-rw-r--r-- | modules-available/systemstatus/hooks/main-warning.inc.php | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/modules-available/systemstatus/hooks/main-warning.inc.php b/modules-available/systemstatus/hooks/main-warning.inc.php index 406ae73c..6b0ac981 100644 --- a/modules-available/systemstatus/hooks/main-warning.inc.php +++ b/modules-available/systemstatus/hooks/main-warning.inc.php @@ -1,7 +1,26 @@ <?php -if (file_exists('/run/reboot-required.pkgs')) { - $lines = file('/run/reboot-required.pkgs', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); - $lines = array_unique($lines); - Message::addInfo('systemstatus.update-reboot-required', true, implode(', ', $lines)); +$cnt = SystemStatus::getUpgradableSecurityCount(); +if ($cnt > 0) { + Message::addWarning('systemstatus.security-updates-available', true, $cnt); +} + +$pkgs = SystemStatus::getPackagesRequiringReboot(); +if (!empty($pkgs)) { + Message::addInfo('systemstatus.update-reboot-required', true, implode(', ', $pkgs)); +} + +$aptTs = SystemStatus::getAptLastDbUpdateTime(); +if ($aptTs + 864000 < time()) { + // No update for 10 days + Message::addWarning('systemstatus.apt-db-out-of-date', true, Util::prettyTime($aptTs)); +} + +if (SystemStatus::diskStat($systemUsage, $storeUsage, $current, $wanted)) { + if ($current === $wanted && isset($storeUsage['freeKb']) && $storeUsage['freeKb'] < 60000000) { // 60GB + Message::addWarning('systemstatus.storage-low-vmstore', true, Util::readableFileSize($storeUsage['freeKb'], -1 , 1)); + } + if (isset($systemUsage['freeKb']) && $systemUsage['freeKb'] < 600000) { // 600MB + Message::addWarning('systemstatus.storage-low-system', true, Util::readableFileSize($systemUsage['freeKb'], -1 , 1)); + } }
\ No newline at end of file |