Permalink
Browse files

Lazy loading objects and file map once it should not be used anymore …

…in most of the requests
  • Loading branch information...
1 parent e99dbee commit beb66e41635d38b896a197bf296667b4420b85f3 @jrbasso jrbasso committed Jun 24, 2012
Showing with 5 additions and 18 deletions.
  1. +5 −15 lib/Cake/Core/App.php
  2. +0 −1 lib/Cake/Core/Configure.php
  3. +0 −2 lib/Cake/bootstrap.php
View
@@ -158,14 +158,6 @@ class App {
protected static $_objectCacheChange = false;
/**
- * Indicates the the Application is in the bootstrapping process. Used to better cache
- * loaded classes while the cache libraries have not been yet initialized
- *
- * @var boolean
- */
- public static $bootstrapping = false;
@lorenzo

lorenzo Jul 2, 2012

Owner

What's the actual reason for removing this feature?

@jrbasso

jrbasso via email Jul 2, 2012

Member
-
-/**
* Return the classname namespaced. This method check if the class is defined on the
* application/plugin, otherwise try to load from the CakePHP core
*
@@ -430,7 +422,7 @@ public static function objects($type, $path = null, $cache = true) {
}
if (empty(static::$_objects) && $cache === true) {
- static::$_objects = Cache::read('object_map', '_cake_core_');
+ static::$_objects = (array)Cache::read('object_map', '_cake_core_');
}
$cacheLocation = empty($plugin) ? 'app' : $plugin;
@@ -492,6 +484,9 @@ public static function load($className) {
if (!isset(static::$_classMap[$className])) {
return false;
}
+ if (empty(static::$_map)) {
+ static::$_map = (array)Cache::read('file_map', '_cake_core_');
+ }
$parts = explode('.', static::$_classMap[$className], 2);
list($plugin, $package) = count($parts) > 1 ? $parts : array(null, current($parts));
@@ -539,16 +534,14 @@ public static function location($className) {
}
/**
- * Initializes the cache for App, registers a shutdown function.
+ * Initializes the App, registers a shutdown function.
*
* @return void
*/
public static function init() {
$loader = new ClassLoader(Configure::read('App.namespace'), dirname(APP));
$loader->register();
- static::$_map += (array)Cache::read('file_map', '_cake_core_');
- static::$_objects += (array)Cache::read('object_map', '_cake_core_');
register_shutdown_function(array(__CLASS__, 'shutdown'));
}
@@ -571,9 +564,6 @@ protected static function _map($file, $name, $plugin = null) {
if (!$plugin && empty(static::$_map['plugin.' . $name])) {
static::$_map[$key] = $file;
}
- if (!static::$bootstrapping) {
- static::$_cacheChange = true;
- }
}
/**
@@ -77,7 +77,6 @@ public static function bootstrap($boot = true) {
if (!include APP . 'Config' . DS . 'core.php') {
trigger_error(__d('cake_dev', "Can't find application core file. Please create %score.php, and make sure it is readable by PHP.", APP . 'Config' . DS), E_USER_ERROR);
}
- App::$bootstrapping = false;
App::init();
App::build();
View
@@ -127,10 +127,8 @@
use Cake\Core\App;
use Cake\Core\Configure;
-App::$bootstrapping = true;
Configure::bootstrap(isset($boot) ? $boot : true);
-
/**
* Full url prefix
*/

0 comments on commit beb66e4

Please sign in to comment.