summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoelcox <joel@mickly.com>2011-01-16 15:24:43 +0100
committerjoelcox <joel@mickly.com>2011-01-16 15:24:43 +0100
commitbf2b912ec37cde3bb809437c0763bac860665915 (patch)
treeca350faeafed2385396bde631f25e42af9222d38
parente3da4283b8b0aa96ee6f877c85c62d05dea8c778 (diff)
Removed default error_reporting and set it depending on environment
-rw-r--r--index.php38
1 files changed, 22 insertions, 16 deletions
diff --git a/index.php b/index.php
index 7eacaab63..016ffc015 100644
--- a/index.php
+++ b/index.php
@@ -6,26 +6,16 @@
*---------------------------------------------------------------
*
* 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