Index: trunk/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -r4845 -r4864 --- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 4845) +++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 4864) @@ -120,14 +120,19 @@ function scanModules($folderPath, $cache = true) { - if (!defined('IS_INSTALL') && $cache) { + if (defined('IS_INSTALL') && IS_INSTALL) { + // disable config caching during installation + $cache = false; + } + + if ($cache) { $restored = $this->RestoreParsedData(); if ($restored) return; } $this->ProcessAllConfigs = true; - $this->includeConfigFiles($folderPaths, $cache); + $this->includeConfigFiles($folderPath, $cache); $this->ParseConfigs(); $this->CacheParsedData(); @@ -146,13 +151,11 @@ $reg_exp = '/^'.preg_quote(FULL_PATH, '/').'/'; $folderPath = preg_replace($reg_exp, '', $folderPath, 1); // this make sense, since $folderPath may NOT contain FULL_PATH - $fh=opendir(FULL_PATH.$folderPath); - while(($sub_folder=readdir($fh))) - { + $fh = opendir(FULL_PATH.$folderPath); + while (($sub_folder = readdir($fh))) { $full_path = FULL_PATH.$folderPath.'/'.$sub_folder; - if( $this->isDir($full_path)) - { - if ( file_exists(FULL_PATH.$this->getConfigName($folderPath.'/'.$sub_folder)) ) { + if ($this->isDir($full_path)) { + if (file_exists(FULL_PATH.$this->getConfigName($folderPath.'/'.$sub_folder))) { $this->configFiles[] = $this->getConfigName($folderPath.'/'.$sub_folder); } $this->findConfigFiles($full_path); @@ -163,7 +166,7 @@ } } - function includeConfigFiles($folderPath, $cache=true) + function includeConfigFiles($folderPath, $cache = true) { $this->Application->refreshModuleInfo(); @@ -426,16 +429,23 @@ if($config_found) include_once(FULL_PATH.$filename); } - if($config_found && isset($config) && $config) - { - $prefix = isset($config['Prefix']) ? $config['Prefix'] : ''; - - preg_match('/\/(.*)\//U', $filename, $rets); - $config['ModuleFolder'] = $rets[1]; - $config['BasePath'] = dirname(FULL_PATH.$filename); - $this->configData[$prefix] = $config; - $this->prefixFiles[$prefix] = $filename; - return $prefix; + if ($config_found) { + 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); + $this->configData[$prefix] = $config; + $this->prefixFiles[$prefix] = $filename; + return $prefix; + } + elseif ($prefix = array_search($filename, $this->prefixFiles)) { + // attempt is made to include config file twice or more, but include_once prevents that, + // but file exists on hdd, then it is already saved to all required arrays, just return it's prefix + return $prefix; + } } return 'dummy'; }