|
|
@ -117,12 +117,17 @@ eof; |
|
|
|
echo "{$botLogPrefix} Main bot started @{$thisTime}\n"; |
|
|
|
echo "{$botLogPrefix} Main bot started @{$thisTime}\n"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$menus = array(); //菜单,一级目录 |
|
|
|
//$menus = array(); //菜单,一级目录 |
|
|
|
$htmlReadme = array(); //Readme.md 内容,底部网站详细介绍 |
|
|
|
//$htmlReadme = array(); //Readme.md 内容,底部网站详细介绍 |
|
|
|
$htmlCateReadme = ''; //当前目录下的Readme.md 内容 |
|
|
|
//$htmlCateReadme = ''; //当前目录下的Readme.md 内容 |
|
|
|
$menus_sorted = array(); //Readme_sort.txt 说明文件内容,一级目录菜单从上到下的排序 |
|
|
|
//$menus_sorted = array(); //Readme_sort.txt 说明文件内容,一级目录菜单从上到下的排序 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (true) { |
|
|
|
|
|
|
|
$time = date('Y-m-d H:i:s'); |
|
|
|
|
|
|
|
echo "{$botLogPrefix} {$time}\n"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$statsFile = __DIR__ . '/../../../runtime/cache/stats_scan.json'; |
|
|
|
|
|
|
|
if (!file_exists($statsFile)) { |
|
|
|
//执行一次扫描任务 |
|
|
|
//执行一次扫描任务 |
|
|
|
$this->cleanScanCaches(); |
|
|
|
$this->cleanScanCaches(); |
|
|
|
$this->scanMediaFiles(); |
|
|
|
$this->scanMediaFiles(); |
|
|
@ -132,15 +137,23 @@ eof; |
|
|
|
$this->saveAllFilesIntoCacheFile(); |
|
|
|
$this->saveAllFilesIntoCacheFile(); |
|
|
|
//缓存所有目录的文件数量 |
|
|
|
//缓存所有目录的文件数量 |
|
|
|
$this->saveDirCounter(); |
|
|
|
$this->saveDirCounter(); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
$json = file_get_contents($statsFile); |
|
|
|
|
|
|
|
$stats = json_decode($json, true); |
|
|
|
|
|
|
|
if ($stats['status'] == 'running') { |
|
|
|
|
|
|
|
echo "{$botLogPrefix} It's already running...\n"; |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
$date = date('Y-m-d H:i:s', $stats['updatetime']); |
|
|
|
|
|
|
|
echo "{$botLogPrefix} It's finished at {$date}.\n"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}catch(Exception $e) { |
|
|
|
|
|
|
|
echo "{$botLogPrefix} Exception: " . $e->getMessage(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//按年、月保存文件数据,以便按年、月显示 |
|
|
|
sleep(10); |
|
|
|
|
|
|
|
} |
|
|
|
//while (true) { |
|
|
|
|
|
|
|
//$time = date('Y-m-d H:i:s'); |
|
|
|
|
|
|
|
//echo "{$botLogPrefix} {$time}\n"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//sleep(3); |
|
|
|
|
|
|
|
//} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//清空内存中的临时缓存数据 |
|
|
|
//清空内存中的临时缓存数据 |
|
|
@ -294,6 +307,7 @@ eof; |
|
|
|
|
|
|
|
|
|
|
|
//保存进度文件 |
|
|
|
//保存进度文件 |
|
|
|
file_put_contents($statsFile, json_encode($stats) . "\n"); |
|
|
|
file_put_contents($statsFile, json_encode($stats) . "\n"); |
|
|
|
|
|
|
|
chmod($statsFile, 0777); |
|
|
|
}else if (file_exists($statsFile)) { //更新当前扫描目录 |
|
|
|
}else if (file_exists($statsFile)) { //更新当前扫描目录 |
|
|
|
$json = file_get_contents($statsFile); |
|
|
|
$json = file_get_contents($statsFile); |
|
|
|
if (!empty($json)) { |
|
|
|
if (!empty($json)) { |
|
|
|