Skip to content

Commit

Permalink
Removed CI_Loader::initialize() and moved its logic to the constructor.
Browse files Browse the repository at this point in the history
That method used to be called by the CI_Controller constructor
and was required because of the possibility to instantiate the
Controller class twice due to 404_override, and so some properties
needed to be reset.

Following the last commit - this is no longer the case.
  • Loading branch information
narfbg committed Nov 2, 2012
1 parent 38e32f6 commit 679525d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
1 change: 0 additions & 1 deletion system/core/Controller.php
Expand Up @@ -65,7 +65,6 @@ public function __construct()
}

$this->load =& load_class('Loader', 'core');
$this->load->initialize();
log_message('debug', 'Controller Class Initialized');
}

Expand Down
28 changes: 6 additions & 22 deletions system/core/Loader.php
Expand Up @@ -130,8 +130,10 @@ class CI_Loader {
/**
* Class constructor
*
* Sets component load paths gets the initial output buffering level.
* Sets component load paths, gets the initial output buffering level
* and calls the autoloader.
*
* @uses CI_Loader::_ci_autoloader()
* @return void
*/
public function __construct()
Expand All @@ -141,28 +143,10 @@ public function __construct()
$this->_ci_helper_paths = array(APPPATH, BASEPATH);
$this->_ci_model_paths = array(APPPATH);
$this->_ci_view_paths = array(VIEWPATH => TRUE);

log_message('debug', 'Loader Class Initialized');
}

// --------------------------------------------------------------------

/**
* Initialize the Loader
*
* @used-by CI_Controller
* @uses CI_Loader::_ci_autoloader()
* @return object $this
*/
public function initialize()
{
$this->_ci_classes = array();
$this->_ci_loaded_files = array();
$this->_ci_models = array();
$this->_base_classes =& is_loaded();

$this->_ci_autoloader();
return $this;

log_message('debug', 'Loader Class Initialized');
}

// --------------------------------------------------------------------
Expand Down Expand Up @@ -1150,7 +1134,7 @@ protected function _ci_init_class($class, $prefix = '', $config = FALSE, $object
*
* Loads component listed in the config/autoload.php file.
*
* @used-by CI_Loader::initialize()
* @used-by CI_Loader::__construct()
* @return void
*/
protected function _ci_autoloader()
Expand Down
1 change: 1 addition & 0 deletions user_guide_src/source/changelog.rst
Expand Up @@ -245,6 +245,7 @@ Release Date: Not Released
- ``library()`` method will now load drivers as well, for backward compatibility of converted libraries (like :doc:`Session <libraries/sessions>`).
- ``$config['rewrite_short_tags']`` now has no effect when using PHP 5.4 as ``<?=`` will always be available.
- Changed method ``config()`` to return whatever ``CI_Config::load()`` returns instead of always being void.
- Removed method ``initialize()`` and moved its logic to the constructor.
- :doc:`Input Library <libraries/input>` changes include:
- Added ``method()`` to retrieve ``$_SERVER['REQUEST_METHOD']``.
- Added support for arrays and network addresses (e.g. 192.168.1.1/24) for use with the *proxy_ips* setting.
Expand Down

0 comments on commit 679525d

Please sign in to comment.