Introduce ConfigFileManager for config files

This commit is contained in:
Philipp 2023-01-01 21:10:37 +01:00
parent fea4b202c1
commit 0f91d1cbde
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
21 changed files with 343 additions and 302 deletions

View file

@ -100,16 +100,18 @@ HELP;
$enabled = intval($this->getArgument(0));
$this->config->set('system', 'maintenance', $enabled);
$this->config->set('system', 'maintenance', $enabled, false);
$reason = $this->getArgument(1);
if ($enabled && $this->getArgument(1)) {
$this->config->set('system', 'maintenance_reason', $this->getArgument(1));
$this->config->set('system', 'maintenance_reason', $this->getArgument(1), false);
} else {
$this->config->set('system', 'maintenance_reason', '');
$this->config->set('system', 'maintenance_reason', '', false);
}
$this->config->save();
if ($enabled) {
$mode_str = "maintenance mode";
} else {

View file

@ -101,8 +101,8 @@ HELP;
$old_host = str_replace('http://', '@', Strings::normaliseLink($old_url));
$this->out('Entering maintenance mode');
$this->config->set('system', 'maintenance', true);
$this->config->set('system', 'maintenance_reason', 'Relocating node to ' . $new_url);
$this->config->set('system', 'maintenance', true, false);
$this->config->set('system', 'maintenance_reason', 'Relocating node to ' . $new_url, false);
try {
if (!$this->database->transaction()) {
@ -189,8 +189,9 @@ HELP;
return 1;
} finally {
$this->out('Leaving maintenance mode');
$this->config->set('system', 'maintenance', false);
$this->config->set('system', 'maintenance_reason', '');
$this->config->set('system', 'maintenance', false, false);
$this->config->set('system', 'maintenance_reason', '', false);
$this->config->save();
}
// send relocate