Index: branches/5.2.x/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r14244 -r14428 --- branches/5.2.x/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 14244) +++ branches/5.2.x/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 14428) @@ -1,6 +1,6 @@ StoreCache = $cache; + + if (!$this->Application->InitDone) { + // scanModules is called multiple times during installation process + $this->Application->InitManagers(); + } + + $this->Application->cacheManager->applyDelayedUnitProcessing(); } function findConfigFiles($folderPath, $level = 0) @@ -316,19 +323,8 @@ */ function ReReadConfigs() { - // clear restored cache (not in db) - $this->Application->Factory->Files = Array (); - $this->Application->Factory->realClasses = Array (); - $this->Application->Factory->Dependencies = Array (); + $this->Application->cacheManager->EmptyUnitCache(); - $this->Application->EventManager->beforeRegularEvents = Array (); - $this->Application->EventManager->afterRegularEvents = Array (); - $this->Application->EventManager->beforeHooks = Array (); - $this->Application->EventManager->afterHooks = Array (); - - // otherwise ModulesHelper indirectly used from includeConfigFiles won't work - $this->Application->RegisterDefaultClasses(); - // parse all configs $this->ProcessAllConfigs = true; $this->AfterConfigProcessed = Array (); @@ -350,11 +346,15 @@ $new_clones = Array(); foreach ($this->configData as $prefix => $config) { $clones = $this->postProcessConfig($prefix, 'Clones', 'prefix'); + if ($clones) { $new_clones = array_merge($new_clones, $clones); } } + // execute delayed methods for cloned unit configs + $this->Application->cacheManager->applyDelayedUnitProcessing(); + // call OnAfterConfigRead for cloned configs $new_clones = array_unique($new_clones); foreach ($new_clones as $prefix) { @@ -439,7 +439,7 @@ ); if ( isset($class_info['build_event']) && $class_info['build_event'] ) { - $this->Application->EventManager->registerBuildEvent($class_info['pseudo'], $class_info['build_event']); + $this->Application->delayUnitProcessing('registerBuildEvent', Array ($class_info['pseudo'], $class_info['build_event'])); } } } @@ -456,7 +456,7 @@ foreach ($regular_events as $short_name => $regular_event_info) { $event_status = array_key_exists('Status', $regular_event_info) ? $regular_event_info['Status'] : STATUS_ACTIVE; - $this->Application->EventManager->registerAgent( $short_name, $config['Prefix'] . ':' . $regular_event_info['EventName'], $regular_event_info['RunInterval'], $regular_event_info['Type'], $event_status ); + $this->Application->delayUnitProcessing('registerAgent', Array ( $short_name, $config['Prefix'] . ':' . $regular_event_info['EventName'], $regular_event_info['RunInterval'], $regular_event_info['Type'], $event_status )); } } @@ -502,7 +502,7 @@ $hook_event = $hook['HookToPrefix'] . '.' . $hook['HookToSpecial'] . ':' . $hook_event; $do_event = $do_prefix . '.' . $hook['DoSpecial'] . ':' . $hook['DoEvent']; - $this->Application->registerHook($hook_event, $do_event, $hook['Mode'], $hook['Conditional']); + $this->Application->delayUnitProcessing('registerHook', Array ($hook_event, $do_event, $hook['Mode'], $hook['Conditional'])); } } } @@ -524,7 +524,7 @@ } $aggregate_tag['LocalPrefix'] = $config['Prefix']; - $this->Application->registerAggregateTag($aggregate_tag); + $this->Application->delayUnitProcessing('registerAggregateTag', Array ($aggregate_tag)); } }