diff options
Diffstat (limited to 'public_html/index.php')
-rw-r--r-- | public_html/index.php | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/public_html/index.php b/public_html/index.php index 8373760fa..1bc7408f5 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -38,6 +38,60 @@ /* *--------------------------------------------------------------- + * APPLICATION ENVIRONMENT + *--------------------------------------------------------------- + * + * 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 + */ + 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 (false) { +switch (ENVIRONMENT) +{ + case 'development': + error_reporting(-1); + ini_set('display_errors', 1); + break; + + case 'testing': + case 'production': + ini_set('display_errors', 0); + if (version_compare(PHP_VERSION, '5.3', '>=')) + { + error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); + } + else + { + error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); + } + break; + + default: + header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); + echo 'The application environment is not set correctly.'; + exit(1); // EXIT_ERROR +} +} + +/* + *--------------------------------------------------------------- * SYSTEM DIRECTORY NAME *--------------------------------------------------------------- * @@ -264,8 +318,8 @@ require APPPATH.'libraries/ExceptionHandler.php'; \libraries\ExceptionHandler::setup(); // wrapper for CI so that it calls our handler rather than it's own -function _exception_handler($severity, $message, $filepath, $line) { - return \libraries\ExceptionHandler::error_handler($severity, $message, $filepath, $line); +function _exception_handler($ex) { + return \libraries\ExceptionHandler::exception_handler($ex); } // Source: http://stackoverflow.com/a/15875555 |