Index: trunk/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -r4899 -r5340 --- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 4899) +++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 5340) @@ -17,6 +17,8 @@ var $ProcessAllConfigs = false; var $FinalStage = false; + var $StoreCache = false; + var $AfterConfigProcessed = array(); /** * Scan kernel and user classes @@ -72,6 +74,8 @@ $conn =& $this->Application->GetADODBConnection(); $conn->Query('REPLACE '.TABLE_PREFIX.'Cache (VarName, Data, Cached) VALUES ("configs_parsed", '.$conn->qstr(serialize($cache)).', '.adodb_mktime().')'); + $conn->Query('REPLACE '.TABLE_PREFIX.'Cache (VarName, Data, Cached) VALUES ("config_files", '.$conn->qstr(serialize($this->configFiles)).', '.adodb_mktime().')'); + unset($this->configFiles); } function RestoreParsedData() @@ -124,7 +128,7 @@ // disable config caching during installation $cache = false; } - + if ($cache) { $restored = $this->RestoreParsedData(); if ($restored) return; @@ -134,14 +138,10 @@ $this->includeConfigFiles($folderPath, $cache); $this->ParseConfigs(); - - if ($cache) { - $this->CacheParsedData(); - $conn =& $this->Application->GetADODBConnection(); - $conn->Query('REPLACE '.TABLE_PREFIX.'Cache (VarName, Data, Cached) VALUES ("config_files", '.$conn->qstr(serialize($this->configFiles)).', '.adodb_mktime().')'); - } - unset($this->configFiles); + // tell AfterConfigRead to store cache if neede + // can't store it here beacuse AfterConfigRead needs ability to change config data + $this->StoreCache = $cache; } function findConfigFiles($folderPath) @@ -211,8 +211,11 @@ // 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; } + if ($this->StoreCache) $this->CacheParsedData(); } /** @@ -314,7 +317,7 @@ if ($aggregate_tag['AggregateTo'] == $config['ParentPrefix']) { trigger_error('Depricated Aggregate Tag Usage [prefix: '.$config['Prefix'].'; AggregateTo: '.$aggregate_tag['AggregateTo'].'] use #PARENT# as AggregateTo value, where AggregateTo is same as ParentPrefix', E_USER_NOTICE); } - + if ($aggregate_tag['AggregateTo'] == '#PARENT#') { $aggregate_tag['AggregateTo'] = $config['ParentPrefix']; } @@ -441,7 +444,7 @@ if (isset($config) && $config) { // config file is included for 1st time -> save it's content for future processing $prefix = isset($config['Prefix']) ? $config['Prefix'] : ''; - + preg_match('/\/(.*)\//U', $filename, $rets); $config['ModuleFolder'] = $rets[1]; $config['BasePath'] = dirname(FULL_PATH.$filename); @@ -594,7 +597,7 @@ // at installation start no modules in db and kernel configs could not be read return true; } - + $module_found = false; if (!$this->Application->ModuleInfo) return false;