N°2240 - Supportability - Maintenance mode

This commit is contained in:
Eric
2019-07-11 10:22:39 +02:00
parent 7f82faefe1
commit a6737afb2f
9 changed files with 119 additions and 7 deletions

View File

@@ -310,6 +310,12 @@ function CronExec($oP, $aProcesses, $bVerbose)
$oP->p("Sleeping");
}
sleep($iCronSleep);
// Maintenance mode
if (file_exists(APPROOT.'.maintenance'))
{
$oP->p("Maintenance mode detected");
return;
}
}
if ($bVerbose)
{
@@ -565,10 +571,11 @@ try
{
// Note: testing this now in case some of the background processes forces the read-only mode for a while
// in that case it is better to exit with the check on reentrance (mutex)
if (!MetaModel::DBHasAccess(ACCESS_ADMIN_WRITE))
if (!MetaModel::DBHasAccess(ACCESS_ADMIN_WRITE) || file_exists(APPROOT.'.maintenance'))
{
$oP->p("A database maintenance is ongoing (read-only mode even for admins).");
$oP->p("A maintenance is ongoing");
$oP->Output();
$oMutex->Unlock();
exit(EXIT_CODE_ERROR);
}
@@ -609,4 +616,3 @@ finally
$oP->p("Exiting: ".time().' ('.date('Y-m-d H:i:s').')');
$oP->Output();
?>