Skip to content

Commit

Permalink
Update killdeps
Browse files Browse the repository at this point in the history
  • Loading branch information
BurakBoz authored Jul 25, 2023
1 parent 6192f36 commit ce7c5ff
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions bin/killdeps
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,23 @@ function scanDirectory($directory, $useLockFile = false, $dryRun = false): void
if (is_dir($directory) && is_readable($directory))
{
checkAndDeleteFrom($directory, $useLockFile, $dryRun);

foreach ((@scandir($directory)) as $item)
$scan = @scandir($directory);
if($scan)
{
if ($item === '.' || $item === '..')
{
continue;
}
$path = $directory . DIRECTORY_SEPARATOR . $item;
if (is_dir($path))
foreach ($scan as $item)
{
$scanDirCount++;
// Skip recursive scan for vendor and node_modules paths
(!in_array(basename($path), ["vendor","node_modules"])) && checkAndDeleteFrom($path, $useLockFile, $dryRun);
scanDirectory($path, $useLockFile, $dryRun);
if ($item === '.' || $item === '..')
{
continue;
}
$path = $directory . DIRECTORY_SEPARATOR . $item;
if (is_dir($path))
{
$scanDirCount++;
// Skip recursive scan for vendor and node_modules paths
(!in_array(basename($path), ["vendor","node_modules"])) && checkAndDeleteFrom($path, $useLockFile, $dryRun);
scanDirectory($path, $useLockFile, $dryRun);
}
}
}
}
Expand Down

0 comments on commit ce7c5ff

Please sign in to comment.