Index: branches/5.2.x/core/kernel/managers/cache_manager.php =================================================================== diff -u -N -r14244 -r14428 --- branches/5.2.x/core/kernel/managers/cache_manager.php (.../cache_manager.php) (revision 14244) +++ branches/5.2.x/core/kernel/managers/cache_manager.php (.../cache_manager.php) (revision 14428) @@ -1,6 +1,6 @@ Array (), + 'registerAgent' => Array (), + 'registerHook' => Array (), + 'registerBuildEvent' => Array (), + 'registerAggregateTag' => Array (), + ); + /** * Creates caching manager instance * @@ -204,6 +212,8 @@ $cache = unserialize($data); // 126 KB all modules unset($data); + $this->Application->InitManagers(); + $this->Application->Factory->setFromCache($cache); $this->Application->UnitConfigReader->setFromCache($cache); $this->Application->EventManager->setFromCache($cache); @@ -224,6 +234,31 @@ } /** + * Empties factory and event manager cache (without storing changes) + */ + public function EmptyUnitCache() + { + $cache_keys = Array ( + 'Factory.Files', 'Factory.realClasses', 'Factory.Dependencies', + 'EventManager.buildEvents', 'EventManager.beforeHooks', + 'EventManager.afterHooks', 'EventManager.beforeRegularEvents', + 'EventManager.afterRegularEvents' + ); + + $empty_cache = Array (); + + foreach ($cache_keys as $cache_key) { + $empty_cache[$cache_key] = Array (); + } + + $this->Application->Factory->setFromCache($empty_cache); + $this->Application->EventManager->setFromCache($empty_cache); + + // otherwise ModulesHelper indirectly used from includeConfigFiles won't work + $this->Application->RegisterDefaultClasses(); + } + + /** * Updates data, that was parsed from unit configs this time * * @access public @@ -256,6 +291,32 @@ } } + public function delayUnitProcessing($method, $params) + { + if ($this->Application->InitDone) { + // init already done -> call immediately (happens during installation) + $function = Array (&$this->Application, $method); + call_user_func_array($function, $params); + + return ; + } + + $this->temporaryCache[$method][] = $params; + } + + public function applyDelayedUnitProcessing() + { + foreach ($this->temporaryCache as $method => $method_calls) { + $function = Array (&$this->Application, $method); + + foreach ($method_calls as $method_call) { + call_user_func_array($function, $method_call); + } + + $this->temporaryCache[$method] = Array (); + } + } + /** * Deletes all data, that was cached during unit config parsing (including unit config locations) *