summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-01-10 18:29:49 +0100
committerAndrey Andreev <narf@devilix.net>2014-01-10 18:29:49 +0100
commit4e6c5281a3258b3ff530a43580d1b8dc8e34dd59 (patch)
tree4fcad14eb485b0bca43910cea63c8417f402b9ba
parentc809726558cc5364713e49c7404e43989203c4af (diff)
Finally get rid of the CI_Router::_set_overrides() calls
-rw-r--r--system/core/CodeIgniter.php6
-rw-r--r--system/core/Router.php55
-rw-r--r--user_guide_src/source/changelog.rst1
3 files changed, 24 insertions, 38 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 45c3485bf..cc12f149f 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -163,12 +163,6 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
$RTR =& load_class('Router', 'core');
- // Set any routing overrides that may exist in the main index file
- if (isset($routing))
- {
- $RTR->_set_overrides($routing);
- }
-
/*
* ------------------------------------------------------
* Instantiate the output class
diff --git a/system/core/Router.php b/system/core/Router.php
index d467d60fd..cb44a3ce9 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -102,9 +102,32 @@ class CI_Router {
*/
public function __construct()
{
+ global $routing;
+
$this->config =& load_class('Config', 'core');
$this->uri =& load_class('URI', 'core');
$this->_set_routing();
+
+ // Set any routing overrides that may exist in the main index file
+ if (isset($routing) && is_array($routing))
+ {
+ if (isset($routing['directory']))
+ {
+ $this->set_directory($routing['directory']);
+ }
+
+ if ( ! empty($routing['controller']))
+ {
+ $this->set_class($routing['controller']);
+ }
+
+ if (isset($routing['function']))
+ {
+ $routing['function'] = empty($routing['function']) ? 'index' : $routing['function'];
+ $this->set_method($routing['function']);
+ }
+ }
+
log_message('debug', 'Router Class Initialized');
}
@@ -519,38 +542,6 @@ class CI_Router {
return $this->directory;
}
- // --------------------------------------------------------------------
-
- /**
- * Set controller overrides
- *
- * @param array $routing Route overrides
- * @return void
- */
- public function _set_overrides($routing)
- {
- if ( ! is_array($routing))
- {
- return;
- }
-
- if (isset($routing['directory']))
- {
- $this->set_directory($routing['directory']);
- }
-
- if ( ! empty($routing['controller']))
- {
- $this->set_class($routing['controller']);
- }
-
- if (isset($routing['function']))
- {
- $routing['function'] = empty($routing['function']) ? 'index' : $routing['function'];
- $this->set_method($routing['function']);
- }
- }
-
}
/* End of file Router.php */
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index b112da5b4..5da707086 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -461,6 +461,7 @@ Release Date: Not Released
- Added possibility to route requests using callbacks.
- Added a new reserved route (*translate_uri_dashes*) to allow usage of dashes in the controller and method URI segments.
- Deprecated methods ``fetch_directory()``, ``fetch_class()`` and ``fetch_method()`` in favor of their respective public properties.
+ - Removed method ``_set_overrides()`` and moved its logic to the class constructor.
- :doc:`Language Library <libraries/language>` changes include: