|
|
|
@ -513,12 +513,24 @@ Class DirScanner {
@@ -513,12 +513,24 @@ Class DirScanner {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$branch = $this->getDirData($realpath, $files); |
|
|
|
|
|
|
|
|
|
//add parent directory's id |
|
|
|
|
$pid = $this->getId(realpath($dir)); |
|
|
|
|
if (!empty($pid)) { |
|
|
|
|
$branch = array_merge(['pid' => $pid], $branch); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
$pathinfo = pathinfo($realpath); |
|
|
|
|
$extension = strtolower($pathinfo['extension']); |
|
|
|
|
if ( in_array($extension, $this->supportFileExtensions) ) { |
|
|
|
|
if ($extension != 'txt') { |
|
|
|
|
$branch = $this->getFileData($realpath); |
|
|
|
|
|
|
|
|
|
//add parent directory's id |
|
|
|
|
$pid = $this->getId(realpath($dir)); |
|
|
|
|
if (!empty($pid)) { |
|
|
|
|
$branch = array_merge(['pid' => $pid], $branch); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
//把描述文件内容合并到被描述的目录或md文件数据中 |
|
|
|
|
$branch = $this->mergeDescriptionData($realpath); |
|
|
|
@ -569,10 +581,13 @@ Class DirScanner {
@@ -569,10 +581,13 @@ Class DirScanner {
|
|
|
|
|
if (!empty($item['description'])) { |
|
|
|
|
$dir['description'] = $item['description']; |
|
|
|
|
} |
|
|
|
|
if (!empty($item['pid'])) { |
|
|
|
|
$dir['pid'] = $item['pid']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($item['files'])) { |
|
|
|
|
$dirs = $this->getMenus($item['files']); |
|
|
|
|
if (!empty($item['directories'])) { |
|
|
|
|
$dirs = $this->getMenus($item['directories']); |
|
|
|
|
if (!empty($dirs)) { |
|
|
|
|
$dir['directories'] = $dirs; |
|
|
|
|
} |
|
|
|
|