Permalink
Browse files

Fix #15920: Missing config file causes cli scripts to fail silently

We now display an error message and die with exit code 1.
  • Loading branch information...
1 parent 975770f commit 56de55455d3371b02e59d067d8059141bcf020c3 @dregad dregad committed May 25, 2013
Showing with 5 additions and 0 deletions.
  1. +5 −0 core.php
View
@@ -207,6 +207,11 @@ function __autoload( $className ) {
# If no configuration file exists, redirect the user to the admin page so
# they can complete installation and configuration of MantisBT
if ( false === $t_config_inc_found ) {
+ if( php_sapi_name() == 'cli' ) {
+ echo "Error: config_inc.php file not found; ensure MantisBT is properly setup.\n";
+ exit(1);
+ }
+
if ( !( isset( $_SERVER['SCRIPT_NAME'] ) && ( 0 < strpos( $_SERVER['SCRIPT_NAME'], 'admin' ) ) ) ) {
header( 'Content-Type: text/html' );
header( "Location: admin/install.php" );

0 comments on commit 56de554

Please sign in to comment.