|
|
|
@ -128,15 +128,22 @@ Class SiteController extends Controller {
@@ -128,15 +128,22 @@ Class SiteController extends Controller {
|
|
|
|
|
|
|
|
|
|
//TODO: 清空所有缓存 |
|
|
|
|
public function actionCleancache() { |
|
|
|
|
$prefix = FSC::$app['config']['theme']; |
|
|
|
|
$cacheKey = "{$prefix}_allFilesTree"; |
|
|
|
|
Common::cleanFileCache($cacheKey); |
|
|
|
|
|
|
|
|
|
$cacheKey = "{$prefix}_allFilesData"; |
|
|
|
|
Common::cleanFileCache($cacheKey); |
|
|
|
|
|
|
|
|
|
$code = 1; |
|
|
|
|
$msg = 'OK'; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
$cacheDir = __DIR__ . '/../../../runtime/cache/'; |
|
|
|
|
$files = scandir($cacheDir); |
|
|
|
|
foreach($files as $file) { |
|
|
|
|
if (!preg_match('/\.json$/i', $file)) {continue;} |
|
|
|
|
|
|
|
|
|
unlink("{$cacheDir}{$file}"); |
|
|
|
|
} |
|
|
|
|
}catch(Exception $e) { |
|
|
|
|
$code = 0; |
|
|
|
|
$msg = '缓存清空失败:' . $e->getMessage(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $this->renderJson(compact('code', 'msg')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|