From 56f025217552f0bdcdf78aa30e2d9759ae73e8b5 Mon Sep 17 00:00:00 2001 From: Volmarg Date: Thu, 15 Jul 2021 18:41:13 +0200 Subject: [PATCH] Add GUI installer base logic, rework autoinstaller cli to use gui prepared logic --- composer.json | 7 +- config/packages/mailer.yaml | 3 + installer/Action/InstallerAction.php | 12 +- installer/AutoInstaller.php | 499 +++++++++++++++ installer/Controller/InstallerController.php | 253 ++++++-- installer/DTO/DatabaseDataDTO.php | 148 +++++ .../Services/CliHandlerService.php | 12 +- installer/Services/EnvBuilder.php | 127 ++++ installer/Services/InstallerLogger.php | 10 + installer/Services/ShellAbstractService.php | 24 +- installer/Services/ShellBinConsoleService.php | 141 ++++- installer/Services/ShellComposerService.php | 44 +- installer/Services/ShellMysqlService.php | 8 +- installer/Services/ShellPhpService.php | 7 +- public/installer.php | 20 +- src/AutoInstaller.php | 594 ------------------ .../Files/Parser/YamlFileParserService.php | 28 +- .../step-configuration-execution.vue | 48 ++ .../installer/components/step-database.vue | 24 +- .../components/step-envorionment-check.vue | 10 +- .../vue/components/installer/installer.vue | 38 +- symfony.lock | 21 + 22 files changed, 1363 insertions(+), 715 deletions(-) create mode 100644 config/packages/mailer.yaml create mode 100644 installer/AutoInstaller.php create mode 100644 installer/DTO/DatabaseDataDTO.php rename src/Controller/Utils/CliHandler.php => installer/Services/CliHandlerService.php (96%) mode change 100755 => 100644 create mode 100644 installer/Services/EnvBuilder.php create mode 100644 installer/Services/InstallerLogger.php delete mode 100755 src/AutoInstaller.php diff --git a/composer.json b/composer.json index 2a57572a..e48ecb6f 100755 --- a/composer.json +++ b/composer.json @@ -79,7 +79,8 @@ }, "autoload": { "psr-4": { - "App\\": "src/" + "App\\": "src/", + "Installer\\": "installer/" } }, "autoload-dev": { @@ -103,8 +104,8 @@ "post-update-cmd": [ "SlowProg\\CopyFile\\ScriptHandler::copy" ], - "pms-installer": "php -r \"include_once 'src//AutoInstaller.php'; use App\\AutoInstaller; AutoInstaller::run();\" < /dev/tty", - "pms-installer-docker": "php -r \"include_once 'src//AutoInstaller.php'; use App\\AutoInstaller; AutoInstaller::runDocker();\" < /dev/tty", + "pms-installer": "php -r \"include_once 'installer//AutoInstaller.php'; use Installer\\AutoInstaller; AutoInstaller::run();\" < /dev/tty", + "pms-installer-docker": "php -r \"include_once 'installer//AutoInstaller.php'; use Installer\\AutoInstaller; AutoInstaller::runDocker();\" < /dev/tty", "pms-frontend-validate-circular-reference": "./node_modules/.bin/madge ./src/assets/scripts --webpack-config ./webpack.config.js --ts-config ./tsconfig.json --circular --extensions ts,js", "pms-frontend-generate-production-css-js-assets": "./node_modules/.bin/encore production", "pms-rebuild-backend": "php7.4 bin/console assets:build-translation-messages-yaml; chmod 777 translations -R; sudo -u www-data php7.4 bin/console cache:clear; sudo -u www-data php7.4 bin/console cache:warmup;" diff --git a/config/packages/mailer.yaml b/config/packages/mailer.yaml new file mode 100644 index 00000000..56a650d8 --- /dev/null +++ b/config/packages/mailer.yaml @@ -0,0 +1,3 @@ +framework: + mailer: + dsn: '%env(MAILER_DSN)%' diff --git a/installer/Action/InstallerAction.php b/installer/Action/InstallerAction.php index 6204f8c3..9a8184ed 100644 --- a/installer/Action/InstallerAction.php +++ b/installer/Action/InstallerAction.php @@ -1,8 +1,8 @@ $requirementsCheckResult, + self::KEY_RESULT_CHECK_DATA => $configurationAndPreparationResult, self::KEY_SUCCESS => $isSuccess, ]); } diff --git a/installer/AutoInstaller.php b/installer/AutoInstaller.php new file mode 100644 index 00000000..b6e0428f --- /dev/null +++ b/installer/AutoInstaller.php @@ -0,0 +1,499 @@ + $isProperPhpVersionInstalled, - self::PRODUCTION_REQUIREMENT_MYSQL => $isMysqlInstalled, - self::PRODUCTION_REQUIREMENT_COMPOSER => $isComposerInstalled, + self::PRODUCTION_REQUIREMENT_PHP => $isProperPhpVersionInstalled, + self::PRODUCTION_REQUIREMENT_MYSQL => $isMysqlInstalled, ]; if($isMysqlInstalled){ - $requestJson = file_get_contents("php://input"); - $requestData = json_decode($requestJson, true); + $requestJson = file_get_contents("php://input"); + $databaseDataDto = DatabaseDataDTO::fromJson($requestJson); - $databaseLogin = $requestData[self::PARAM_DB_LOGIN]; - $databasePassword = $requestData[self::PARAM_DB_PASSWORD]; - $databasePort = $requestData[self::PARAM_DB_PORT]; - $databaseHost = $requestData[self::PARAM_DB_HOST]; - - $isDbPasswordValid = ShellMysqlService::isDbAccessValid($databaseLogin, $databaseHost, $databasePort, $databasePassword); + $isDbPasswordValid = ShellMysqlService::isDbAccessValid( + $databaseDataDto->getDatabaseLogin(), + $databaseDataDto->getDatabaseHost(), + $databaseDataDto->getDatabasePort(), + $databaseDataDto->getDatabasePassword() + ); $returnedData[self::PRODUCTION_REQUIREMENT_MYSQL_ACCESS_VALID] = $isDbPasswordValid; if($isDbPasswordValid){ - $isOnlyFullGroupByMysqlModeSet = ShellMysqlService::isOnlyFullGroupByMysqlModeDisabled($databaseLogin, $databaseHost, $databasePort, $databasePassword); + $isOnlyFullGroupByMysqlModeSet = ShellMysqlService::isOnlyFullGroupByMysqlModeDisabled( + $databaseDataDto->getDatabaseLogin(), + $databaseDataDto->getDatabaseHost(), + $databaseDataDto->getDatabasePort(), + $databaseDataDto->getDatabasePassword() + ); $returnedData[self::PRODUCTION_REQUIREMENT_MYSQL_MODE_DISABLED] = $isOnlyFullGroupByMysqlModeSet; } @@ -85,15 +97,182 @@ public static function checkProductionBasedRequirements(): array * Will execute configuration / system preparation logic * * @return array + * @throws Exception */ public static function configureAndPrepareSystem(): array { + $resultData = []; + $requestJson = file_get_contents("php://input"); + $databaseDataDto = DatabaseDataDTO::fromJson($requestJson); + + $isComposerInstallSuccess = ShellComposerService::installPackages(); + $resultData[self::CONFIGURE_PREPARE_COMPOSER_PACKAGES] = $isComposerInstallSuccess; + if(!$isComposerInstallSuccess){ + return $resultData; + } + + $createEnvCallback = function() use($databaseDataDto): bool { + $isEnvFileCreated = EnvBuilder::buildEnv( + $databaseDataDto->getDatabaseLogin(), + $databaseDataDto->getDatabasePassword(), + $databaseDataDto->getDatabaseHost(), + $databaseDataDto->getDatabasePort(), + $databaseDataDto->getDatabaseName() + ); + + return $isEnvFileCreated; + }; + + $isEnvFileCreated = self::executeCallbackWithSupportOfDirectoryChange($createEnvCallback); + $resultData[self::CONFIGURE_PREPARE_ENV_FILE] = $isEnvFileCreated; + if(!$isEnvFileCreated){ + return $resultData; + } + + $areFoldersCreated = self::createFolders(); + $resultData[self::CONFIGURE_PREPARE_CREATE_FOLDERS] = $areFoldersCreated; + if(!$areFoldersCreated){ + return $resultData; + } + + $isDatabaseDroppedIfExists = ShellBinConsoleService::dropDatabase(); + $resultData[self::CONFIGURE_PREPARE_DROP_DATABASE_IF_EXISTS] = $isDatabaseDroppedIfExists; + if(!$isDatabaseDroppedIfExists){ + return $resultData; + } + + $isDatabaseCreated = ShellBinConsoleService::createDatabase(); + $resultData[self::CONFIGURE_PREPARE_CREATE_DATABASE] = $isDatabaseCreated; + if(!$isDatabaseCreated){ + return $resultData; + } + + $isDatabaseStructureBuilt = ShellBinConsoleService::executeMigrations(); + $resultData[self::CONFIGURE_PREPARE_BUILD_DATABASE_STRUCTURE] = $isDatabaseStructureBuilt; + if(!$isDatabaseStructureBuilt){ + return $resultData; + } - return []; + $isCacheCleared = ShellBinConsoleService::clearCache(); + $resultData[self::CONFIGURE_PREPARE_CLEAR_CACHE] = $isCacheCleared; + if(!$isCacheCleared){ + return $resultData; + } + + $isCacheBuilt = ShellBinConsoleService::buildCache(); + $resultData[self::CONFIGURE_PREPARE_BUILD_CACHE] = $isCacheBuilt; + if(!$isCacheBuilt){ + return $resultData; + } + + $generatedEncryptionKey = ShellBinConsoleService::generateEncryptionKey(); + $resultData[self::CONFIGURE_PREPARE_GENERATE_ENCRYPTION_KEY] = !empty($generatedEncryptionKey); + if( empty($generatedEncryptionKey) ){ + return $resultData; + } + + $isEncryptionKeySaved = self::setEncryptionKey($generatedEncryptionKey); + $resultData[self::CONFIGURE_PREPARE_SAVE_ENCRYPTION_KEY] = $isEncryptionKeySaved; + + return $resultData; } - public static function buildEnvFile(){ + /** + * Will attempt to create folders, send created/existing folders array + * + * @return bool + */ + public static function createFolders(): bool + { + $callback = function(): bool { + + $uploadDir = EnvBuilder::PUBLIC_DIR . DIRECTORY_SEPARATOR . EnvBuilder::UPLOAD_DIR; + $uploadFilesDir = EnvBuilder::PUBLIC_DIR . DIRECTORY_SEPARATOR . EnvBuilder::UPLOAD_DIR_FILES; + $uploadImagesDir = EnvBuilder::PUBLIC_DIR . DIRECTORY_SEPARATOR . EnvBuilder::UPLOAD_DIR_IMAGES; + $uploadVideosDir = EnvBuilder::PUBLIC_DIR . DIRECTORY_SEPARATOR . EnvBuilder::UPLOAD_DIR_VIDEOS; + + try{ + if( !file_exists($uploadDir) ){ + mkdir($uploadDir); + } + if( !file_exists($uploadFilesDir) ){ + mkdir($uploadFilesDir); + } + if( !file_exists($uploadImagesDir) ){ + mkdir($uploadImagesDir); + } + if( !file_exists($uploadVideosDir) ){ + mkdir($uploadVideosDir); + } + if( !file_exists(self::FOLDER_VAR_CACHE) ){ + mkdir(self::FOLDER_VAR_CACHE, 0777, true); + } + return true; + }catch(Exception | TypeError $e){ + return false; + } + + }; + + $callbackResult = self::executeCallbackWithSupportOfDirectoryChange($callback); + return $callbackResult; + } + + /** + * Will save the encryption key to file + * + * @param string $encryptionKey + * @return bool + */ + public static function setEncryptionKey(string $encryptionKey): bool + { + $callback = function() use($encryptionKey): bool { + /** + * Must be here because with the command the dir changes to root dir of project + * The inclusion belongs explicitly to the callback + */ + include_once("vendor/autoload.php"); + + $isEncryptionKeySaved = YamlFileParserService::replaceArrayNodeValue(self::CONFIG_ENCRYPTION_KEY_ENCRYPT_KEY, $encryptionKey, self::CONFIG_ENCRYPTION_YAML_PATH); + return $isEncryptionKeySaved; + }; + + $isEncryptionKeySaved = self::executeCallbackWithSupportOfDirectoryChange($callback); + return $isEncryptionKeySaved; + } + + /** + * Some logic requires to go to root project dir, + * but then it's needed to go back to work properly with all the `includes` etc + * + * So this method will go to project root dir, execute callback and comes back in dir structure, + * + * @param callable $callback + * @return mixed + */ + public static function executeCallbackWithSupportOfDirectoryChange(callable $callback) + { + /** + * For cli just execute the code + */ + if( "cli" === php_sapi_name() ){ + $callbackResult = $callback(); + return $callbackResult; + } + + /** + * For GUI based logic dir must be changed before executing code + */ + $previousDirectory = getcwd(); + $rootDirectory = $previousDirectory . "/../"; + + chdir($rootDirectory); + { + $callbackResult = $callback(); + } + chdir($previousDirectory); + return $callbackResult; } } \ No newline at end of file diff --git a/installer/DTO/DatabaseDataDTO.php b/installer/DTO/DatabaseDataDTO.php new file mode 100644 index 00000000..f3992469 --- /dev/null +++ b/installer/DTO/DatabaseDataDTO.php @@ -0,0 +1,148 @@ +databaseLogin; + } + + /** + * @param string $databaseLogin + */ + public function setDatabaseLogin(string $databaseLogin): void + { + $this->databaseLogin = $databaseLogin; + } + + /** + * @return string + */ + public function getDatabasePassword(): string + { + return $this->databasePassword; + } + + /** + * @param string $databasePassword + */ + public function setDatabasePassword(string $databasePassword): void + { + $this->databasePassword = $databasePassword; + } + + /** + * @return string + */ + public function getDatabasePort(): string + { + return $this->databasePort; + } + + /** + * @param string $databasePort + */ + public function setDatabasePort(string $databasePort): void + { + $this->databasePort = $databasePort; + } + + /** + * @return string + */ + public function getDatabaseHost(): string + { + return $this->databaseHost; + } + + /** + * @param string $databaseHost + */ + public function setDatabaseHost(string $databaseHost): void + { + $this->databaseHost = $databaseHost; + } + + /** + * @return string + */ + public function getDatabaseName(): string + { + return $this->databaseName; + } + + /** + * @param string $databaseName + */ + public function setDatabaseName(string $databaseName): void + { + $this->databaseName = $databaseName; + } + + /** + * Build dto from json data + * + * @param string $json + * @return DatabaseDataDTO + */ + public static function fromJson(string $json): DatabaseDataDTO + { + $requestData = json_decode($json, true); + + $databaseLogin = $requestData[self::PARAM_DB_LOGIN] ?? ""; + $databasePassword = $requestData[self::PARAM_DB_PASSWORD] ?? ""; + $databasePort = $requestData[self::PARAM_DB_PORT] ?? ""; + $databaseHost = $requestData[self::PARAM_DB_HOST] ?? ""; + $databaseName = $requestData[self::PARAM_DB_NAME] ?? ""; + + $dto = new DatabaseDataDTO(); + $dto->setDatabaseLogin($databaseLogin); + $dto->setDatabasePassword($databasePassword); + $dto->setDatabasePort($databasePort); + $dto->setDatabaseHost($databaseHost); + $dto->setDatabaseName($databaseName); + + return $dto; + } +} \ No newline at end of file diff --git a/src/Controller/Utils/CliHandler.php b/installer/Services/CliHandlerService.php old mode 100755 new mode 100644 similarity index 96% rename from src/Controller/Utils/CliHandler.php rename to installer/Services/CliHandlerService.php index 86a5d2f0..8b7c3d4c --- a/src/Controller/Utils/CliHandler.php +++ b/installer/Services/CliHandlerService.php @@ -1,6 +1,6 @@ &1", $outputLines, $outputCode); + return [ + self::KEY_EXECUTED_COMMAND => $calledCommand, + self::KEY_OUTPUT_RESULT => $outputLines, + self::KEY_OUTPUT_CODE => $outputCode, + self::KEY_OUTPUT_SUCCESS => ($outputCode == self::EXEC_CODE_SUCCESS), + ]; + } + /** * While this should not happen at all there were already cases with linux instances stripped so badly that * for example sudo was not present diff --git a/installer/Services/ShellBinConsoleService.php b/installer/Services/ShellBinConsoleService.php index 273f8e99..4db1793a 100644 --- a/installer/Services/ShellBinConsoleService.php +++ b/installer/Services/ShellBinConsoleService.php @@ -1,8 +1,17 @@ (.*))#"; + const REGEX_MATCH_KEY = "KEY"; + + const DOCTRINE_DROP_DATABASE_SUCCESS_MESSAGES = [ + self::DOCTRINE_MESSAGE_DATABASE_DOES_NOT_EXIST, + self::DOCTRINE_MESSAGE_DROPPED_DATABASE, + ]; + public static function getExecutableBinaryName(): string { return self::EXECUTABLE_BINARY_NAME; @@ -23,45 +43,128 @@ public static function getExecutableBinaryName(): string * Will drop database * * @return bool success or false + * @throws Exception */ public static function dropDatabase(): bool { - $binaryName = self::getExecutableBinaryName(); - $executedCommand = $binaryName . " doctrine:database:drop -n --force"; - $result = self::executeShellCommand($executedCommand); - // todo: check if result is success - strstr + grep + $callback = function(){ + $phpBinaryExecutable = ShellPhpService::getExecutableBinaryName(); + $binaryName = self::getExecutableBinaryName(); - return self::EXECUTABLE_BINARY_NAME; + $executedCommand = $phpBinaryExecutable . " " . $binaryName . " doctrine:database:drop -n --force"; + $result = self::executeShellCommandWithFullOutputLinesAndCodeAsArray($executedCommand); + + $outputLines = $result[self::KEY_OUTPUT_RESULT]; + foreach($outputLines as $outputLine){ + foreach(self::DOCTRINE_DROP_DATABASE_SUCCESS_MESSAGES as $successMessage){ + if( stristr($outputLine, $successMessage) ){ + return true; + } + } + } + + return false; + }; + + $callbackResult = InstallerController::executeCallbackWithSupportOfDirectoryChange($callback); + return $callbackResult; } /** * Will create database * * @return bool success or false + * @throws Exception */ public static function createDatabase(): bool { - $binaryName = self::getExecutableBinaryName(); - $executedCommand = $binaryName . " doctrine:database:create -n"; - $result = self::executeShellCommand($executedCommand); - // todo: check if result is success - strstr + grep - - return self::EXECUTABLE_BINARY_NAME; + $callbackResult = self::executeCommandAndCheckResultCode("doctrine:database:create"); + return $callbackResult; } /** - * Will create database + * Will handle migrations * * @return bool success or false + * @throws Exception */ public static function executeMigrations(): bool { - $binaryName = self::getExecutableBinaryName(); - $executedCommand = $binaryName . " doctrine:migrations:migrate -n"; - $result = self::executeShellCommand($executedCommand); - // todo: check if result is success - strstr + grep + $callbackResult = self::executeCommandAndCheckResultCode("doctrine:migrations:migrate"); + return $callbackResult; + } - return self::EXECUTABLE_BINARY_NAME; + /** + * Will clear cache + * + * @return bool success or false + * @throws Exception + */ + public static function clearCache(): bool + { + $callbackResult = self::executeCommandAndCheckResultCode("cache:clear"); + return $callbackResult; } + /** + * Will build cache + * + * @return bool success or false + * @throws Exception + */ + public static function buildCache(): bool + { + $callbackResult = self::executeCommandAndCheckResultCode("cache:warmup"); + return $callbackResult; + } + + /** + * This function will generate the key used for encrypting passwords + * @throws Exception + */ + public static function generateEncryptionKey(): ?string { + + $callback = function(): ?string { + $phpBinaryExecutable = ShellPhpService::getExecutableBinaryName(); + $binaryName = self::getExecutableBinaryName(); + + $executedCommand = $phpBinaryExecutable . " " . $binaryName . " --env=dev encrypt:genkey -n"; + $result = self::executeShellCommandWithFullOutputLinesAndCodeAsArray($executedCommand); + + $outputLines = $result[self::KEY_OUTPUT_RESULT]; + foreach($outputLines as $outputLine){ + if( preg_match(self::ENCRYPTION_KEY_REGEX, $outputLine, $matches) ){ + return $matches[self::REGEX_MATCH_KEY]; + } + } + + return null; + }; + + $callbackResult = InstallerController::executeCallbackWithSupportOfDirectoryChange($callback); + return $callbackResult; + } + + /** + * Will execute command and check it's output code (0 is success) + * + * @return bool - true for success, else false + * @throws Exception + */ + private static function executeCommandAndCheckResultCode(string $commandToExecute): bool + { + $callback = function() use($commandToExecute): bool { + $phpBinaryExecutable = ShellPhpService::getExecutableBinaryName(); + $binaryName = self::getExecutableBinaryName(); + + $executedCommand = $phpBinaryExecutable . " " . $binaryName . " $commandToExecute -n"; + $result = self::executeShellCommandWithFullOutputLinesAndCodeAsArray($executedCommand); + + $code = $result[self::KEY_OUTPUT_CODE]; + return (0 == $code); + }; + + $callbackResult = InstallerController::executeCallbackWithSupportOfDirectoryChange($callback); + return $callbackResult; + } } \ No newline at end of file diff --git a/installer/Services/ShellComposerService.php b/installer/Services/ShellComposerService.php index 2cec56ed..9f7ff4cb 100644 --- a/installer/Services/ShellComposerService.php +++ b/installer/Services/ShellComposerService.php @@ -1,8 +1,16 @@ /dev/null | grep " . self::MYSQL_MODE_ONLY_FULL_GROUP_BY; $commandResult = shell_exec($commandToExecute); diff --git a/installer/Services/ShellPhpService.php b/installer/Services/ShellPhpService.php index a0c9d874..61868d91 100644 --- a/installer/Services/ShellPhpService.php +++ b/installer/Services/ShellPhpService.php @@ -1,8 +1,11 @@ /dev/null | grep {$modeToDisable}"; - $commandResult = shell_exec($commandToExecute); - - if( empty($commandResult) ){ - echo "Seems like Mysql mode is ok"; - CliHandler::newLine(); - }else{ - CliHandler::errorText("Your database mode is incorrect!"); - CliHandler::errorText("Check problems section at: https://volmarg.github.io/installation/"); - CliHandler::errorText("Fix that later or the project won't run correctly"); - } - - } - CliHandler::infoText("Finished checking Mysql mode."); - } - - /** - * Will define the php executable to be called - */ - private static function definePhpExecutable(): void - { - $php74 = trim(shell_exec("which " . self::PHP_EXECUTABLE_7_4)); - if( !empty($php74) ){ - self::$phpExecutable = self::PHP_EXECUTABLE_7_4; - }else{ - self::$phpExecutable = self::PHP_EXECUTABLE_DEFAULT; - } - } - -} diff --git a/src/Services/Files/Parser/YamlFileParserService.php b/src/Services/Files/Parser/YamlFileParserService.php index f131173f..b80fcaa1 100644 --- a/src/Services/Files/Parser/YamlFileParserService.php +++ b/src/Services/Files/Parser/YamlFileParserService.php @@ -5,6 +5,7 @@ use App\Controller\Utils\ArrayUtils; use Exception; use Symfony\Component\Yaml\Yaml; +use TypeError; /** * Handles parsing the yaml files, @@ -46,21 +47,26 @@ public static function getFileContentAsArray(string $filePath): array * @param string $replacedNode * @param string $newValueOfReplacedNode * @param string $filePath - * @throws Exception + * @return bool */ - public static function replaceArrayNodeValue(string $replacedNode, string $newValueOfReplacedNode, string $filePath): void + public static function replaceArrayNodeValue(string $replacedNode, string $newValueOfReplacedNode, string $filePath): bool { - $fileDataArray = self::getFileContentAsArray($filePath); - $replacedNodeArray = self::buildMultidimensionalArrayStructureForYamlNode($replacedNode, $newValueOfReplacedNode); - if( empty($replacedNodeArray) ){ - $message = "Something is wrong with replaced node! Got node: {$replacedNode}, could not build replacedNodeArray"; - throw new Exception($message); - } + try{ + $fileDataArray = self::getFileContentAsArray($filePath); + $replacedNodeArray = self::buildMultidimensionalArrayStructureForYamlNode($replacedNode, $newValueOfReplacedNode); + if( empty($replacedNodeArray) ){ + $message = "Something is wrong with replaced node! Got node: {$replacedNode}, could not build replacedNodeArray"; + throw new Exception($message); + } - $replacedArray = array_replace_recursive($fileDataArray, $replacedNodeArray); - $fileNewContent = Yaml::dump($replacedArray); + $replacedArray = array_replace_recursive($fileDataArray, $replacedNodeArray); + $fileNewContent = Yaml::dump($replacedArray); - file_put_contents($filePath, $fileNewContent); + file_put_contents($filePath, $fileNewContent); + return true; + }catch(Exception | TypeError $e){ + return false; + } } /** diff --git a/src/assets/vue/components/installer/components/step-configuration-execution.vue b/src/assets/vue/components/installer/components/step-configuration-execution.vue index 39bdcf9e..5472651f 100644 --- a/src/assets/vue/components/installer/components/step-configuration-execution.vue +++ b/src/assets/vue/components/installer/components/step-configuration-execution.vue @@ -1,6 +1,17 @@ @@ -26,7 +31,7 @@ export default { data(){ return { stepName : "Environment check", - nextStepName : "todo", + nextStepName : "Configuration execution", previousStepName : "Database", resultCheckData : {}, urls: { @@ -68,8 +73,6 @@ export default { */ getEnvironmentCheckResultData(){ let dataBag = this.$parent.$refs.stepDatabase.loadStepDataFromSession(); - console.log(dataBag); - axios.post(this.urls.getEnvironmentCheckResultData, dataBag).then( (response) => { let isSuccess = response.data.resultCheckData; this.resultCheckData = response.data.resultCheckData; @@ -82,6 +85,7 @@ export default { watch: { performCheck(newValue){ if(newValue){ + this.resultCheckData = {}; this.getEnvironmentCheckResultData(); } } diff --git a/src/assets/vue/components/installer/installer.vue b/src/assets/vue/components/installer/installer.vue index 77ebb38b..faca737c 100644 --- a/src/assets/vue/components/installer/installer.vue +++ b/src/assets/vue/components/installer/installer.vue @@ -4,7 +4,6 @@

{{ stepName }}


- + +