Browse Source

add function to get create time of file stat

master
filesite 1 day ago
parent
commit
24a8b78e68
  1. 4
      plugins/Common.php
  2. 2
      themes/beauty/controller/CommandController.php
  3. 2
      themes/beauty/views/site/index.php

4
plugins/Common.php

@ -793,4 +793,8 @@ Class Common { @@ -793,4 +793,8 @@ Class Common {
return !empty(self::$cache[$key]) ? self::$cache[$key] : null;
}
public static function getFileCreateTime($file) {
return !empty($file['fstat']['mtime']) && !empty($file['fstat']['ctime']) ? min($file['fstat']['mtime'], $file['fstat']['ctime']) : 0;
}
}

2
themes/beauty/controller/CommandController.php

@ -263,7 +263,7 @@ eof; @@ -263,7 +263,7 @@ eof;
* {"y2024": {"m1": [id1, id2, ...], "m10": [id1, id2, ...]}}
*/
protected function updateDateIndex($file) {
$ctime = !empty($file['original_ctime']) ? $file['original_ctime'] : min($file['fstat']['mtime'], $file['fstat']['ctime']);
$ctime = !empty($file['original_ctime']) ? $file['original_ctime'] : Common::getFileCreateTime($file);
$cacheKey = $this->dateIndexCacheKey;
$cacheData = Common::getCache($cacheKey);

2
themes/beauty/views/site/index.php

@ -355,7 +355,7 @@ eof; @@ -355,7 +355,7 @@ eof;
}else {
$title = Common::getDateFromString($file['filename']); //根据文件名获取拍摄日期
if (empty($title) && !empty($file['fstat']['mtime']) && !empty($file['fstat']['ctime'])) {
$title = date('Y-m-d', min($file['fstat']['mtime'], $file['fstat']['ctime']));
$title = date('Y-m-d', Common::getFileCreateTime($file));
}
}

Loading…
Cancel
Save