mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Caching plugin objects in App::objects()
This commit is contained in:
parent
cd28f19363
commit
ca4ee0c562
1 changed files with 6 additions and 4 deletions
|
@ -411,7 +411,7 @@ class App {
|
|||
* `App::objects('plugin');` returns `array('DebugKit', 'Blog', 'User');`
|
||||
*
|
||||
* You can also search only within a plugin's objects by using the plugin dot
|
||||
* syntax (these objects are not cached):
|
||||
* syntax.
|
||||
*
|
||||
* `App::objects('MyPlugin.model');` returns `array('Post', 'Comment');`
|
||||
*
|
||||
|
@ -453,7 +453,9 @@ class App {
|
|||
self::$__objects = Cache::read('object_map', '_cake_core_');
|
||||
}
|
||||
|
||||
if (!isset(self::$__objects[$name]) || $cache !== true) {
|
||||
$cacheLocation = empty($plugin) ? 'app' : $plugin;
|
||||
|
||||
if ($cache !== true || !isset(self::$__objects[$cacheLocation][$name])) {
|
||||
$objects = array();
|
||||
|
||||
if (empty($path)) {
|
||||
|
@ -484,11 +486,11 @@ class App {
|
|||
if ($plugin) {
|
||||
return $objects;
|
||||
}
|
||||
self::$__objects[$name] = $objects;
|
||||
self::$__objects[$cacheLocation][$name] = $objects;
|
||||
self::$_objectCacheChange = true;
|
||||
}
|
||||
|
||||
return self::$__objects[$name];
|
||||
return self::$__objects[$cacheLocation][$name];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue