diff options
author | Simon Rettberg | 2017-06-06 19:07:14 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-06-06 19:07:14 +0200 |
commit | dd058b606d935c5d4dd6b2d6cd44ec2088868b37 (patch) | |
tree | bd04010196064f19c32d2e0d9d672a4c65f09715 | |
parent | [translation] Fix warning (diff) | |
download | slx-admin-dd058b606d935c5d4dd6b2d6cd44ec2088868b37.tar.gz slx-admin-dd058b606d935c5d4dd6b2d6cd44ec2088868b37.tar.xz slx-admin-dd058b606d935c5d4dd6b2d6cd44ec2088868b37.zip |
[systemstatus] Show updated packages requiring reboot
7 files changed, 46 insertions, 10 deletions
diff --git a/modules-available/systemstatus/hooks/main-warning.inc.php b/modules-available/systemstatus/hooks/main-warning.inc.php new file mode 100644 index 00000000..406ae73c --- /dev/null +++ b/modules-available/systemstatus/hooks/main-warning.inc.php @@ -0,0 +1,7 @@ +<?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)); +}
\ No newline at end of file diff --git a/modules-available/systemstatus/lang/de/messages.json b/modules-available/systemstatus/lang/de/messages.json index 7838acfa..1a6df1b3 100644 --- a/modules-available/systemstatus/lang/de/messages.json +++ b/modules-available/systemstatus/lang/de/messages.json @@ -1,3 +1,4 @@ { - "reboot-unconfirmed": "Sicherheitsabfrage zum Reboot nicht best\u00e4tigt" + "reboot-unconfirmed": "Sicherheitsabfrage zum Reboot nicht best\u00e4tigt", + "update-reboot-required": "Das Update der folgenden Pakete erfordert einen Reboot des Servers: {{0}}" }
\ 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 f014871b..1333fb7d 100644 --- a/modules-available/systemstatus/lang/de/template-tags.json +++ b/modules-available/systemstatus/lang/de/template-tags.json @@ -4,6 +4,8 @@ "lang_average": "Durchschnitt", "lang_capacity": "Kapazit\u00e4t", "lang_cpuLoad": "CPU-Last", + "lang_dmsdUnreachable": "dmsd nicht erreichbar", + "lang_downloads": "Downloads", "lang_foundStore": "Vorgefunden:", "lang_free": "Frei", "lang_goToStoreConf": "Zur VM-Store-Konfiguration wechseln", @@ -25,6 +27,8 @@ "lang_systemPartition": "Systempartition", "lang_systemStoreError": "Fehler beim Ermitteln des verf\u00fcgbaren Systemspeichers", "lang_total": "Gesamt", + "lang_updatedPackages": "Ausstehende Updates", + "lang_uploads": "Uploads", "lang_uptimeOS": "OS Uptime", "lang_vmStore": "VM-Speicher", "lang_vmStoreError": "Fehler beim Ermitteln des verf\u00fcgbaren Speicherplatzes am VM-Speicherort. Bitte \u00fcberpr\u00fcfen Sie die Konfiguration." diff --git a/modules-available/systemstatus/lang/en/messages.json b/modules-available/systemstatus/lang/en/messages.json index 5aaf57ec..5098eb76 100644 --- a/modules-available/systemstatus/lang/en/messages.json +++ b/modules-available/systemstatus/lang/en/messages.json @@ -1,3 +1,4 @@ { - "reboot-unconfirmed": "Confirmation prompt to reboot not confirmed" + "reboot-unconfirmed": "Confirmation prompt to reboot not confirmed", + "update-reboot-required": "Updating the following system packages requires reboot: {{0}}" }
\ No newline at end of file diff --git a/modules-available/systemstatus/lang/en/template-tags.json b/modules-available/systemstatus/lang/en/template-tags.json index 719a1155..46b7e18b 100644 --- a/modules-available/systemstatus/lang/en/template-tags.json +++ b/modules-available/systemstatus/lang/en/template-tags.json @@ -4,6 +4,8 @@ "lang_average": "Average", "lang_capacity": "Capacity", "lang_cpuLoad": "CPU Load", + "lang_dmsdUnreachable": "dmsd not reachable", + "lang_downloads": "Downloads", "lang_foundStore": "Found:", "lang_free": "Free", "lang_goToStoreConf": "Go to VM store configuration", @@ -25,6 +27,8 @@ "lang_systemPartition": "System Partition", "lang_systemStoreError": "Error querying available system storage", "lang_total": "Total", + "lang_updatedPackages": "Pending updates", + "lang_uploads": "Uploads", "lang_uptimeOS": "OS Uptime", "lang_vmStore": "VM Store", "lang_vmStoreError": "Error determining available space of the VM storage. Please check the configuration." diff --git a/modules-available/systemstatus/page.inc.php b/modules-available/systemstatus/page.inc.php index a8deeecb..f7ec7022 100644 --- a/modules-available/systemstatus/page.inc.php +++ b/modules-available/systemstatus/page.inc.php @@ -59,17 +59,22 @@ class Page_SystemStatus extends Page protected function ajaxDmsdUsers() { $ret = Download::asStringPost('http://127.0.0.1:9080/status/fileserver', false, 2, $code); + $args = array(); if ($code != 200) { - Header('HTTP/1.1 502 Internal Server Error'); - die('Internal Server Wurst'); - } - $data = @json_decode($ret, true); - if (is_array($data)) { - $ret = 'Uploads: ' . $data['activeUploads'] . ', Downloads: ' . $data['activeDownloads']; + $args['dmsd_error'] = true; } else { - $ret = '???'; + $data = @json_decode($ret, true); + if (is_array($data)) { + $args['uploads'] = $data['activeUploads']; + $args['downloads'] = $data['activeDownloads']; + } + } + 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); + $args['packages'] = implode(', ', $lines); } - die($ret); + echo Render::parse('ajax-reboot', $args); } protected function ajaxDiskStat() diff --git a/modules-available/systemstatus/templates/ajax-reboot.html b/modules-available/systemstatus/templates/ajax-reboot.html new file mode 100644 index 00000000..a1aaf1e6 --- /dev/null +++ b/modules-available/systemstatus/templates/ajax-reboot.html @@ -0,0 +1,14 @@ +<div> + {{^dmsd_error}} + {{lang_uploads}}: {{uploads}}, + {{lang_downloads}}: {{downloads}} + {{/dmsd_error}} + {{#dmsd_error}} + <div class="alert alert-warning">{{lang_dmsdUnreachable}}</div> + {{/dmsd_error}} +</div> +<div> + {{#packages}} + {{lang_updatedPackages}}: {{packages}} + {{/packages}} +</div>
\ No newline at end of file |