summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@server-speed.net>2011-04-10 10:39:31 +0200
committerFlorian Pritz <bluewind@server-speed.net>2011-04-10 10:39:31 +0200
commit1bdc9c8903eb2db33fdb8174d61e15100dfbbca8 (patch)
treeb0c645ad99e04f34817fc4e6385792111db42274 /index.php
parent413d0cdac49257089a0790f6ac92973a36a6b69f (diff)
update to CI 2.0.2
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
Diffstat (limited to 'index.php')
-rwxr-xr-xindex.php58
1 files changed, 48 insertions, 10 deletions
diff --git a/index.php b/index.php
index 49cf6e923..6e67c2db5 100755
--- a/index.php
+++ b/index.php
@@ -2,15 +2,49 @@
/*
*---------------------------------------------------------------
- * PHP ERROR REPORTING LEVEL
+ * APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*
- * 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
+ * You can load different configurations depending on your
+ * current environment. Setting the environment also influences
+ * things like logging and error reporting.
+ *
+ * This can be set to anything, but default usage is:
+ *
+ * development
+ * testing
+ * production
+ *
+ * NOTE: If you change these, also change the error_reporting() code below
*
*/
- error_reporting(E_ALL^E_NOTICE);
+ define('ENVIRONMENT', 'development');
+/*
+ *---------------------------------------------------------------
+ * ERROR REPORTING
+ *---------------------------------------------------------------
+ *
+ * Different environments will require different levels of error reporting.
+ * By default development will show errors but testing and live will hide them.
+ */
+
+if (defined('ENVIRONMENT'))
+{
+ switch (ENVIRONMENT)
+ {
+ case 'development':
+ error_reporting(E_ALL);
+ break;
+
+ case 'testing':
+ case 'production':
+ error_reporting(0);
+ break;
+
+ default:
+ exit('The application environment is not set correctly.');
+ }
+}
/*
*---------------------------------------------------------------
@@ -22,7 +56,7 @@
* as this file.
*
*/
- $system_path = "system";
+ $system_path = 'system';
/*
*---------------------------------------------------------------
@@ -38,7 +72,7 @@
* NO TRAILING SLASH!
*
*/
- $application_folder = "application";
+ $application_folder = 'application';
/*
* --------------------------------------------------------------------
@@ -94,14 +128,18 @@
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
// --------------------------------------------------------------------
-
-
-
/*
* ---------------------------------------------------------------
* 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).'/';