Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F847784
D114.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Apr 19, 5:42 PM
Size
3 KB
Mime Type
text/x-diff
Expires
Sun, Apr 20, 5:42 PM (18 m, 37 s)
Engine
blob
Format
Raw Data
Handle
602575
Attached To
D114: INP-1464 - Optimize unit config search
D114.diff
View Options
Index: branches/5.3.x/core/kernel/utility/unit_config_reader.php
===================================================================
--- branches/5.3.x/core/kernel/utility/unit_config_reader.php
+++ branches/5.3.x/core/kernel/utility/unit_config_reader.php
@@ -77,7 +77,7 @@
*
* @var array
*/
- protected $skipFolders = array('CVS', '.svn', 'admin_templates', 'libchart');
+ protected $skipFolders = array('CVS', '.svn', '.git', 'admin_templates', 'libchart', 'install');
/**
* Cloner.
@@ -95,8 +95,7 @@
$this->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,8 +198,19 @@
}
}
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) ) {
@@ -229,16 +239,18 @@
/**
* 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);
@@ -247,16 +259,11 @@
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;
}
Event Timeline
Log In to Comment