Skip to content

Commit

Permalink
Update index.php + updater.phar
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Spanier <[email protected]>
  • Loading branch information
JensSpanier committed Mar 5, 2024
1 parent b1a0a21 commit 9f8110e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,36 @@ public function __construct(string $baseDir) {
$this->baseDir = $baseDir;

if ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) {
$configFileName = rtrim($dir, '/') . '/config.php';
$configDir = rtrim($dir, '/');
} else {
$configFileName = $this->baseDir . '/../config/config.php';
$configDir = $this->baseDir . '/../config';
}
if (!file_exists($configFileName)) {

$configFiles = [$configDir . '/config.php'];

if (!file_exists($configFiles[0])) {
throw new \Exception('Could not find config.php. Is this file in the "updater" subfolder of Nextcloud?');
}

/** @var array $CONFIG */
require_once $configFileName;
$this->configValues = $CONFIG;
$extraConfigFiles = glob($configDir . '/*.config.php');
if (is_array($extraConfigFiles)) {
natsort($extraConfigFiles);
$configFiles = array_merge($configFiles, $extraConfigFiles);
}

foreach ($configFiles as $configFile) {
/**
* @psalm-suppress UnresolvableInclude
* @var mixed $CONFIG
*/
require_once $configFile;

if (isset($CONFIG) && is_array($CONFIG)) {
$this->configValues = array_merge($this->configValues, $CONFIG);
}

unset($CONFIG);
}

if (php_sapi_name() !== 'cli' && ($this->configValues['upgrade.disable-web'] ?? false)) {
// updater disabled
Expand Down
Binary file modified updater.phar
Binary file not shown.

0 comments on commit 9f8110e

Please sign in to comment.