Skip to content

Commit

Permalink
force disable maintenance mode
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
  • Loading branch information
ArtificialOwl committed Nov 19, 2021
1 parent d3acf2c commit bc169fc
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion lib/Command/PointRestore.php
Expand Up @@ -265,6 +265,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$output->writeln('> Finalization of the restoring process');
$output->writeln('> <info>maintenance mode</info> disabled');
$this->forceDisableMaintenanceMode();
$this->restoreService->finalizeFullRestore();

$this->activityService->newActivity(
Expand Down Expand Up @@ -666,7 +667,7 @@ private function updateConfig(RestoringPoint $point): void {
$this->compareConfigSqlParams($sqlParams, $CONFIG, ISqlDump::DB_PASS);
}

$CONFIG['maintenance'] = false;
$CONFIG[ConfigService::MAINTENANCE] = false;
$this->output->writeln(' > Updating <info>config.php</info>');
$this->output->writeln('');
file_put_contents(
Expand Down Expand Up @@ -957,4 +958,28 @@ private function displayResume(RestoringPoint $point): void {
);
}
}


/**
*
*/
private function forceDisableMaintenanceMode() {
$CONFIG = [];
$cwd = getcwd();
if (is_bool($cwd)) {
return;
}

$configFile = $cwd . '/config/config.php';
include $configFile;

if (empty($CONFIG) || $this->getBool(ConfigService::MAINTENANCE, $CONFIG) === false) {
return;
}

$CONFIG[ConfigService::MAINTENANCE] = false;
file_put_contents(
$configFile, '<?php' . "\n" . '$CONFIG = ' . var_export($CONFIG, true) . ';' . "\n"
);
}
}

0 comments on commit bc169fc

Please sign in to comment.