diff --git a/.env.dist b/.env.dist index 8358c67d23..5be499e985 100644 --- a/.env.dist +++ b/.env.dist @@ -36,6 +36,7 @@ APP_ENCRYPT_METHOD={{APP_ENCRYPT_METHOD}} APP_LOCALE=en ## Example: '/chamilo2' + APP_URL_APPEND="{{APP_URL_APPEND}}" APP_MULTIPLE_ACCESS_URL="" diff --git a/main/install/install.lib.php b/main/install/install.lib.php index 18ee581627..f5f428dbe3 100755 --- a/main/install/install.lib.php +++ b/main/install/install.lib.php @@ -2975,6 +2975,23 @@ function fixLpId($connection, $debug) */ function updateEnvFile($distFile, $envFile, $params) { + $requirements = [ + 'DATABASE_HOST', + 'DATABASE_PORT', + 'DATABASE_NAME', + 'DATABASE_USER', + 'DATABASE_PASSWORD', + 'APP_INSTALLED', + 'APP_ENCRYPT_METHOD', + 'APP_URL_APPEND', + ]; + + foreach ($requirements as $requirement) { + if (!isset($params[$requirement])) { + throw new \Exception("The parameter $requirement is needed in order to edit the .env file"); + } + } + $contents = file_get_contents($distFile); $contents = str_replace(array_keys($params), array_values($params), $contents); file_put_contents($envFile, $contents);