diff options
author | Vincent Petry <vincent@nextcloud.com> | 2021-02-17 14:47:58 +0300 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2021-02-26 12:50:26 +0300 |
commit | b53b4e389e5ae880af99a8727ebeefc1bcfb2691 (patch) | |
tree | bec09f75262321d242e3a80c154ff7219cc0dbad | |
parent | 4a5035b39692998e3cb2d728425530c9f5a863d4 (diff) |
Align updater class with index.php
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
-rw-r--r-- | index.php | 2 | ||||
-rw-r--r-- | lib/Updater.php | 17 |
2 files changed, 18 insertions, 1 deletions
@@ -177,7 +177,7 @@ class Updater { require_once $configFileName; $this->configValues = $CONFIG; - if (php_sapi_name() !== 'cli' && $this->configValues['upgrade.disable-web'] ?? false) { + if (php_sapi_name() !== 'cli' && ($this->configValues['upgrade.disable-web'] ?? false)) { // updater disabled $this->disabled = true; return; diff --git a/lib/Updater.php b/lib/Updater.php index e62b79f..6308295 100644 --- a/lib/Updater.php +++ b/lib/Updater.php @@ -36,6 +36,8 @@ class Updater { private $updateAvailable = false; /** @var string */ private $requestID = null; + /** @var bool */ + private $disabled = false; /** * Updater constructor @@ -58,6 +60,12 @@ class Updater { require_once $configFileName; $this->configValues = $CONFIG; + if (php_sapi_name() !== 'cli' && ($this->configValues['upgrade.disable-web'] ?? false)) { + // updater disabled + $this->disabled = true; + return; + } + $dataDir = $this->getDataDirectoryLocation(); if(empty($dataDir) || !is_string($dataDir)) { throw new \Exception('Could not read data directory from config.php.'); @@ -94,6 +102,15 @@ class Updater { } /** + * Returns whether the web updater is disabled + * + * @return bool + */ + public function isDisabled() { + return $this->disabled; + } + + /** * Returns current version or "unknown" if this could not be determined. * * @return string |