mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
Fix install.php can't find config.php (#10129)
This commit is contained in:
parent
69a453adf0
commit
39ff4c7aaf
@ -4,7 +4,7 @@ use LibreNMS\Authentication\LegacyAuth;
|
||||
session_start();
|
||||
if (empty($_POST) && !empty($_SESSION) && !isset($_REQUEST['stage'])) {
|
||||
$_POST = $_SESSION;
|
||||
} elseif (!file_exists("../config.php")) {
|
||||
} elseif (!file_exists("config.php")) {
|
||||
$allowed_vars = array('stage','build-ok','dbhost','dbuser','dbpass','dbname','dbport','dbsocket','add_user','add_pass','add_email');
|
||||
foreach ($allowed_vars as $allowed) {
|
||||
if (isset($_POST[$allowed])) {
|
||||
@ -16,7 +16,7 @@ if (empty($_POST) && !empty($_SESSION) && !isset($_REQUEST['stage'])) {
|
||||
$stage = isset($_POST['stage']) ? $_POST['stage'] : 0;
|
||||
|
||||
// Before we do anything, if we see config.php, redirect back to the homepage.
|
||||
if (file_exists('../config.php') && $stage != 6) {
|
||||
if (file_exists('config.php') && $stage != 6) {
|
||||
unset($_SESSION['stage']);
|
||||
header("Location: /");
|
||||
exit;
|
||||
@ -78,7 +78,7 @@ if ($stage == 4) {
|
||||
}
|
||||
} elseif ($stage == 6) {
|
||||
// If we get here then let's do some final checks.
|
||||
if (!file_exists("../config.php")) {
|
||||
if (!file_exists("config.php")) {
|
||||
// config.php file doesn't exist. go back to that stage
|
||||
$msg = "config.php still doesn't exist";
|
||||
$stage = 5;
|
||||
@ -392,8 +392,8 @@ $config_file = <<<"EOD"
|
||||
#\$config\['update'\] = 0; # uncomment to completely disable updates
|
||||
EOD;
|
||||
|
||||
if (!file_exists("../config.php")) {
|
||||
$conf = fopen("../config.php", 'w');
|
||||
if (!file_exists("config.php")) {
|
||||
$conf = fopen("config.php", 'w');
|
||||
if ($conf != false) {
|
||||
if (fwrite($conf, "<?php\n") === false) {
|
||||
echo("<div class='alert alert-danger'>We couldn't create the config.php file, please create this manually before continuing by copying the below into a config.php in the root directory of your install (typically /opt/librenms/)</div>");
|
||||
|
Loading…
Reference in New Issue
Block a user