31
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-05-31 20:50:48 +00:00

Merge pull request #216 from dryabov/patch-79

Fix detection of root directory as a library
This commit is contained in:
Denis Ryabov 2023-08-02 13:40:35 +03:00 committed by GitHub
commit 24712e7656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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