N°9454 - Make MTT compatible with the dry run (#931)

* N°9454 - Make MTT compatible with the dry run

* N°9454 - Make MTT compatible with the dry run

* N°9454 - Cleaning up configuration handling

* N°9454 - Cleanup code

* N°9454 - Remove writable directories

* Update setup/wizardsteps/WizStepLandingBeforeAudit.php

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Update setup/runtimeenv.class.inc.php

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* N°9454 - Secure target environment wizard step done form submission

---------

Co-authored-by: Eric Espie <eric.espie@combodo.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
Lenaick
2026-06-09 14:29:06 +02:00
committed by GitHub
parent a419914236
commit 1a57a427c0
13 changed files with 94 additions and 83 deletions

View File

@@ -527,11 +527,15 @@ class SetupUtils
*
* @since 3.0.0 N°2214 replace SetupLog::Log calls by CheckResult::TRACE
*/
public static function CheckBackupPrerequisites($sDBBackupPath, $sMySQLBinDir = null)
public static function CheckBackupPrerequisites($sDBBackupPath, $sMySQLBinDir = null, string $sEnvironment = ITOP_DEFAULT_ENV)
{
$aResult = [];
$aResult[] = new CheckResult(CheckResult::TRACE, 'Info - CheckBackupPrerequisites');
if ($sEnvironment !== ITOP_DEFAULT_ENV) {
$aResult[] = new CheckResult(CheckResult::ERROR, "Can only backup ".ITOP_DEFAULT_ENV." environment");
}
// zip extension
//
if (!extension_loaded('phar')) {
@@ -1592,13 +1596,13 @@ JS
if (is_dir($oWizard->GetParameter('copy_extensions_from'))) {
$aDirsToScan[] = $oWizard->GetParameter('copy_extensions_from');
}
$sExtraDir = utils::GetDataPath().'production-modules/';
$sExtraDir = utils::GetDataPath().$oWizard->GetParameter('target_env', ITOP_DEFAULT_ENV).'-modules/';
if (is_dir($sExtraDir)) {
$aDirsToScan[] = $sExtraDir;
}
$oProductionEnv = new RunTimeEnvironment();
$oProductionEnv = new RunTimeEnvironment($oWizard->GetParameter('target_env', ITOP_DEFAULT_ENV));
$aRemovedExtensionCodes = json_decode($oWizard->GetParameter('removed_extensions'), true) ?? [];
$oExtensionsMap = new iTopExtensionsMap(ITOP_DEFAULT_ENV, $aDirsToScan);
$oExtensionsMap = new iTopExtensionsMap($oWizard->GetParameter('target_env', ITOP_DEFAULT_ENV), $aDirsToScan);
$oExtensionsMap->DeclareExtensionAsRemoved($aRemovedExtensionCodes);
$aAvailableModules = $oProductionEnv->AnalyzeInstallation($oConfig, $aDirsToScan, $bAbortOnMissingDependency, $aModulesToLoad);
@@ -1615,9 +1619,12 @@ JS
}
/**
* Get version of production application
*
* @param WizardController $oWizard
*
* @return array|bool
* @throws \CoreException
*/
public static function GetApplicationVersion($oWizard)
{