|
|
@ -32,8 +32,11 @@ Class DirScanner { |
|
|
|
private $webRoot = '/content/'; //网站静态文件相对路径的根目录 |
|
|
|
private $webRoot = '/content/'; //网站静态文件相对路径的根目录 |
|
|
|
private $scanningDirLevel = 0; //当前扫描的目录深度 |
|
|
|
private $scanningDirLevel = 0; //当前扫描的目录深度 |
|
|
|
private $scanStartTime = 0; //扫描开始时间,单位:秒 |
|
|
|
private $scanStartTime = 0; //扫描开始时间,单位:秒 |
|
|
|
private $scanResults = array(); //目录扫描结果 |
|
|
|
private $scanResults = array(); //目录扫描结果 |
|
|
|
private $tree = array(); //目录扫描树形结构 |
|
|
|
private $tree = array(); //目录扫描树形结构 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private $maxFileNumber = 1000; //目录下最大文件数量支持 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $supportFileExtensions = array( //支持的文件类型 |
|
|
|
protected $supportFileExtensions = array( //支持的文件类型 |
|
|
@ -559,6 +562,7 @@ Class DirScanner { |
|
|
|
$nextLevels = $levels - $this->scanningDirLevel; |
|
|
|
$nextLevels = $levels - $this->scanningDirLevel; |
|
|
|
|
|
|
|
|
|
|
|
$files = scandir($dir); |
|
|
|
$files = scandir($dir); |
|
|
|
|
|
|
|
$counter = 0; |
|
|
|
foreach($files as $file) { |
|
|
|
foreach($files as $file) { |
|
|
|
if (in_array($file, $ignore_files) || !$this->isValid($file)) {continue;} |
|
|
|
if (in_array($file, $ignore_files) || !$this->isValid($file)) {continue;} |
|
|
|
|
|
|
|
|
|
|
@ -583,6 +587,8 @@ Class DirScanner { |
|
|
|
$branch = array_merge(['pid' => $pid], $branch); |
|
|
|
$branch = array_merge(['pid' => $pid], $branch); |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
|
|
|
|
if ($counter >= $this->maxFileNumber) {break;} //最大文件数量限制 |
|
|
|
|
|
|
|
|
|
|
|
$pathinfo = pathinfo($realpath); |
|
|
|
$pathinfo = pathinfo($realpath); |
|
|
|
$extension = strtolower($pathinfo['extension']); |
|
|
|
$extension = strtolower($pathinfo['extension']); |
|
|
|
if ( in_array($extension, $this->supportFileExtensions) ) { |
|
|
|
if ( in_array($extension, $this->supportFileExtensions) ) { |
|
|
@ -605,6 +611,8 @@ Class DirScanner { |
|
|
|
$this->scanResults[$branch['id']] = $branch; |
|
|
|
$this->scanResults[$branch['id']] = $branch; |
|
|
|
$tree[$branch['id']] = $branch; |
|
|
|
$tree[$branch['id']] = $branch; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$counter ++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|