Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lazy loading objects and file map once it should not be used anymore …
…in most of the requests
- Loading branch information
Showing
3 changed files
with
5 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,14 +157,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 | ||
*/ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jrbasso
via email
Author
Member
|
||
public static $bootstrapping = false; | ||
|
||
/** | ||
* 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; | ||
} | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What's the actual reason for removing this feature?