summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
authorSimon Rettberg2023-07-17 10:01:59 +0200
committerSimon Rettberg2023-07-17 10:01:59 +0200
commitecd195f5aa0082186be604c06e8409e3cdb50005 (patch)
treec2f1c20deb0888e89b34490add1e2b59781b84e2 /modules-available
parent[minilinux] Make title db columns longer (diff)
downloadslx-admin-ecd195f5aa0082186be604c06e8409e3cdb50005.tar.gz
slx-admin-ecd195f5aa0082186be604c06e8409e3cdb50005.tar.xz
slx-admin-ecd195f5aa0082186be604c06e8409e3cdb50005.zip
[systemstatus] Show "reboot required" message on update-tab too
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/systemstatus/hooks/main-warning.inc.php7
-rw-r--r--modules-available/systemstatus/inc/systemstatus.inc.php13
-rw-r--r--modules-available/systemstatus/lang/de/template-tags.json1
-rw-r--r--modules-available/systemstatus/lang/en/template-tags.json1
-rw-r--r--modules-available/systemstatus/page.inc.php8
-rw-r--r--modules-available/systemstatus/templates/sys-update-main.html10
6 files changed, 32 insertions, 8 deletions
diff --git a/modules-available/systemstatus/hooks/main-warning.inc.php b/modules-available/systemstatus/hooks/main-warning.inc.php
index 02b017e8..facf5d83 100644
--- a/modules-available/systemstatus/hooks/main-warning.inc.php
+++ b/modules-available/systemstatus/hooks/main-warning.inc.php
@@ -1,9 +1,8 @@
<?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));
+$pkgs = SystemStatus::getPackagesRequiringReboot();
+if (!empty($pkgs)) {
+ Message::addInfo('systemstatus.update-reboot-required', true, implode(', ', $pkgs));
}
$aptTs = SystemStatus::getAptLastDbUpdateTime();
diff --git a/modules-available/systemstatus/inc/systemstatus.inc.php b/modules-available/systemstatus/inc/systemstatus.inc.php
index 85f0410b..ff8543c1 100644
--- a/modules-available/systemstatus/inc/systemstatus.inc.php
+++ b/modules-available/systemstatus/inc/systemstatus.inc.php
@@ -95,4 +95,17 @@ class SystemStatus
return (int)filemtime(file_exists('/var/log/dpkg.log') ? '/var/log/dpkg.log' : '/var/lib/dpkg/status');
}
+ /**
+ * Get list of packages that have been updated, but require a reboot of the system
+ * to fully take effect.
+ * @return string[]
+ */
+ public static function getPackagesRequiringReboot(): array
+ {
+ if (!file_exists('/run/reboot-required.pkgs'))
+ return [];
+ $lines = file('/run/reboot-required.pkgs', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
+ return array_unique($lines);
+ }
+
} \ No newline at end of file
diff --git a/modules-available/systemstatus/lang/de/template-tags.json b/modules-available/systemstatus/lang/de/template-tags.json
index 08f75a27..c94720a6 100644
--- a/modules-available/systemstatus/lang/de/template-tags.json
+++ b/modules-available/systemstatus/lang/de/template-tags.json
@@ -31,6 +31,7 @@
"lang_onlyOS": "Nur OS",
"lang_overview": "\u00dcbersicht",
"lang_package": "Paket",
+ "lang_packagesNeedingReboot": "Pakete, die einen Systemneustart erfordern",
"lang_ramUsage": "RAM-Nutzung",
"lang_removeUnusedPackages": "Nicht mehr ben\u00f6tigte Pakete entfernen",
"lang_restart": "Neustarten",
diff --git a/modules-available/systemstatus/lang/en/template-tags.json b/modules-available/systemstatus/lang/en/template-tags.json
index 3ae392d4..7758c71c 100644
--- a/modules-available/systemstatus/lang/en/template-tags.json
+++ b/modules-available/systemstatus/lang/en/template-tags.json
@@ -31,6 +31,7 @@
"lang_onlyOS": "OS only",
"lang_overview": "Overview",
"lang_package": "Package",
+ "lang_packagesNeedingReboot": "Packages that require a system reboot",
"lang_ramUsage": "RAM usage",
"lang_removeUnusedPackages": "Remove unused packages",
"lang_restart": "Restart",
diff --git a/modules-available/systemstatus/page.inc.php b/modules-available/systemstatus/page.inc.php
index 34dbcc84..96b2c5c9 100644
--- a/modules-available/systemstatus/page.inc.php
+++ b/modules-available/systemstatus/page.inc.php
@@ -97,10 +97,9 @@ class Page_SystemStatus extends Page
);
}
Permission::addGlobalTags($data['perms'], null, ['serverreboot']);
- 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);
- $data['packages'] = implode(', ', $lines);
+ $pkgs = SystemStatus::getPackagesRequiringReboot();
+ if (!empty($pkgs)) {
+ $data['packages'] = implode(', ', $pkgs);
}
Render::addTemplate('_page', $data);
}
@@ -165,6 +164,7 @@ class Page_SystemStatus extends Page
'lastInstalled' => Util::prettyTime($lastPackageInstalled),
'perm' => $perms,
'list_old' => $lastListDownloadAttempt + 86400 < time(),
+ 'needReboot' => implode(', ', SystemStatus::getPackagesRequiringReboot()),
]);
}
diff --git a/modules-available/systemstatus/templates/sys-update-main.html b/modules-available/systemstatus/templates/sys-update-main.html
index f597f5ae..e12792d9 100644
--- a/modules-available/systemstatus/templates/sys-update-main.html
+++ b/modules-available/systemstatus/templates/sys-update-main.html
@@ -95,6 +95,16 @@
{{/task.error}}
{{/task.packages}}
+{{#needReboot}}
+ <div class="alert alert-warning">
+ <span class="glyphicon glyphicon-exclamation-sign"></span>
+ {{lang_packagesNeedingReboot}}:
+ <a href="#id-default_pane">
+ {{.}}
+ </a>
+ </div>
+{{/needReboot}}
+
{{#task.error}}
<div class="alert alert-warning">{{task.error}}</div>
{{/task.error}}