Setup : only scan necessary dirs for extensions

We were browsing the whole hierarchy but only the root module dir was needed
This could be slow (especially when developing with a .git dir)
This commit is contained in:
Pierre Goiffon
2019-11-18 16:20:17 +01:00
parent 5ae4f9ade8
commit 4042a12d39

View File

@@ -244,11 +244,13 @@ class iTopExtensionsMap
} }
/** /**
* Read (recursively) a directory to find if it contains extensions (or modules) * Read (recursively) a directory to find if it contains extensions (or modules)
*
* @param string $sSearchDir The directory to scan * @param string $sSearchDir The directory to scan
* @param string $sSource The 'source' value for the extensions found in this directory * @param string $sSource The 'source' value for the extensions found in this directory
* @param string|null $sParentExtensionId Not null if the directory is under a declared extension * @param string|null $sParentExtensionId Not null if the directory is under a declared extension
* @return boolean *
* @return boolean false if we cannot open dir
*/ */
protected function ReadDir($sSearchDir, $sSource, $sParentExtensionId = null) protected function ReadDir($sSearchDir, $sSource, $sParentExtensionId = null)
{ {
@@ -260,6 +262,8 @@ class iTopExtensionsMap
{ {
// We're not recursing, let's add the directory to the list of scanned dirs // We're not recursing, let's add the directory to the list of scanned dirs
$this->aScannedDirs[] = $sSearchDir; $this->aScannedDirs[] = $sSearchDir;
return true;
} }
$sExtensionId = null; $sExtensionId = null;
$aSubDirectories = array(); $aSubDirectories = array();