Browse Source

bug fix for file create time get

master
filesite 2 days ago
parent
commit
ca3f8e4e9e
  1. 23
      themes/beauty/controller/CommandController.php

23
themes/beauty/controller/CommandController.php

@ -180,6 +180,15 @@ eof;
foreach ($scanResults as $id => $item) { foreach ($scanResults as $id => $item) {
$hadScanedDirs = Common::getCache($cacheKey); $hadScanedDirs = Common::getCache($cacheKey);
if (!empty($item['filename'])) {
//保存所有文件到索引
$this->updateAllFilesCache($item);
//更新年份、月份时间索引
$this->updateDateIndex($item);
//更新没有拍摄时间的文件索引
$this->updateNoOriginalCtimeFiles($item);
}
if ( if (
!empty($item['filename']) !empty($item['filename'])
&& empty($item['original_ctime']) && empty($item['original_ctime'])
@ -200,18 +209,8 @@ eof;
$this->scanMediaFiles($item['realpath']); $this->scanMediaFiles($item['realpath']);
} }
$scanIndex ++;
if (!empty($item['filename'])) {
//保存所有文件到索引
$this->updateAllFilesCache($item);
//更新年份、月份时间索引
$this->updateDateIndex($item);
//更新没有拍摄时间的文件索引
$this->updateNoOriginalCtimeFiles($item);
}
//更新扫描进度 //更新扫描进度
$scanIndex ++;
$stats = $this->updateScanStats($dirpath, $scanTotal, $scanIndex); $stats = $this->updateScanStats($dirpath, $scanTotal, $scanIndex);
} }
@ -264,7 +263,7 @@ eof;
* {"y2024": {"m1": [id1, id2, ...], "m10": [id1, id2, ...]}} * {"y2024": {"m1": [id1, id2, ...], "m10": [id1, id2, ...]}}
*/ */
protected function updateDateIndex($file) { protected function updateDateIndex($file) {
$ctime = !empty($file['original_ctime']) ? $file['original_ctime'] : $file['fstat']['ctime']; $ctime = !empty($file['original_ctime']) ? $file['original_ctime'] : min($file['fstat']['mtime'], $file['fstat']['ctime']);
$cacheKey = $this->dateIndexCacheKey; $cacheKey = $this->dateIndexCacheKey;
$cacheData = Common::getCache($cacheKey); $cacheData = Common::getCache($cacheKey);

Loading…
Cancel
Save