Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Align updater class with index.php
Signed-off-by: Vincent Petry <[email protected]>
  • Loading branch information
PVince81 authored and backportbot[bot] committed Mar 23, 2021
commit 36353b89c4d1f164ac23a2691764377b5f0138b3
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function __construct($baseDir) {
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;
Expand Down
17 changes: 17 additions & 0 deletions lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class Updater {
private $updateAvailable = false;
/** @var string */
private $requestID = null;
/** @var bool */
private $disabled = false;

/**
* Updater constructor
Expand All @@ -58,6 +60,12 @@ public function __construct($baseDir) {
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.');
Expand Down Expand Up @@ -93,6 +101,15 @@ public function __construct($baseDir) {
$this->buildTime = $buildTime;
}

/**
* 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.
*
Expand Down