33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2025-01-06 15:53:55 +00:00

Fix detection of root directory as library

This commit is contained in:
Denis Ryabov 2023-08-02 14:38:55 +04:00
parent 83368f14ba
commit 5e452cfbd0

View File

@ -178,11 +178,12 @@ class JedcheckerRulesJexec extends JEDcheckerRule
* Collect php files to check (excluding external library directories) * Collect php files to check (excluding external library directories)
* *
* @param string $path The path of the folder to read. * @param string $path The path of the folder to read.
* @param int $level The current hierarchy level.
* *
* @return array * @return array
* @since 3.0 * @since 3.0
*/ */
protected function files($path) protected function files($path, $level = 0)
{ {
$arr = array(); $arr = array();
@ -197,6 +198,8 @@ class JedcheckerRulesJexec extends JEDcheckerRule
$fullpath = $path . '/' . $file; $fullpath = $path . '/' . $file;
if (is_dir($fullpath)) if (is_dir($fullpath))
{
if ($level > 0)
{ {
// Detect and skip external library directories // Detect and skip external library directories
foreach ($this->libFiles as $libFile) foreach ($this->libFiles as $libFile)
@ -207,8 +210,9 @@ class JedcheckerRulesJexec extends JEDcheckerRule
continue 2; continue 2;
} }
} }
}
$arr = array_merge($arr, $this->files($fullpath)); $arr = array_merge($arr, $this->files($fullpath, $level + 1));
} }
elseif (preg_match('/\.php$/', $file)) elseif (preg_match('/\.php$/', $file))
{ {