Index: branches/5.3.x/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r16181 -r16280 --- branches/5.3.x/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 16181) +++ branches/5.3.x/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 16280) @@ -1,6 +1,6 @@ directorySeparator = preg_quote(DIRECTORY_SEPARATOR); - $editor_path = explode('/', trim(EDITOR_PATH, '/')); - $this->skipFolders[] = array_pop($editor_path); // last of cmseditor folders + $this->skipFolders[] = basename(EDITOR_PATH); $this->moduleFolderRegExp = '#' . $this->directorySeparator . '(core|modules' . $this->directorySeparator . '.*?)' . $this->directorySeparator . '#'; @@ -199,9 +198,20 @@ } } else { - $this->findConfigFiles(FULL_PATH . DIRECTORY_SEPARATOR . 'core'); // search from "core" directory - $this->findConfigFiles($folder_path); // search from "modules" directory + /*if ( $this->Application->isDebugMode() ) { + $this->Application->Debugger->profileStart('fcf'); + }*/ + $this->findConfigFiles(FULL_PATH . DIRECTORY_SEPARATOR . 'core'); // Search from core directory. + $this->findConfigFiles($folder_path); // Search from modules directory. + + /*if ( $this->Application->isDebugMode() ) { + $this->Application->Debugger->profileFinish( + 'fcf', + 'findConfigFiles [' . count($this->configFiles) . ']' + ); + }*/ + if ( $cache ) { if ( $this->Application->isCachingType(CACHING_TYPE_MEMORY) ) { $this->Application->setCache('master:config_files', serialize($this->configFiles)); @@ -229,34 +239,31 @@ /** * Recursively searches for unit configs in given folder. * - * @param string $folder_path Path to the folder. - * @param int $level Deep level of the folder. + * @param string $folder_path Path to the folder. + * @param integer $level Deep level of the folder. * * @return void */ protected function findConfigFiles($folder_path, $level = 0) { - // if FULL_PATH = "/" ensure, that all "/" in $folderPath are not deleted + // If FULL_PATH = "/" ensure, that all "/" in $folder_path are not deleted. $reg_exp = '/^' . preg_quote(FULL_PATH, '/') . '/'; - $folder_path = preg_replace($reg_exp, '', $folder_path, 1); // this make sense, since $folderPath may NOT contain FULL_PATH + // This make sense, since $folder_path may NOT contain FULL_PATH. + $folder_path = preg_replace($reg_exp, '', $folder_path, 1); + $base_folder = FULL_PATH . $folder_path . DIRECTORY_SEPARATOR; $sub_folders = glob($base_folder . '*', GLOB_ONLYDIR); if ( !$sub_folders ) { return; } - if ( $level == 0 ) { - // don't scan Front-End themes because of extensive directory structure - $sub_folders = array_diff($sub_folders, array($base_folder . 'themes', $base_folder . 'tools')); - } - foreach ( $sub_folders as $full_path ) { $sub_folder = substr($full_path, strlen($base_folder)); - if ( in_array($sub_folder, $this->skipFolders) || preg_match('/^\./', $sub_folder) ) { - // don't scan skipped or hidden folders + if ( in_array($sub_folder, $this->skipFolders) || substr($sub_folder, 0, 1) == '.' ) { + // Don't scan skipped or hidden folders. continue; }