Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/updater.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-02-17 14:47:58 +0300
committerVincent Petry <vincent@nextcloud.com>2021-02-26 12:50:26 +0300
commitb53b4e389e5ae880af99a8727ebeefc1bcfb2691 (patch)
treebec09f75262321d242e3a80c154ff7219cc0dbad
parent4a5035b39692998e3cb2d728425530c9f5a863d4 (diff)
Align updater class with index.php
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
-rw-r--r--index.php2
-rw-r--r--lib/Updater.php17
2 files changed, 18 insertions, 1 deletions
diff --git a/index.php b/index.php
index 11cbf1c..1fdb2b5 100644
--- a/index.php
+++ b/index.php
@@ -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