Index: kernel/event_manager.php =================================================================== --- kernel/event_manager.php (revision 12973) +++ kernel/event_manager.php (working copy) @@ -404,7 +404,7 @@ if (preg_match('/(.*?)-(.*)/', $event->Prefix, $regs) && $this->Application->UnitConfigReader->prefixRegistred($regs[1])) { // this is event from cloned config -> load parent config to create valid clone $this->Application->UnitConfigReader->loadConfig($regs[1]); - $this->Application->HandleEvent( new kEvent($regs[1].':OnAfterConfigRead') ); + $this->Application->UnitConfigReader->runAfterConfigRead($regs[1]); } $event->setEventParam('top_prefix', $this->Application->GetTopmostPrefix($event->Prefix, true)); Index: kernel/utility/unit_config_reader.php =================================================================== --- kernel/utility/unit_config_reader.php (revision 12973) +++ kernel/utility/unit_config_reader.php (working copy) @@ -325,12 +325,7 @@ // if (!$this->ProcessAllConfigs) return ; $this->FinalStage = true; foreach ($this->configData as $prefix => $config) { - if (in_array($prefix, $this->AfterConfigProcessed)) { - continue; - } - - $this->Application->HandleEvent( new kEvent($prefix.':OnAfterConfigRead') ); - $this->AfterConfigProcessed[] = $prefix; + $this->runAfterConfigRead($prefix); } if (!isset($store_cache)) { @@ -410,6 +405,7 @@ // parse all configs $this->ProcessAllConfigs = true; + $this->AfterConfigProcessed = Array (); $this->includeConfigFiles(MODULES_PATH, false); $this->ParseConfigs(); $this->AfterConfigRead(false); @@ -434,12 +430,7 @@ // call OnAfterConfigRead for cloned configs $new_clones = array_unique($new_clones); foreach ($new_clones as $prefix) { - if (in_array($prefix, $this->AfterConfigProcessed)) { - continue; - } - - $this->Application->HandleEvent( new kEvent($prefix.':OnAfterConfigRead') ); - $this->AfterConfigProcessed[] = $prefix; + $this->runAfterConfigRead($prefix); } } @@ -822,11 +813,21 @@ array_unshift($clones, $prefix); $clones = array_unique($clones); foreach ($clones as $a_prefix) { - $this->Application->HandleEvent( new kEvent($a_prefix.':OnAfterConfigRead') ); + $this->runAfterConfigRead($a_prefix); } } } + function runAfterConfigRead($prefix) + { + if (in_array($prefix, $this->AfterConfigProcessed)) { + return ; + } + + $this->Application->HandleEvent( new kEvent($prefix . ':OnAfterConfigRead') ); + array_push($this->AfterConfigProcessed, $prefix); + } + /** * Reads unit (specified by $prefix) * option specified by $option Index: units/helpers/multilanguage_helper.php =================================================================== --- units/helpers/multilanguage_helper.php (revision 12973) +++ units/helpers/multilanguage_helper.php (working copy) @@ -129,7 +129,7 @@ if ($refresh && preg_match('/(.*)-cdata$/', $prefix, $regs)) { // call main item config to clone cdata table $this->Application->UnitConfigReader->loadConfig($regs[1]); - $this->Application->HandleEvent( new kEvent($prefix.':OnAfterConfigRead') ); + $this->Application->UnitConfigReader->runAfterConfigRead($prefix); } $table_name = $this->Application->getUnitOption($prefix, 'TableName');