N°4227 / N°4225 - Enhance SetupUtils interface

This commit is contained in:
Eric Espie
2021-09-06 17:53:46 +02:00
parent 095c975ec6
commit 8e0ae67803
3 changed files with 8 additions and 6 deletions

View File

@@ -133,8 +133,7 @@ class DBRestore extends DBBackup
try {
IssueLog::Info('Backup Restore - LOCK acquired, executing...');
$bReadonlyBefore = SetupUtils::IsInReadOnlyMode();
SetupUtils::EnterReadOnlyMode(MetaModel::GetConfig());
$bReadonlyBefore = SetupUtils::EnterReadOnlyMode(MetaModel::GetConfig());
try {
//safe zone for db backup => cron is stopped/ itop in readonly

View File

@@ -172,8 +172,7 @@ class DBBackup
*/
public function CreateCompressedBackup($sTargetFile, $sSourceConfigFile = null)
{
$bReadonlyBefore = SetupUtils::IsInReadOnlyMode();
SetupUtils::EnterReadOnlyMode(MetaModel::GetConfig());
$bReadonlyBefore = SetupUtils::EnterReadOnlyMode(MetaModel::GetConfig());
try {
//safe zone for db backup => cron is stopped/ itop in readonly
$bIsCmdbSourceInitialized = CMDBSource::GetMysqli() instanceof mysqli;

View File

@@ -1988,11 +1988,13 @@ JS
return APPROOT.'log/setup-queries-'.strftime('%Y-%m-%d_%H_%M').'.sql';
}
public static function EnterMaintenanceMode($oConfig)
public static function EnterMaintenanceMode($oConfig): bool
{
$bPreviousMode = self::IsInMaintenanceMode();
@touch(MAINTENANCE_MODE_FILE);
self::Log("----> Entering maintenance mode");
self::WaitCronTermination($oConfig, "maintenance");
return $bPreviousMode;
}
public static function ExitMaintenanceMode($bLog = true)
@@ -2009,11 +2011,13 @@ JS
return file_exists(MAINTENANCE_MODE_FILE);
}
public static function EnterReadOnlyMode($oConfig)
public static function EnterReadOnlyMode($oConfig): bool
{
$bPreviousMode = self::IsInReadOnlyMode();
@touch(READONLY_MODE_FILE);
self::Log("----> Entering read only mode");
self::WaitCronTermination($oConfig, "read only");
return $bPreviousMode;
}
public static function ExitReadOnlyMode($bLog = true)