N°7244 Fix setup ContextTag init (#609)

This commit is contained in:
Pierre Goiffon
2024-02-14 10:51:52 +01:00
committed by GitHub
parent bec5e250a5
commit 41eb927480
2 changed files with 29 additions and 5 deletions

View File

@@ -685,6 +685,11 @@ class ApplicationInstaller
*/
protected static function DoUpdateDBSchema($aSelectedModules, $sModulesDir, $aParamValues, $sTargetEnvironment = '', $bOldAddon = false, $sAppRootUrl = '')
{
/**
* @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("Update Database Schema for environment '$sTargetEnvironment'.");
$sMode = $aParamValues['mode'];
$sDBPrefix = $aParamValues['db_prefix'];
@@ -703,7 +708,6 @@ class ApplicationInstaller
$oProductionEnv = new RunTimeEnvironment($sTargetEnvironment);
$oProductionEnv->InitDataModel($oConfig, true); // load data model only
$oContextTag = new ContextTag(ContextTag::TAG_SETUP);
// Migrate columns
self::MoveColumns($sDBPrefix);
@@ -886,6 +890,11 @@ class ApplicationInstaller
$bOldAddon
)
{
/**
* @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('After Database Creation');
$sMode = $aParamValues['mode'];
@@ -902,8 +911,7 @@ class ApplicationInstaller
$oProductionEnv = new RunTimeEnvironment($sTargetEnvironment);
$oProductionEnv->InitDataModel($oConfig, true); // load data model and connect to the database
$oContextTag = new ContextTag(ContextTag::TAG_SETUP);
self::$bMetaModelStarted = true; // No need to reload the final MetaModel in case the installer runs synchronously
self::$bMetaModelStarted = true; // No need to reload the final MetaModel in case the installer runs synchronously
// Perform here additional DB setup... profiles, etc...
//
@@ -952,6 +960,12 @@ class ApplicationInstaller
$bSampleData = false
)
{
/**
* @since 3.2.0 move the ContextTag init at the very beginning of the method
* @noinspection PhpUnusedLocalVariableInspection
*/
$oContextTag = new ContextTag(ContextTag::TAG_SETUP);
$oConfig = new Config();
$oConfig->UpdateFromParams($aParamValues, $sModulesDir);
@@ -969,7 +983,6 @@ class ApplicationInstaller
if (!self::$bMetaModelStarted)
{
$oProductionEnv->InitDataModel($oConfig, false); // load data model and connect to the database
$oContextTag = new ContextTag(ContextTag::TAG_SETUP);
self::$bMetaModelStarted = true; // No need to reload the final MetaModel in case the installer runs synchronously
}
@@ -1002,6 +1015,12 @@ class ApplicationInstaller
$sModulesDir, $sPreviousConfigFile, $sTargetEnvironment, $sDataModelVersion, $bOldAddon, $aSelectedModuleCodes,
$aSelectedExtensionCodes, $aParamValues, $sInstallComment = null
) {
/**
* @since 3.2.0 move the ContextTag init at the very beginning of the method
* @noinspection PhpUnusedLocalVariableInspection
*/
$oContextTag = new ContextTag(ContextTag::TAG_SETUP);
$aParamValues['selected_modules'] = implode(',', $aSelectedModuleCodes);
$sMode = $aParamValues['mode'];
@@ -1042,7 +1061,6 @@ class ApplicationInstaller
// Record which modules are installed...
$oProductionEnv = new RunTimeEnvironment($sTargetEnvironment);
$oProductionEnv->InitDataModel($oConfig, true); // load data model and connect to the database
$oContextTag = new ContextTag(ContextTag::TAG_SETUP);
if (!$oProductionEnv->RecordInstallation($oConfig, $sDataModelVersion, $aSelectedModuleCodes, $aSelectedExtensionCodes, $sInstallComment))
{

View File

@@ -285,6 +285,12 @@ on the page's parameters
*/
public function Run()
{
/**
* @since 3.2.0 Add the ContextTag init
* @noinspection PhpUnusedLocalVariableInspection
*/
$oContextTag = new ContextTag(ContextTag::TAG_SETUP);
$sOperation = utils::ReadParam('operation');
$this->aParameters = utils::ReadParam('_params', array(), false, 'raw_data');
$this->aSteps = json_decode(utils::ReadParam('_steps', '[]', false, 'raw_data'), true /* bAssoc */);