summaryrefslogtreecommitdiffstats
path: root/apps/updatenotification/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-05-13 14:11:07 +0200
committerMorris Jobke <hey@morrisjobke.de>2019-07-10 16:19:34 +0200
commit39c28bd05ba7ec106c7e86592e00192a550e50f7 (patch)
tree9eaf1303fd0263c293b5f9336c6ce04bdb0ae189 /apps/updatenotification/lib
parente94bbfc5827b9d5ebb87bb7c5038b6d2d617d27f (diff)
downloadnextcloud-server-39c28bd05ba7ec106c7e86592e00192a550e50f7.tar.gz
nextcloud-server-39c28bd05ba7ec106c7e86592e00192a550e50f7.zip
Enterprise update channel
Allows to select the enterprise update channel for instances that have a valid subscription. Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/updatenotification/lib')
-rw-r--r--apps/updatenotification/lib/Settings/Admin.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/updatenotification/lib/Settings/Admin.php b/apps/updatenotification/lib/Settings/Admin.php
index 571a8e9f906..e7a8f07a183 100644
--- a/apps/updatenotification/lib/Settings/Admin.php
+++ b/apps/updatenotification/lib/Settings/Admin.php
@@ -34,6 +34,7 @@ use OCP\IGroupManager;
use OCP\IUserSession;
use OCP\L10N\IFactory;
use OCP\Settings\ISettings;
+use OCP\Support\Subscription\IRegistry;
use OCP\Util;
class Admin implements ISettings {
@@ -47,19 +48,23 @@ class Admin implements ISettings {
private $dateTimeFormatter;
/** @var IFactory */
private $l10nFactory;
+ /** @var IRegistry */
+ private $subscriptionRegistry;
public function __construct(
IConfig $config,
UpdateChecker $updateChecker,
IGroupManager $groupManager,
IDateTimeFormatter $dateTimeFormatter,
- IFactory $l10nFactory
+ IFactory $l10nFactory,
+ IRegistry $subscriptionRegistry
) {
$this->config = $config;
$this->updateChecker = $updateChecker;
$this->groupManager = $groupManager;
$this->dateTimeFormatter = $dateTimeFormatter;
$this->l10nFactory = $l10nFactory;
+ $this->subscriptionRegistry = $subscriptionRegistry;
}
/**
@@ -86,6 +91,12 @@ class Admin implements ISettings {
$defaultUpdateServerURL = 'https://updates.nextcloud.com/updater_server/';
$updateServerURL = $this->config->getSystemValue('updater.server.url', $defaultUpdateServerURL);
+ $defaultCustomerUpdateServerURLPrefix = 'https://updates.nextcloud.com/customers/';
+
+ $isDefaultUpdateServerURL = $updateServerURL === $defaultUpdateServerURL
+ || $updateServerURL === substr($updateServerURL, 0, strlen($defaultCustomerUpdateServerURLPrefix));
+
+ $hasValidSubscription = $this->subscriptionRegistry->delegateHasValidSubscription();
$params = [
'isNewVersionAvailable' => !empty($updateState['updateAvailable']),
@@ -99,9 +110,10 @@ class Admin implements ISettings {
'changes' => $this->filterChanges($updateState['changes'] ?? []),
'updaterEnabled' => empty($updateState['updaterEnabled']) ? false : $updateState['updaterEnabled'],
'versionIsEol' => empty($updateState['versionIsEol']) ? false : $updateState['versionIsEol'],
- 'isDefaultUpdateServerURL' => $updateServerURL === $defaultUpdateServerURL,
+ 'isDefaultUpdateServerURL' => $isDefaultUpdateServerURL,
'updateServerURL' => $updateServerURL,
'notifyGroups' => $this->getSelectedGroups($notifyGroups),
+ 'hasValidSubscription' => $hasValidSubscription,
];
$params = [