Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Also include *.config.php files" #540

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
31 changes: 6 additions & 25 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,36 +79,17 @@ public function __construct(string $baseDir) {
$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
Expand Down
31 changes: 6 additions & 25 deletions lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,36 +41,17 @@ public function __construct(string $baseDir) {
$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
Expand Down
Binary file modified updater.phar
Binary file not shown.
Loading