diff --git a/module/admin/control.php b/module/admin/control.php index ff319be4ac..560aaf7625 100755 --- a/module/admin/control.php +++ b/module/admin/control.php @@ -614,4 +614,17 @@ class admin extends control $this->view->title = $this->lang->admin->cache; $this->display(); } + + /** + * 清除数据缓存。 + * Clear data cache. + * + * @access public + * @return void + */ + public function ajaxClearCache() + { + $this->dao->clearCache(); + return $this->send(array('result' => 'success', 'message' => $this->lang->admin->clearSuccess, 'load' => true)); + } } diff --git a/module/admin/lang/de.php b/module/admin/lang/de.php index 7a020634d4..a43d945734 100755 --- a/module/admin/lang/de.php +++ b/module/admin/lang/de.php @@ -53,9 +53,12 @@ $lang->admin->engineInfo = "The %s table engine is $lang->admin->engineSummary['hasMyISAM'] = "There are %s tables that are not InnoDB engines"; $lang->admin->engineSummary['allInnoDB'] = "All tables are InnoDB engines"; -$lang->admin->daoCache = 'DAO Cache'; +$lang->admin->daoCache = 'Data Cache'; +$lang->admin->clearCache = 'Clear'; +$lang->admin->clearSuccess = 'Cleared'; $lang->admin->memory = 'Memory'; $lang->admin->usedMemory = 'Total %s, %s used'; +$lang->admin->apcuNotice = 'Data cache is based on the PHP-APCu extension, which needs to be loaded before enabling.'; $lang->admin->apcuNotLoaded = 'Please load the APCu extension before enabling DAO cache'; $lang->admin->apcuNotEnabled = 'Please enable the apc.enabled option before enabling DAO cache'; diff --git a/module/admin/lang/en.php b/module/admin/lang/en.php index ab94a8601c..5a1a8f43a2 100755 --- a/module/admin/lang/en.php +++ b/module/admin/lang/en.php @@ -53,9 +53,12 @@ $lang->admin->engineInfo = "The %s table engine $lang->admin->engineSummary['hasMyISAM'] = "There are %s tables that are not InnoDB engines"; $lang->admin->engineSummary['allInnoDB'] = "All tables are InnoDB engines"; -$lang->admin->daoCache = 'DAO Cache'; +$lang->admin->daoCache = 'Data Cache'; +$lang->admin->clearCache = 'Clear'; +$lang->admin->clearSuccess = 'Cleared'; $lang->admin->memory = 'Memory'; $lang->admin->usedMemory = 'Total %s, %s used'; +$lang->admin->apcuNotice = 'Data cache is based on the PHP-APCu extension, which needs to be loaded before enabling.'; $lang->admin->apcuNotLoaded = 'Please load the APCu extension before enabling DAO cache'; $lang->admin->apcuNotEnabled = 'Please enable the apc.enabled option before enabling DAO cache'; diff --git a/module/admin/lang/fr.php b/module/admin/lang/fr.php index 66d0c726f4..ae1935b8e4 100755 --- a/module/admin/lang/fr.php +++ b/module/admin/lang/fr.php @@ -53,9 +53,12 @@ $lang->admin->engineInfo = "The %s table engine is $lang->admin->engineSummary['hasMyISAM'] = "There are %s tables that are not InnoDB engines"; $lang->admin->engineSummary['allInnoDB'] = "All tables are InnoDB engines"; -$lang->admin->daoCache = 'DAO Cache'; +$lang->admin->daoCache = 'Data Cache'; +$lang->admin->clearCache = 'Clear'; +$lang->admin->clearSuccess = 'Cleared'; $lang->admin->memory = 'Memory'; $lang->admin->usedMemory = 'Total %s, %s used'; +$lang->admin->apcuNotice = 'Data cache is based on the PHP-APCu extension, which needs to be loaded before enabling.'; $lang->admin->apcuNotLoaded = 'Please load the APCu extension before enabling DAO cache'; $lang->admin->apcuNotEnabled = 'Please enable the apc.enabled option before enabling DAO cache'; diff --git a/module/admin/lang/zh-cn.php b/module/admin/lang/zh-cn.php index 0d02496def..1014eff174 100755 --- a/module/admin/lang/zh-cn.php +++ b/module/admin/lang/zh-cn.php @@ -54,8 +54,11 @@ $lang->admin->engineSummary['hasMyISAM'] = "有%s个表不是InnoDB引擎"; $lang->admin->engineSummary['allInnoDB'] = "所有的表都是InnoDB引擎了"; $lang->admin->daoCache = '数据缓存'; +$lang->admin->clearCache = '清除缓存'; +$lang->admin->clearSuccess = '清除成功'; $lang->admin->memory = '内存使用'; $lang->admin->usedMemory = '总计 %s,已使用 %s'; +$lang->admin->apcuNotice = '数据缓存基于 PHP-APCu 扩展实现,开启前需要先加载 APCu 扩展。'; $lang->admin->apcuNotLoaded = '请加载 APCu 扩展后再开启数据缓存'; $lang->admin->apcuNotEnabled = '请启用 apc.enabled 选项后再开启数据缓存'; diff --git a/module/admin/ui/cache.html.php b/module/admin/ui/cache.html.php index e99cca7765..0bea985dca 100644 --- a/module/admin/ui/cache.html.php +++ b/module/admin/ui/cache.html.php @@ -12,6 +12,12 @@ namespace zin; formPanel ( + set::actions + ([ + 'submit', + $config->cache->dao->enable ? ['text' => $lang->admin->clearCache, 'url' => inlink('ajaxClearCache'), 'class' => 'secondary ajax-submit'] : null, + 'cancel' + ]), formGroup ( set::label($lang->admin->daoCache), @@ -21,7 +27,8 @@ formPanel set::items($lang->admin->cacheStatusList), set::value($config->cache->dao->enable), set::inline(true) - ) + ), + span(setClass('ml-4 mt-1.5'), icon('info text-warning mr-2'), $lang->admin->apcuNotice) ), helper::isAPCuEnabled() && $this->config->cache->dao->driver == 'Apcu' ? formRow (