diff --git a/datamodels/2.x/itop-core-update/en.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/en.dict.itop-core-update.php index ea7b476ed..9ade914f1 100644 --- a/datamodels/2.x/itop-core-update/en.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/en.dict.itop-core-update.php @@ -35,6 +35,7 @@ Dict::Add('EN US', 'English', 'English', array( 'iTopUpdate:UI:Back' => 'Back', 'iTopUpdate:UI:Cancel' => 'Cancel', 'iTopUpdate:UI:Continue' => 'Continue', + 'iTopUpdate:UI:RunSetup' => 'Run Setup', 'iTopUpdate:UI:WithDBBackup' => 'Database backup', 'iTopUpdate:UI:WithFilesBackup' => 'Application files backup', 'iTopUpdate:UI:WithoutBackup' => 'No backup is planned', diff --git a/datamodels/2.x/itop-core-update/fr.dict.itop-core-update.php b/datamodels/2.x/itop-core-update/fr.dict.itop-core-update.php index 34f187d20..632c05bbe 100644 --- a/datamodels/2.x/itop-core-update/fr.dict.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/fr.dict.itop-core-update.php @@ -35,7 +35,8 @@ Dict::Add('FR FR', 'French', 'Français', array( 'iTopUpdate:UI:Back' => 'Annuler', 'iTopUpdate:UI:Cancel' => 'Annuler', 'iTopUpdate:UI:Continue' => 'Continuer', - 'iTopUpdate:UI:WithDBBackup' => 'Sauvegarde de la base de données', + 'iTopUpdate:UI:RunSetup' => 'Lancer le Setup', + 'iTopUpdate:UI:WithDBBackup' => 'Sauvegarde de la base de données', 'iTopUpdate:UI:WithFilesBackup' => 'Archive des fichiers de l\'application', 'iTopUpdate:UI:WithoutBackup' => 'Pas de sauvegarde', 'iTopUpdate:UI:Backup' => 'Sauvegarde effectuée avant la mise à jour', diff --git a/datamodels/2.x/itop-core-update/src/Controller/AjaxController.php b/datamodels/2.x/itop-core-update/src/Controller/AjaxController.php index 0214781a5..736947708 100644 --- a/datamodels/2.x/itop-core-update/src/Controller/AjaxController.php +++ b/datamodels/2.x/itop-core-update/src/Controller/AjaxController.php @@ -79,6 +79,7 @@ class AjaxController extends Controller $aParams = array(); try { + SetupUtils::CheckSetupToken(); SetupUtils::EnterReadOnlyMode(MetaModel::GetConfig()); $iResponseCode = 200; } catch (Exception $e) @@ -95,6 +96,7 @@ class AjaxController extends Controller $aParams = array(); try { + SetupUtils::CheckSetupToken(true); SetupUtils::ExitReadOnlyMode(); $iResponseCode = 200; } catch (Exception $e) @@ -111,6 +113,7 @@ class AjaxController extends Controller $aParams = array(); try { + SetupUtils::CheckSetupToken(); CoreUpdater::Backup(); $iResponseCode = 200; } catch (Exception $e) @@ -127,6 +130,7 @@ class AjaxController extends Controller $aParams = array(); try { + SetupUtils::CheckSetupToken(); CoreUpdater::CreateItopArchive(); $iResponseCode = 200; } catch (Exception $e) @@ -143,6 +147,7 @@ class AjaxController extends Controller $aParams = array(); try { + SetupUtils::CheckSetupToken(); CoreUpdater::CopyCoreFiles(); $iResponseCode = 200; } catch (Exception $e) @@ -160,6 +165,7 @@ class AjaxController extends Controller $aParams = array(); try { + SetupUtils::CheckSetupToken(); CoreUpdater::CheckCompile(); $iResponseCode = 200; } @@ -178,6 +184,7 @@ class AjaxController extends Controller $aParams = array(); try { + SetupUtils::CheckSetupToken(); CoreUpdater::Compile(); $iResponseCode = 200; } @@ -196,6 +203,7 @@ class AjaxController extends Controller $aParams = array(); try { + SetupUtils::CheckSetupToken(); CoreUpdater::UpdateDatabase(); $iResponseCode = 200; } diff --git a/datamodels/2.x/itop-core-update/src/Controller/UpdateController.php b/datamodels/2.x/itop-core-update/src/Controller/UpdateController.php index 3a9afda00..f276f5264 100644 --- a/datamodels/2.x/itop-core-update/src/Controller/UpdateController.php +++ b/datamodels/2.x/itop-core-update/src/Controller/UpdateController.php @@ -140,6 +140,15 @@ class UpdateController extends Controller $this->DisplayPage($aParams); } + public function OperationRunSetup() + { + SetupUtils::CheckSetupToken(true); + $sConfigFile = APPCONF.'production/'.ITOP_CONFIG_FILE; + @chmod($sConfigFile, 0770); + $sRedirectURL = utils::GetAbsoluteUrlAppRoot().'setup/index.php'; + header("Location: $sRedirectURL"); + } + private function GetPreviousInstallations() { return DBToolsUtils::GetPreviousInstallations(); diff --git a/datamodels/2.x/itop-core-update/view/UpdateCoreFiles.html.twig b/datamodels/2.x/itop-core-update/view/UpdateCoreFiles.html.twig index 22eb60479..d43634aff 100644 --- a/datamodels/2.x/itop-core-update/view/UpdateCoreFiles.html.twig +++ b/datamodels/2.x/itop-core-update/view/UpdateCoreFiles.html.twig @@ -78,6 +78,11 @@ {{ 'iTopUpdate:UI:RestoreBackup'|dict_format(sBackupFile) }} {% endif %} +