diff options
author | Daniel Hunsaker <danhunsaker@gmail.com> | 2013-02-23 03:17:56 +0100 |
---|---|---|
committer | Daniel Hunsaker <danhunsaker@gmail.com> | 2013-02-23 03:18:51 +0100 |
commit | 3b5b7f48848d098c6190781f8790a1b0dcb0217c (patch) | |
tree | af75fafeb3c822b720ee3da9b23b9d7a9e6ba020 /index.php | |
parent | 44a6d1da2be916fe0f23a3ea4d5fcb391d7f65dd (diff) |
Updated exit codes as constant values
Re-allocated exit status codes according to three references, which follow:
BSD sysexits.h:http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
GNU recomendations:http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
Bash scripting:http://tldp.org/LDP/abs/html/exitcodes.html
The GNU recommendations stem from and expand upon the standard C/C++ library (stdlibc)
definitions, while also suggesting some best-practice conventions which happen to prevent
exit status code collisions with bash, and probably other shells.
The re-allocated codes are now mapped to constant values, set in *application/config/constants.php*,
and used throughout the CodeIgniter core. They would additionally be used in *index.php*,
but the constants file hasn't been loaded at that point, so the integer values are used
instead, and a comment follows each such use with amplifying information on why that
particular value was selected.
Finally, the errors documentation has been updated accordingly.
Signed-off-by: Daniel Hunsaker <danhunsaker@gmail.com>
Diffstat (limited to 'index.php')
-rwxr-xr-x | index.php | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -67,7 +67,8 @@ switch (ENVIRONMENT) default: header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); - exit('The application environment is not set correctly.'); + echo 'The application environment is not set correctly.'; + exit(1); // EXIT_* constants not yet defined; 1 is EXIT_FAILURE, a generic error. } /* @@ -190,7 +191,8 @@ switch (ENVIRONMENT) if ( ! is_dir($system_path)) { header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); - exit('Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME)); + echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME); + exit(3); // EXIT_* constants not yet defined; 3 is EXIT_CONFIG. } /* @@ -225,7 +227,8 @@ switch (ENVIRONMENT) if ( ! is_dir(BASEPATH.$application_folder.'/')) { header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); - exit('Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF); + echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; + exit(3); // EXIT_* constants not yet defined; 3 is EXIT_CONFIG. } define('APPPATH', BASEPATH.$application_folder.'/'); @@ -241,7 +244,8 @@ switch (ENVIRONMENT) elseif ( ! is_dir(APPPATH.'views/')) { header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); - exit('Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF); + echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; + exit(3); // EXIT_* constants not yet defined; 3 is EXIT_CONFIG. } else { |