Another try to make sure config.php is written before going further

This commit is contained in:
johnnyq
2023-03-11 19:11:34 -05:00
parent 709516853a
commit 6a435157c1
+8 -5
View File
@@ -803,11 +803,7 @@ if (isset($_POST['add_database'])) {
$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 && file_exists('config.php')) {
$_SESSION['alert_message'] = "Failed to write the config.php file to the filesystem. Please input the database information again.";
header("Location: setup.php?database");
exit;
}
include("config.php"); include("config.php");
@@ -838,6 +834,13 @@ if (isset($_POST['add_database'])) {
header("Location: setup.php?user"); header("Location: setup.php?user");
exit; exit;
} else {
// There was an error writing the file
// Display an error message and redirect to the setup page
$_SESSION['alert_message'] = "Did not successfully write the config.php file to the filesystem, Please Input the database information again.";
header("Location: setup.php?database");
exit;
} }
if (isset($_POST['add_user'])) { if (isset($_POST['add_user'])) {