mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 01:58:47 +02:00
N°9327 Do not enter readonly or maintenance mode when doing data audit
This commit is contained in:
@@ -278,7 +278,7 @@ class MFCompiler
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function Compile($sTargetDir, $oP = null, $bUseSymbolicLinks = null, $bSkipTempDir = false)
|
||||
public function Compile($sTargetDir, $oP = null, $bUseSymbolicLinks = null, $bSkipTempDir = false, $bEnterMaintenanceMode = true)
|
||||
{
|
||||
if (is_null($bUseSymbolicLinks)) {
|
||||
$bUseSymbolicLinks = false;
|
||||
@@ -297,8 +297,7 @@ class MFCompiler
|
||||
} else {
|
||||
$oConfig = null;
|
||||
}
|
||||
if (($this->sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode) {
|
||||
|
||||
if (($this->sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode && $bEnterMaintenanceMode) {
|
||||
SetupUtils::EnterMaintenanceMode($oConfig);
|
||||
}
|
||||
if ($bUseSymbolicLinks || $bSkipTempDir) {
|
||||
@@ -321,7 +320,7 @@ class MFCompiler
|
||||
// Cleanup the temporary directory
|
||||
SetupUtils::rrmdir($sTempTargetDir);
|
||||
}
|
||||
if (($this->sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode) {
|
||||
if (($this->sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode && $bEnterMaintenanceMode) {
|
||||
SetupUtils::ExitMaintenanceMode();
|
||||
}
|
||||
throw $e;
|
||||
@@ -331,7 +330,7 @@ class MFCompiler
|
||||
// Move the results to the target directory
|
||||
SetupUtils::movedir($sTempTargetDir, $sFinalTargetDir);
|
||||
}
|
||||
if (($this->sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode) {
|
||||
if (($this->sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode && $bEnterMaintenanceMode) {
|
||||
SetupUtils::ExitMaintenanceMode();
|
||||
}
|
||||
|
||||
|
||||
@@ -429,12 +429,12 @@ class ApplicationInstallSequencer extends StepSequencer
|
||||
*
|
||||
* @since 3.1.0 N°2013 added the aParamValues param
|
||||
*/
|
||||
protected function DoCompile($aRemovedExtensionCodes, $aSelectedModules, $sSourceDir, $sExtensionDir, $bUseSymbolicLinks = null)
|
||||
protected function DoCompile($aRemovedExtensionCodes, $aSelectedModules, $sSourceDir, $sExtensionDir, $bUseSymbolicLinks = null, $bEnterMaintenanceMode = true)
|
||||
{
|
||||
/**
|
||||
* @since 3.2.0 move the ContextTag init at the very beginning of the method
|
||||
* @noinspection PhpUnusedLocalVariableInspection
|
||||
*/
|
||||
* @since 3.2.0 move the ContextTag init at the very beginning of the method
|
||||
* @noinspection PhpUnusedLocalVariableInspection
|
||||
*/
|
||||
$oContextTag = new ContextTag(ContextTag::TAG_SETUP);
|
||||
|
||||
SetupLog::Info("Compiling data model.");
|
||||
@@ -476,7 +476,9 @@ class ApplicationInstallSequencer extends StepSequencer
|
||||
if (is_file($sConfigFilePath)) {
|
||||
$oConfig = new Config($sConfigFilePath);
|
||||
$oConfig->UpdateFromParams($aParamValues);
|
||||
SetupUtils::EnterMaintenanceMode($oConfig);
|
||||
if ($bEnterMaintenanceMode) {
|
||||
SetupUtils::EnterMaintenanceMode($oConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
@@ -531,7 +533,7 @@ class ApplicationInstallSequencer extends StepSequencer
|
||||
}
|
||||
|
||||
$oMFCompiler = new MFCompiler($oFactory, $sEnvironment);
|
||||
$oMFCompiler->Compile($sTargetPath, null, $bUseSymbolicLinks);
|
||||
$oMFCompiler->Compile($sTargetPath, null, $bUseSymbolicLinks, false, $bEnterMaintenanceMode);
|
||||
//$aCompilerLog = $oMFCompiler->GetLog();
|
||||
//SetupLog::Info(implode("\n", $aCompilerLog));
|
||||
SetupLog::Info("Data model successfully compiled to '$sTargetPath'.");
|
||||
@@ -563,7 +565,7 @@ class ApplicationInstallSequencer extends StepSequencer
|
||||
$sIntanceUUID = utils::CreateUUID('filesystem');
|
||||
file_put_contents($sInstanceUUIDFile, $sIntanceUUID);
|
||||
}
|
||||
if (($sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode) {
|
||||
if (($sEnvironment == 'production') && !$bIsAlreadyInMaintenanceMode && $bEnterMaintenanceMode) {
|
||||
SetupUtils::ExitMaintenanceMode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ class DataAuditSequencer extends ApplicationInstallSequencer
|
||||
try {
|
||||
$fStart = microtime(true);
|
||||
SetupLog::Info("##### STEP {$sStep} start");
|
||||
$this->EnterReadOnlyMode();
|
||||
switch ($sStep) {
|
||||
case '':
|
||||
$this->DoLogParameters('data-audit-', 'Data Audit');
|
||||
@@ -83,6 +82,7 @@ class DataAuditSequencer extends ApplicationInstallSequencer
|
||||
$aSelectedModules,
|
||||
$sSourceDir,
|
||||
$sExtensionDir,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
@@ -145,7 +145,6 @@ class DataAuditSequencer extends ApplicationInstallSequencer
|
||||
];
|
||||
|
||||
$this->ReportException($e);
|
||||
$this->ExitReadOnlyMode();
|
||||
} finally {
|
||||
$fDuration = round(microtime(true) - $fStart, 2);
|
||||
SetupLog::Info("##### STEP {$sStep} duration: {$fDuration}s");
|
||||
|
||||
Reference in New Issue
Block a user