[PATCH] Terminates execution of the script if aurweb config file not found
--- web/lib/confparser.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/lib/confparser.inc.php b/web/lib/confparser.inc.php index e7128be..499481d 100644 --- a/web/lib/confparser.inc.php +++ b/web/lib/confparser.inc.php @@ -8,7 +8,11 @@ function config_load() { if (!$path) { $path = "/etc/aurweb/config"; } - $AUR_CONFIG = parse_ini_file($path, true, INI_SCANNER_RAW); + if (file_exists($path)) { + $AUR_CONFIG = parse_ini_file($path, true, INI_SCANNER_RAW); + } else { + die("aurweb config file not found"); + } } } -- 2.16.1
I spent 5 minutes to figure out why fresh aurweb install did not work for me. Because I missed aurweb/config file. I've added termination just in case there is not file. On Fri, Mar 16, 2018 at 8:17 PM, nodivbyzero <nodivbyzero@gmail.com> wrote:
--- web/lib/confparser.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/web/lib/confparser.inc.php b/web/lib/confparser.inc.php index e7128be..499481d 100644 --- a/web/lib/confparser.inc.php +++ b/web/lib/confparser.inc.php @@ -8,7 +8,11 @@ function config_load() { if (!$path) { $path = "/etc/aurweb/config"; } - $AUR_CONFIG = parse_ini_file($path, true, INI_SCANNER_RAW); + if (file_exists($path)) { + $AUR_CONFIG = parse_ini_file($path, true, INI_SCANNER_RAW); + } else { + die("aurweb config file not found"); + } } }
-- 2.16.1
On 03/16/2018 04:17 PM, nodivbyzero wrote:
--- web/lib/confparser.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/web/lib/confparser.inc.php b/web/lib/confparser.inc.php index e7128be..499481d 100644 --- a/web/lib/confparser.inc.php +++ b/web/lib/confparser.inc.php @@ -8,7 +8,11 @@ function config_load() { if (!$path) { $path = "/etc/aurweb/config"; } - $AUR_CONFIG = parse_ini_file($path, true, INI_SCANNER_RAW); + if (file_exists($path)) { + $AUR_CONFIG = parse_ini_file($path, true, INI_SCANNER_RAW); + } else { + die("aurweb config file not found"); + } } }
Very minor nit. The commit message should probably be "Terminate" rather than "Terminates" -- Eli Schwartz Bug Wrangler and Trusted User
On Fri, 16 Mar 2018 at 21:17:03, nodivbyzero wrote:
--- web/lib/confparser.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) [...]
Merged with a slightly amended commit message; thanks!
participants (4)
-
Eli Schwartz
-
Lukas Fleischer
-
Nodiv Byzero
-
nodivbyzero