diff options
-rw-r--r-- | apps/updatenotification/css/admin.css | 12 | ||||
-rw-r--r-- | apps/updatenotification/lib/Controller/AdminController.php | 2 | ||||
-rw-r--r-- | apps/updatenotification/lib/UpdateChecker.php | 1 | ||||
-rw-r--r-- | apps/updatenotification/templates/admin.php | 11 | ||||
-rw-r--r-- | apps/updatenotification/tests/Controller/AdminControllerTest.php | 5 | ||||
-rw-r--r-- | apps/updatenotification/tests/UpdateCheckerTest.php | 4 | ||||
-rw-r--r-- | lib/private/Updater/VersionCheck.php | 1 | ||||
-rw-r--r-- | tests/lib/Updater/VersionCheckTest.php | 3 |
8 files changed, 37 insertions, 2 deletions
diff --git a/apps/updatenotification/css/admin.css b/apps/updatenotification/css/admin.css new file mode 100644 index 00000000000..3c4016aa4c2 --- /dev/null +++ b/apps/updatenotification/css/admin.css @@ -0,0 +1,12 @@ +#oca_updatenotification_section p { + margin: 25px 0; +} + +#updatenotification .warning { + color: #ce3702; +} + +#oca_updatenotification_section p.eol .icon { + display: inline-block; + margin-bottom: -3px; +} diff --git a/apps/updatenotification/lib/Controller/AdminController.php b/apps/updatenotification/lib/Controller/AdminController.php index 0a867f1267c..7524c791167 100644 --- a/apps/updatenotification/lib/Controller/AdminController.php +++ b/apps/updatenotification/lib/Controller/AdminController.php @@ -114,7 +114,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'], 'notify_groups' => implode('|', $notifyGroups), ]; diff --git a/apps/updatenotification/lib/UpdateChecker.php b/apps/updatenotification/lib/UpdateChecker.php index 040a6c3a6ac..359fe10179d 100644 --- a/apps/updatenotification/lib/UpdateChecker.php +++ b/apps/updatenotification/lib/UpdateChecker.php @@ -47,6 +47,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 369d4905a40..d8874b10a02 100644 --- a/apps/updatenotification/templates/admin.php +++ b/apps/updatenotification/templates/admin.php @@ -1,5 +1,6 @@ <?php script('updatenotification', 'admin'); + style('updatenotification', 'admin'); /** @var array $_ */ /** @var bool $isNewVersionAvailable */ @@ -16,6 +17,16 @@ <form id="oca_updatenotification_section" class="followupsection"> <?php if($isNewVersionAvailable === true) { ?> <strong><?php p($l->t('A new version is available: %s', [$newVersionString])); ?></strong> + + <?php if (!empty($_['versionIsEol'])) { ?> + <p class="eol"> + <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 if ($_['updaterEnabled']) { ?> <input type="button" id="oca_updatenotification_button" value="<?php p($l->t('Open updater')) ?>"> <?php } ?> diff --git a/apps/updatenotification/tests/Controller/AdminControllerTest.php b/apps/updatenotification/tests/Controller/AdminControllerTest.php index 31e852a9e2e..fc4708c9930 100644 --- a/apps/updatenotification/tests/Controller/AdminControllerTest.php +++ b/apps/updatenotification/tests/Controller/AdminControllerTest.php @@ -116,6 +116,7 @@ class AdminControllerTest extends TestCase { 'updateVersion' => '8.1.2', 'downloadLink' => 'https://downloads.nextcloud.org/server', 'updaterEnabled' => true, + 'versionIsEol' => false, ]); $params = [ @@ -126,6 +127,7 @@ class AdminControllerTest extends TestCase { 'newVersionString' => '8.1.2', 'downloadLink' => 'https://downloads.nextcloud.org/server', 'updaterEnabled' => true, + 'versionIsEol' => false, 'notify_groups' => 'admin', ]; @@ -171,7 +173,8 @@ class AdminControllerTest extends TestCase { 'channels' => $channels, 'newVersionString' => '', 'downloadLink' => '', - 'updaterEnabled' => 0, + 'updaterEnabled' => false, + 'versionIsEol' => false, 'notify_groups' => 'admin', ]; diff --git a/apps/updatenotification/tests/UpdateCheckerTest.php b/apps/updatenotification/tests/UpdateCheckerTest.php index c5c3034dd72..c8c6e8df064 100644 --- a/apps/updatenotification/tests/UpdateCheckerTest.php +++ b/apps/updatenotification/tests/UpdateCheckerTest.php @@ -51,12 +51,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()); } @@ -71,12 +73,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', ]; diff --git a/lib/private/Updater/VersionCheck.php b/lib/private/Updater/VersionCheck.php index 7b8b7073d6d..12e5236779e 100644 --- a/lib/private/Updater/VersionCheck.php +++ b/lib/private/Updater/VersionCheck.php @@ -96,6 +96,7 @@ class VersionCheck { $tmp['url'] = (string)$data->url; $tmp['web'] = (string)$data->web; $tmp['autoupdater'] = (string)$data->autoupdater; + $tmp['eol'] = isset($data->eol) ? (string)$data->eol : '0'; } else { libxml_clear_errors(); } diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php index 79c0a88dbf6..baf69bf056b 100644 --- a/tests/lib/Updater/VersionCheckTest.php +++ b/tests/lib/Updater/VersionCheckTest.php @@ -84,6 +84,7 @@ class VersionCheckTest extends \Test\TestCase { 'url' => 'https://download.owncloud.org/community/owncloud-8.0.4.zip', 'web' => 'http://doc.owncloud.org/server/8.0/admin_manual/maintenance/upgrade.html', 'autoupdater' => '0', + 'eol' => '1', ]; $this->config @@ -122,6 +123,7 @@ class VersionCheckTest extends \Test\TestCase { <url>https://download.owncloud.org/community/owncloud-8.0.4.zip</url> <web>http://doc.owncloud.org/server/8.0/admin_manual/maintenance/upgrade.html</web> <autoupdater>0</autoupdater> + <eol>1</eol> </owncloud>'; $this->updater ->expects($this->once()) @@ -179,6 +181,7 @@ class VersionCheckTest extends \Test\TestCase { 'url' => '', 'web' => '', 'autoupdater' => '', + 'eol' => '0', ]; $this->config |