Browse Source

cache dir snap improve for old versions

master
filesite 4 months ago
parent
commit
74f695df34
  1. 9
      themes/beauty/controller/SiteController.php

9
themes/beauty/controller/SiteController.php

@ -172,6 +172,7 @@ Class SiteController extends Controller {
$msg = 'OK'; $msg = 'OK';
$url = ''; $url = '';
$img_id = ''; $img_id = '';
$size = 'orignal';
$cacheId = $this->post('cid', ''); $cacheId = $this->post('cid', '');
$cateId = $this->post('id', ''); $cateId = $this->post('id', '');
@ -192,6 +193,11 @@ Class SiteController extends Controller {
} }
} }
//弃用老版本数据格式,抛弃没有size属性的
if (!empty($cachedData) && empty($cachedData['size'])) {
$cachedData = null;
}
if (empty($cachedData)) { if (empty($cachedData)) {
//从缓存数据中获取目录的realpath //从缓存数据中获取目录的realpath
$cachedData = Common::getCacheFromFile($cacheId); $cachedData = Common::getCacheFromFile($cacheId);
@ -219,7 +225,8 @@ Class SiteController extends Controller {
if (!empty($cachedData)) { if (!empty($cachedData)) {
$url = $cachedData['snapshot']; $url = $cachedData['snapshot'];
$cacheSubDir = 'dir'; $cacheSubDir = 'dir';
Common::saveCacheToFile($cacheKey, compact('url', 'img_id'), $cacheSubDir); $size = 'vm';
Common::saveCacheToFile($cacheKey, compact('url', 'img_id', 'size'), $cacheSubDir);
} }
} }
}else { }else {

Loading…
Cancel
Save