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

Loading…
Cancel
Save