From 6e27d888c38d3ca5c263bea8b443eee64e7847b0 Mon Sep 17 00:00:00 2001 From: "Mohammad H. Al-Shami" Date: Sun, 10 May 2015 16:40:38 +0300 Subject: [PATCH] Update install.php to prevent creating an empty config.php file I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md. --- AUTHORS.md | 3 +-- html/install.php | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index ab2098623..c547763ae 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -23,7 +23,6 @@ Contributors to LibreNMS: - Stuart Henderson (sthen) - Filippo Giunchedi (filippog) - Lasse Leegaard (lasseleegaard) +- Mohammad Al-Shami (mohshami) [1]: http://observium.org/ "Observium web site" - - diff --git a/html/install.php b/html/install.php index 3f9d31984..2c9b71743 100644 --- a/html/install.php +++ b/html/install.php @@ -33,7 +33,7 @@ include("../includes/defaults.inc.php"); // Work out the install directory $cur_dir = explode('/',$_SERVER['DOCUMENT_ROOT']); $install_dir = array_pop($cur_dir); -$install_dir = array_pop($cur_dir); +#$install_dir = array_pop($cur_dir); $install_dir = implode('/',$cur_dir); $config['install_dir'] = $install_dir; $config['log_dir'] = $install_dir.'/logs'; @@ -344,7 +344,7 @@ require('../build-base.php'); - +
@@ -409,9 +409,9 @@ EOD; if(!file_exists("../config.php")) { $conf = fopen("../config.php", 'w'); - if ($conf === false) + if ($conf != false) { - if(fwrite($handle, '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/)"); echo("
<?php\n".stripslashes($config_file)."
"); @@ -419,7 +419,7 @@ EOD; else { $config_file = stripslashes($config_file); - fwrite($handle,$config_file); + fwrite($conf,$config_file); echo("
The config file has been created
"); } }