Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/updatenotification/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@
color: #555;
font-weight: normal;
}

#updatenotification .warning {
color: #ce3702;
}
1 change: 1 addition & 0 deletions apps/updatenotification/js-src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ define(function (require) {
this.vm.channels = data.channels;
this.vm.notifyGroups = data.notifyGroups;
this.vm.isDefaultUpdateServerURL = data.isDefaultUpdateServerURL;
this.vm.versionIsEol = data.versionIsEol;
}
};
});
8 changes: 8 additions & 0 deletions apps/updatenotification/js-src/components/root.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
<div id="updatenotification" class="followupsection">
<div class="update">
<template v-if="isNewVersionAvailable">
<p v-if="versionIsEol">
<span class="warning">
<span class="icon icon-error"></span>
{{ t('updatenotification', 'The version you are running is not maintained anymore. Please make sure to update to a supported version as soon as possible.') }}
</span>
</p>

<p>
<span v-html="newVersionAvailableString"></span><br>
<span v-if="!isListFetched" class="icon icon-loading-small"></span>
Expand Down Expand Up @@ -83,6 +90,7 @@
lastCheckedDate: '',
isUpdateChecked: false,
updaterEnabled: true,
versionIsEol: false,
downloadLink: '',
isNewVersionAvailable: false,
updateServerURL: '',
Expand Down
1 change: 1 addition & 0 deletions apps/updatenotification/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public function getForm(): TemplateResponse {
'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,
'notifyGroups' => $this->getSelectedGroups($notifyGroups),
Expand Down
1 change: 1 addition & 0 deletions apps/updatenotification/lib/UpdateChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function getUpdateState(): array {
$result['updateAvailable'] = true;
$result['updateVersion'] = $data['versionstring'];
$result['updaterEnabled'] = $data['autoupdater'] === '1';
$result['versionIsEol'] = $data['eol'] === '1';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also work if eol is not set? (just asking for old updater servers ;))

if (strpos($data['web'], 'https://') === 0) {
$result['updateLink'] = $data['web'];
}
Expand Down
2 changes: 2 additions & 0 deletions apps/updatenotification/tests/Settings/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function testGetFormWithUpdate() {
'updateVersion' => '8.1.2',
'downloadLink' => 'https://downloads.nextcloud.org/server',
'updaterEnabled' => true,
'versionIsEol' => false,
]);

$group = $this->createMock(IGroup::class);
Expand All @@ -124,6 +125,7 @@ public function testGetFormWithUpdate() {
'newVersionString' => '8.1.2',
'downloadLink' => 'https://downloads.nextcloud.org/server',
'updaterEnabled' => true,
'versionIsEol' => false,
'isDefaultUpdateServerURL' => true,
'updateServerURL' => 'https://updates.nextcloud.com/updater_server/',
'notifyGroups' => [
Expand Down
4 changes: 4 additions & 0 deletions apps/updatenotification/tests/UpdateCheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ public function testGetUpdateStateWithUpdateAndInvalidLink() {
'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());
}
Expand All @@ -72,12 +74,14 @@ public function testGetUpdateStateWithUpdateAndValidLink() {
'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',
];
Expand Down
1 change: 1 addition & 0 deletions lib/private/Updater/VersionCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public function check() {
$tmp['url'] = (string)$data->url;
$tmp['web'] = (string)$data->web;
$tmp['autoupdater'] = (string)$data->autoupdater;
$tmp['eol'] = isset($data->eol) ? (string)$data->eol : '0';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MorrisJobke isset check for old servers is here

} else {
libxml_clear_errors();
}
Expand Down
4 changes: 4 additions & 0 deletions tests/lib/Updater/VersionCheckTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public function testCheckWithoutUpdateUrl() {
'url' => 'https://download.example.org/community/owncloud-8.0.4.zip',
'web' => 'http://doc.example.org/server/8.0/admin_manual/maintenance/upgrade.html',
'autoupdater' => '0',
'eol' => '1',
];

$this->config
Expand Down Expand Up @@ -123,6 +124,7 @@ public function testCheckWithoutUpdateUrl() {
<url>https://download.example.org/community/owncloud-8.0.4.zip</url>
<web>http://doc.example.org/server/8.0/admin_manual/maintenance/upgrade.html</web>
<autoupdater>0</autoupdater>
<eol>1</eol>
</owncloud>';
$this->updater
->expects($this->once())
Expand Down Expand Up @@ -180,6 +182,7 @@ public function testCheckWithEmptyValidXmlResponse() {
'url' => '',
'web' => '',
'autoupdater' => '',
'eol' => '0',
];

$this->config
Expand Down Expand Up @@ -273,6 +276,7 @@ public function testCheckWithMissingAttributeXmlResponse() {
'url' => '',
'web' => '',
'autoupdater' => '',
'eol' => '0',
];

$this->config
Expand Down