From 0687911229be13e100724dbf8b15b95146b591a9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 29 Jan 2013 15:05:02 +0200 Subject: Replace is_file() with the faster file_exists() (where it makes sense) Also: - Implemented caching of configuration arrays for smileys, foreign characters and doctypes. - Implemented cascading-style loading of configuration files (except for library configs, DB and constants.php). --- system/core/Common.php | 4 ++-- system/core/Hooks.php | 5 +++-- system/core/Router.php | 9 +++++---- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'system/core') diff --git a/system/core/Common.php b/system/core/Common.php index 90cc5b3a4..258cd4967 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -316,11 +316,11 @@ if ( ! function_exists('get_mimes')) { static $_mimes = array(); - if (is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) { $_mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); } - elseif (is_file(APPPATH.'config/mimes.php')) + elseif (file_exists(APPPATH.'config/mimes.php')) { $_mimes = include(APPPATH.'config/mimes.php'); } diff --git a/system/core/Hooks.php b/system/core/Hooks.php index 59759e02e..17f6a027e 100644 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -81,11 +81,12 @@ class CI_Hooks { } // Grab the "hooks" definition file. - if (is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'); } - elseif (is_file(APPPATH.'config/hooks.php')) + + if (file_exists(APPPATH.'config/hooks.php')) { include(APPPATH.'config/hooks.php'); } diff --git a/system/core/Router.php b/system/core/Router.php index 4755b3712..bb0ce16bd 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -133,13 +133,14 @@ class CI_Router { } // Load the routes.php file. - if (is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php')) + if (file_exists(APPPATH.'config/routes.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/routes.php'); + include(APPPATH.'config/routes.php'); } - elseif (is_file(APPPATH.'config/routes.php')) + + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/routes.php')) { - include(APPPATH.'config/routes.php'); + include(APPPATH.'config/'.ENVIRONMENT.'/routes.php'); } $this->routes = (empty($route) OR ! is_array($route)) ? array() : $route; -- cgit v1.2.3-24-g4f1b