[VD:LocalFileSystem] perfomance tune _subdir() with ParentIterator

This commit is contained in:
nao-pon
2016-01-09 16:29:08 +09:00
parent 68042aa9dd
commit a2016b7c33
+9 -2
View File
@@ -548,8 +548,15 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {
protected function _subdirs($path) {
if (is_dir($path)) {
$path = strtr($path, array('[' => '\\[', ']' => '\\]', '*' => '\\*', '?' => '\\?'));
return (bool)glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR);
$dirItr = new ParentIterator(
new RecursiveDirectoryIterator($path,
FilesystemIterator::SKIP_DOTS |
(defined('RecursiveDirectoryIterator::FOLLOW_SYMLINKS')?
RecursiveDirectoryIterator::FOLLOW_SYMLINKS : 0)
)
);
$dirItr->rewind();
return $dirItr->hasChildren();
}
return false;
}