From 19f0aab3221dd7760387cbec745c1eca9b215af7 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 9 Sep 2017 16:08:00 +0200 Subject: WIP: CI3 migration Signed-off-by: Florian Pritz --- public_html/index.php | 58 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) (limited to 'public_html') 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 @@ -36,6 +36,60 @@ * @filesource */ +/* + *--------------------------------------------------------------- + * 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 -- cgit v1.2.3-24-g4f1b