From cee8075e2f8fdeb0d8516b5af8ae7cd7754ac513 Mon Sep 17 00:00:00 2001 From: joelcox Date: Sat, 15 Jan 2011 23:09:47 +0100 Subject: Split basic configuration in three environments, providing fallback to global --- index.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'index.php') diff --git a/index.php b/index.php index 5bb53d2f2..7eacaab63 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,17 @@ Date: Sun, 16 Jan 2011 15:24:43 +0100 Subject: Removed default error_reporting and set it depending on environment --- index.php | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 7eacaab63..016ffc015 100644 --- a/index.php +++ b/index.php @@ -6,24 +6,14 @@ *--------------------------------------------------------------- * * You can load different configurations depending on your - * current environment. The enviroment variable can be set - * to "development" (default), "test" or "production" + * current environment. Setting the environment also influences + * things like logging and error reporting. The enviroment + * variable can be set to "development" (default), + * "test" or "production". * */ define('ENVIRONMENT', 'development'); -/* - *--------------------------------------------------------------- - * PHP ERROR REPORTING LEVEL - *--------------------------------------------------------------- - * - * By default CI runs with error reporting set to ALL. For security - * reasons you are encouraged to change this to 0 when your site goes live. - * For more info visit: http://www.php.net/error_reporting - * - */ - error_reporting(E_ALL); - /* *--------------------------------------------------------------- * SYSTEM FOLDER NAME @@ -106,9 +96,25 @@ // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE // -------------------------------------------------------------------- +/* + * --------------------------------------------------------------- + * Check if environment is set, and set error reporting appropriately + * --------------------------------------------------------------- + */ - - + if (ENVIRONMENT == 'development') + { + error_reporting(E_ALL); + } + elseif (ENVIRONMENT == 'production' OR ENVIRONMENT == 'test') + { + error_reporting(0); + } + else + { + exit("The application environment is not set correctly."); + } + /* * --------------------------------------------------------------- * Resolve the system path for increased reliability -- cgit v1.2.3-24-g4f1b From 1bfd9fabffc47ae7f6efc4704ae3125599004de8 Mon Sep 17 00:00:00 2001 From: joelcox Date: Sun, 16 Jan 2011 18:49:39 +0100 Subject: Set error_reporting to E_ALL when environment unknown and changed CI_Loader to load environment configs first. --- index.php | 1 + 1 file changed, 1 insertion(+) (limited to 'index.php') diff --git a/index.php b/index.php index 016ffc015..7741d5cb8 100644 --- a/index.php +++ b/index.php @@ -112,6 +112,7 @@ } else { + error_reporting(E_ALL); exit("The application environment is not set correctly."); } -- cgit v1.2.3-24-g4f1b From 01d1a5b936556f3b19786b7407cce11cf3bdb616 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Mon, 7 Feb 2011 10:54:06 +0000 Subject: CLI requests can now be run from any folder, not just when CD'ed next to index.php. --- index.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'index.php') diff --git a/index.php b/index.php index 918c80259..74e3ba32a 100644 --- a/index.php +++ b/index.php @@ -130,6 +130,13 @@ * Resolve the system path for increased reliability * --------------------------------------------------------------- */ + + // Set the current directory correctly for CLI requests + if (defined('STDIN')) + { + chdir(dirname(__FILE__)); + } + if (realpath($system_path) !== FALSE) { $system_path = realpath($system_path).'/'; -- cgit v1.2.3-24-g4f1b