From 696df8f31895e9a5c34dc25d861026d77159e7d8 Mon Sep 17 00:00:00 2001 From: Deepak Mishra Date: Fri, 15 Mar 2024 18:12:46 +0530 Subject: [PATCH] ACMS-3622: Fix logic for local settings file. --- src/Robo/Commands/Blt/MigrateToDrsCommand.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/Robo/Commands/Blt/MigrateToDrsCommand.php b/src/Robo/Commands/Blt/MigrateToDrsCommand.php index aa0f78b8f..b7aed1c04 100644 --- a/src/Robo/Commands/Blt/MigrateToDrsCommand.php +++ b/src/Robo/Commands/Blt/MigrateToDrsCommand.php @@ -137,6 +137,10 @@ private function updateSettingsFile(string $settingFile): void { if (str_contains($fileContent, $this->bltConfigOverrideVar)) { $fileContent = str_replace($this->bltConfigOverrideVar, $this->drsConfigOverrideVar, $fileContent); } + // Check if blt use statement exists. + if (str_contains($fileContent, $this->bltUseStmt)) { + $fileContent = str_replace($this->bltUseStmt, $this->drsUseStmt, $fileContent); + } // Let remove BLT require section from settings.php. if (substr_count($fileContent, $this->drsSettingsWarning) < 1) { $fileContent = str_replace($this->bltSettingsWarning, $this->drsSettingsWarning, $fileContent); @@ -148,16 +152,4 @@ private function updateSettingsFile(string $settingFile): void { file_put_contents($settingFile, $fileContent); } - /** - * Update local settings file. - * - * @param string $localSettingsFile - * The local settings file path. - */ - private function updateLocalSettingsFile(string $localSettingsFile): void { - $fileContent = file_get_contents($localSettingsFile); - $updatedFileContent = str_replace($this->bltUseStmt, $this->drsUseStmt, $fileContent); - file_put_contents($localSettingsFile, $updatedFileContent); - } - }