config.php has to be written to parent dir

This commit is contained in:
wrongecho 2025-01-02 21:55:25 +00:00
parent ff4f8a9a18
commit 43ccf8a026
1 changed files with 4 additions and 4 deletions

View File

@ -141,7 +141,7 @@ function getOptionOrPrompt($key, $promptMessage, $required = false, $default = '
echo "Welcome to the ITFlow CLI Setup.\n"; echo "Welcome to the ITFlow CLI Setup.\n";
// If config exists, abort // If config exists, abort
if (file_exists('config.php')) { if (file_exists('../config.php')) {
echo "Database is already configured in config.php.\n"; echo "Database is already configured in config.php.\n";
echo "To re-run the setup, remove config.php and run this script again.\n"; echo "To re-run the setup, remove config.php and run this script again.\n";
exit; exit;
@ -233,15 +233,15 @@ $new_config .= "\$config_https_only = TRUE;\n";
$new_config .= "\$repo_branch = 'master';\n"; $new_config .= "\$repo_branch = 'master';\n";
$new_config .= "\$installation_id = '$installation_id';\n"; $new_config .= "\$installation_id = '$installation_id';\n";
if (file_put_contents("config.php", $new_config) === false) { if (file_put_contents("../config.php", $new_config) === false) {
die("Failed to write config.php. Check file permissions.\n"); die("Failed to write config.php. Check file permissions.\n");
} }
if (!file_exists('config.php')) { if (!file_exists('../config.php')) {
die("config.php does not exist after write attempt.\n"); die("config.php does not exist after write attempt.\n");
} }
include "config.php"; require "../config.php";
// Import DB Schema // Import DB Schema
echo "Importing database schema...\n"; echo "Importing database schema...\n";