Symlink breaks scanning
-
First of all, I love this plugin. This is my WordPress Windirstat or QDirstat (Mac)
In my WordPress on shared hosting @ Dreamhost, a symlinked folder are added automatically:
/user/USERNAME/domain.com/.dh-diag/
inside is dh-php-diags.php and another symlinked folder “diag”When scanning, Disk Usage Insights chokes on the folder and go into an endless loop.
Solution?
in plugins/disk-usage-insights/src/Domain/Collect/ScanDirForSubDirsJob.php$files = scandir($realDir) ?? [];
foreach ($files as $file) {
if ($file == '.' || $file == '..' || !is_dir($realDir . '/' . $file)) {
continue;
}
Replace the if withif ($file == '.' || $file == '..' || $file[0] === '.' || !is_dir($realDir . '/' . $file)) {in order to prevent folders starting with “.” a dot to be included. it is probably better to skip symlinked folders: (not tested yet)
if (
$file == '.' ||
$file == '..' ||
is_link($realDir . '/' . $file) ||
!is_dir($realDir . '/' . $file)
) {
continue;
}
Cheers!
DJ
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
You must be logged in to reply to this topic.