summaryrefslogtreecommitdiffstats
path: root/apps/updatenotification
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-03-26 13:56:14 +0200
committerJoas Schilling <coding@schilljs.com>2018-04-18 13:46:25 +0200
commit6b97429ebe3d4e58137cfd0117f9cd4ecca7ebd3 (patch)
tree430a7fdef594b1a844ac6883c39b0d915c515ce8 /apps/updatenotification
parentfa65aaf1fc8836e1a0e5ee1ffe38ee032a487892 (diff)
downloadnextcloud-server-6b97429ebe3d4e58137cfd0117f9cd4ecca7ebd3.tar.gz
nextcloud-server-6b97429ebe3d4e58137cfd0117f9cd4ecca7ebd3.zip
Show EOL warning in the update section
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/updatenotification')
-rw-r--r--apps/updatenotification/css/admin.css3
-rw-r--r--apps/updatenotification/lib/Controller/AdminController.php1
-rw-r--r--apps/updatenotification/lib/UpdateChecker.php1
-rw-r--r--apps/updatenotification/templates/admin.php10
-rw-r--r--apps/updatenotification/tests/Controller/AdminControllerTest.php5
-rw-r--r--apps/updatenotification/tests/UpdateCheckerTest.php4
6 files changed, 23 insertions, 1 deletions
diff --git a/apps/updatenotification/css/admin.css b/apps/updatenotification/css/admin.css
index 59c8f056fbc..d3f7ef6aa26 100644
--- a/apps/updatenotification/css/admin.css
+++ b/apps/updatenotification/css/admin.css
@@ -1,3 +1,6 @@
#oca_updatenotification_section p {
margin: 25px 0;
}
+#updatenotification .warning {
+ color: #ce3702;
+}
diff --git a/apps/updatenotification/lib/Controller/AdminController.php b/apps/updatenotification/lib/Controller/AdminController.php
index c96326c862e..ac1d807aa2e 100644
--- a/apps/updatenotification/lib/Controller/AdminController.php
+++ b/apps/updatenotification/lib/Controller/AdminController.php
@@ -119,6 +119,7 @@ class AdminController extends Controller implements ISettings {
'newVersionString' => (empty($updateState['updateVersion'])) ? '' : $updateState['updateVersion'],
'downloadLink' => (empty($updateState['downloadLink'])) ? '' : $updateState['downloadLink'],
'updaterEnabled' => (empty($updateState['updaterEnabled'])) ? false : $updateState['updaterEnabled'],
+ 'versionIsEol' => empty($updateState['versionIsEol']) ? false : $updateState['versionIsEol'],
'isDefaultUpdateServerURL' => $updateServerURL === $defaultUpdateServerURL,
'updateServerURL' => $updateServerURL,
'notify_groups' => implode('|', $notifyGroups),
diff --git a/apps/updatenotification/lib/UpdateChecker.php b/apps/updatenotification/lib/UpdateChecker.php
index ad76de56953..bb5264a6c29 100644
--- a/apps/updatenotification/lib/UpdateChecker.php
+++ b/apps/updatenotification/lib/UpdateChecker.php
@@ -48,6 +48,7 @@ class UpdateChecker {
$result['updateAvailable'] = true;
$result['updateVersion'] = $data['versionstring'];
$result['updaterEnabled'] = $data['autoupdater'] === '1';
+ $result['versionIsEol'] = $data['eol'] === '1';
if(substr($data['web'], 0, 8) === 'https://') {
$result['updateLink'] = $data['web'];
}
diff --git a/apps/updatenotification/templates/admin.php b/apps/updatenotification/templates/admin.php
index e09d19848e7..81201069fee 100644
--- a/apps/updatenotification/templates/admin.php
+++ b/apps/updatenotification/templates/admin.php
@@ -30,6 +30,16 @@
<?php if (!empty($_['downloadLink'])) { ?>
<a href="<?php p($_['downloadLink']); ?>" class="button<?php if ($_['updaterEnabled']) { p(' hidden'); } ?>"><?php p($l->t('Download now')) ?></a>
<?php } ?>
+
+ <?php if (!empty($_['versionIsEol'])) { ?>
+ <p>
+ <span class="warning">
+ <span class="icon icon-error"></span>
+ <?php p($l->t('The version you are running is not maintained anymore. Please make sure to update to a supported version as soon as possible.')); ?>
+ </span>
+ </p>
+ <?php } ?>
+
<?php } elseif (!$isUpdateChecked) { ?>
<?php p($l->t('The update check is not yet finished. Please refresh the page.')); ?>
<?php } else { ?>
diff --git a/apps/updatenotification/tests/Controller/AdminControllerTest.php b/apps/updatenotification/tests/Controller/AdminControllerTest.php
index 6eb049f6281..7528dcbfaf9 100644
--- a/apps/updatenotification/tests/Controller/AdminControllerTest.php
+++ b/apps/updatenotification/tests/Controller/AdminControllerTest.php
@@ -122,6 +122,7 @@ class AdminControllerTest extends TestCase {
'updateVersion' => '8.1.2',
'downloadLink' => 'https://downloads.nextcloud.org/server',
'updaterEnabled' => true,
+ 'versionIsEol' => false,
]);
$params = [
@@ -133,6 +134,7 @@ class AdminControllerTest extends TestCase {
'newVersionString' => '8.1.2',
'downloadLink' => 'https://downloads.nextcloud.org/server',
'updaterEnabled' => true,
+ 'versionIsEol' => false,
'isDefaultUpdateServerURL' => true,
'updateServerURL' => 'https://updates.nextcloud.com/updater_server/',
'notify_groups' => 'admin',
@@ -186,7 +188,8 @@ class AdminControllerTest extends TestCase {
'channels' => $channels,
'newVersionString' => '',
'downloadLink' => '',
- 'updaterEnabled' => 0,
+ 'updaterEnabled' => false,
+ 'versionIsEol' => false,
'isDefaultUpdateServerURL' => true,
'updateServerURL' => 'https://updates.nextcloud.com/updater_server/',
'notify_groups' => 'admin',
diff --git a/apps/updatenotification/tests/UpdateCheckerTest.php b/apps/updatenotification/tests/UpdateCheckerTest.php
index f7ed83047a6..9920ed439d3 100644
--- a/apps/updatenotification/tests/UpdateCheckerTest.php
+++ b/apps/updatenotification/tests/UpdateCheckerTest.php
@@ -52,12 +52,14 @@ class UpdateCheckerTest extends TestCase {
'web'=> 'javascript:alert(1)',
'url'=> 'javascript:alert(2)',
'autoupdater'=> '0',
+ 'eol'=> '1',
]);
$expected = [
'updateAvailable' => true,
'updateVersion' => 'Nextcloud 123',
'updaterEnabled' => false,
+ 'versionIsEol' => true,
];
$this->assertSame($expected, $this->updateChecker->getUpdateState());
}
@@ -72,12 +74,14 @@ class UpdateCheckerTest extends TestCase {
'web'=> 'https://docs.nextcloud.com/myUrl',
'url'=> 'https://downloads.nextcloud.org/server',
'autoupdater'=> '1',
+ 'eol'=> '0',
]);
$expected = [
'updateAvailable' => true,
'updateVersion' => 'Nextcloud 123',
'updaterEnabled' => true,
+ 'versionIsEol' => false,
'updateLink' => 'https://docs.nextcloud.com/myUrl',
'downloadLink' => 'https://downloads.nextcloud.org/server',
];