Merge pull request #540 from nextcloud/revert-535-master

Revert "Also include *.config.php files"
This commit is contained in:
Côme Chilliet 2024-03-18 09:49:14 +01:00 committed by GitHub
commit 072003a652
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 50 deletions

View File

@ -79,36 +79,17 @@ class Updater {
$this->baseDir = $baseDir;
if ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) {
$configDir = rtrim($dir, '/');
$configFileName = rtrim($dir, '/') . '/config.php';
} else {
$configDir = $this->baseDir . '/../config';
$configFileName = $this->baseDir . '/../config/config.php';
}
$configFiles = [$configDir . '/config.php'];
if (!file_exists($configFiles[0])) {
if (!file_exists($configFileName)) {
throw new \Exception('Could not find config.php. Is this file in the "updater" subfolder of Nextcloud?');
}
$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);
}
/** @var array $CONFIG */
require_once $configFileName;
$this->configValues = $CONFIG;
if (php_sapi_name() !== 'cli' && ($this->configValues['upgrade.disable-web'] ?? false)) {
// updater disabled

View File

@ -41,36 +41,17 @@ class Updater {
$this->baseDir = $baseDir;
if ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) {
$configDir = rtrim($dir, '/');
$configFileName = rtrim($dir, '/') . '/config.php';
} else {
$configDir = $this->baseDir . '/../config';
$configFileName = $this->baseDir . '/../config/config.php';
}
$configFiles = [$configDir . '/config.php'];
if (!file_exists($configFiles[0])) {
if (!file_exists($configFileName)) {
throw new \Exception('Could not find config.php. Is this file in the "updater" subfolder of Nextcloud?');
}
$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);
}
/** @var array $CONFIG */
require_once $configFileName;
$this->configValues = $CONFIG;
if (php_sapi_name() !== 'cli' && ($this->configValues['upgrade.disable-web'] ?? false)) {
// updater disabled

Binary file not shown.