summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2013-01-28 10:00:02 +0100
committerAndrey Andreev <narf@bofh.bg>2013-01-28 10:00:02 +0100
commitdb529ca1e13e9f9e1c73be20c3b92a7adc3c6aa2 (patch)
treed4f4ecff21af8f6e09eb764546b8bdb02646148a /system/core
parent1b74e70c0cfd3aedcfa427b655e2ad3868bff531 (diff)
Remove unnecessary defined('ENVIRONMENT') checks
As suggested in issue #2134 & PR #2149
Diffstat (limited to 'system/core')
-rw-r--r--system/core/CodeIgniter.php2
-rw-r--r--system/core/Common.php4
-rw-r--r--system/core/Config.php6
-rw-r--r--system/core/Hooks.php2
-rw-r--r--system/core/Loader.php6
-rw-r--r--system/core/Router.php2
6 files changed, 9 insertions, 13 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 8affde64d..cb4b735d5 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -58,7 +58,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* Load the framework constants
* ------------------------------------------------------
*/
- if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
+ if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
{
require(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
}
diff --git a/system/core/Common.php b/system/core/Common.php
index d494caf80..90cc5b3a4 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -241,7 +241,7 @@ if ( ! function_exists('get_config'))
}
// Is the config file in the environment folder?
- if (defined('ENVIRONMENT') && file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php'))
+ if (file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php'))
{
require($file_path);
}
@@ -316,7 +316,7 @@ if ( ! function_exists('get_mimes'))
{
static $_mimes = array();
- if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
{
$_mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
}
diff --git a/system/core/Config.php b/system/core/Config.php
index 0160d1a15..7e64444bc 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -106,13 +106,9 @@ class CI_Config {
$file = ($file === '') ? 'config' : str_replace('.php', '', $file);
$found = $loaded = FALSE;
- $check_locations = defined('ENVIRONMENT')
- ? array(ENVIRONMENT.'/'.$file, $file)
- : array($file);
-
foreach ($this->_config_paths as $path)
{
- foreach ($check_locations as $location)
+ foreach (array(ENVIRONMENT.'/'.$file, $file) as $location)
{
$file_path = $path.'config/'.$location.'.php';
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index 2cb416c0c..59759e02e 100644
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -81,7 +81,7 @@ class CI_Hooks {
}
// Grab the "hooks" definition file.
- if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php');
}
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 1ad07f1fa..bbd7a84b6 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -1089,12 +1089,12 @@ class CI_Loader {
// We test for both uppercase and lowercase, for servers that
// are case-sensitive with regard to file names. Check for environment
// first, global next
- if (defined('ENVIRONMENT') && file_exists($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
+ if (file_exists($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
{
include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php');
break;
}
- elseif (defined('ENVIRONMENT') && file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
+ elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
{
include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php');
break;
@@ -1180,7 +1180,7 @@ class CI_Loader {
*/
protected function _ci_autoloader()
{
- if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'))
+ if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php');
}
diff --git a/system/core/Router.php b/system/core/Router.php
index f284e29cc..4755b3712 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -133,7 +133,7 @@ class CI_Router {
}
// Load the routes.php file.
- if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/routes.php');
}