mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 01:58:47 +02:00
N°2240 - Supportability - Maintenance mode
This commit is contained in:
@@ -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();
|
||||
?>
|
||||
Reference in New Issue
Block a user