Add buttons to clear apcu and opcache

This commit is contained in:
Kijin Sung 2021-02-05 20:45:11 +09:00
parent 9160b867aa
commit 80b235001e
6 changed files with 53 additions and 2 deletions

View file

@ -153,6 +153,36 @@ class adminAdminController extends admin
$this->setMessage('success_updated');
}
/**
* Clear APCU cache
*/
public function procAdminClearApcu()
{
if (function_exists('apcu_clear_cache') && apcu_clear_cache())
{
return new BaseObject(0, 'success_updated');
}
else
{
return new BaseObject(-1, 'apcu_clear_cache_function_not_found');
}
}
/**
* Clear opcache
*/
public function procAdminClearOpcache()
{
if (function_exists('opcache_reset') && opcache_reset())
{
return new BaseObject(0, 'success_updated');
}
else
{
return new BaseObject(-1, 'opcache_reset_function_not_found');
}
}
/**
* Logout

View file

@ -985,6 +985,7 @@ class adminAdminView extends admin
}
natcasesort($info['widgetstyle']);
$info[] = '';
$str_info = '';
// Convert to string.
foreach ($info as $key => $value)

View file

@ -20,6 +20,8 @@
<action name="procAdminRemoveIcons" type="controller" />
<action name="procAdminRecompileCacheFile" type="controller" />
<action name="procAdminClearApcu" type="controller" />
<action name="procAdminClearOpcache" type="controller" />
<action name="procAdminLogout" type="controller" method="GET|POST" />
<action name="procAdminInsertDefaultDesignInfo" type="controller" />
<action name="procAdminToggleFavorite" type="controller" />

View file

@ -402,4 +402,6 @@ $lang->your_ip = 'Your IP';
$lang->sitelock_in_use = 'This site is locked.';
$lang->about_sitelock_in_use = 'Only the administrator and visitors from specified IP addresses can access this site.';
$lang->module_exists_in_wrong_path = 'Module(s) installed in incorrect path';
$lang->about_module_exists_in_wrong_path = 'The following module(s) appear to be installed in incorrect directories.<br />Please ignore this message if you have intentionally renamed a module for testing or debugging purposes.';
$lang->about_module_exists_in_wrong_path = 'The following module(s) appear to be installed in incorrect directories.<br />Please ignore this message if you have intentionally renamed a module for testing or debugging purposes.';
$lang->apcu_clear_cache_function_not_found = 'apcu is disabled on this server.';
$lang->opcache_reset_function_not_found = 'opcache is disabled on this server.';

View file

@ -398,4 +398,6 @@ $lang->your_ip = '접속하신 IP';
$lang->sitelock_in_use = '사이트 잠금 상태입니다.';
$lang->about_sitelock_in_use = '관리자 및 접속이 허용된 IP에서만 사이트 이용이 가능합니다.';
$lang->module_exists_in_wrong_path = '잘못된 경로에 설치된 모듈이 있습니다.';
$lang->about_module_exists_in_wrong_path = '아래의 모듈이 잘못된 경로에 설치된 것으로 보입니다. 설치 경로를 다시 확인하시기 바랍니다.<br />테스트나 오류 수정을 위해 임시로 모듈을 다른 경로에 옮겨놓으신 경우 이 메시지는 무시하셔도 됩니다.';
$lang->about_module_exists_in_wrong_path = '아래의 모듈이 잘못된 경로에 설치된 것으로 보입니다. 설치 경로를 다시 확인하시기 바랍니다.<br />테스트나 오류 수정을 위해 임시로 모듈을 다른 경로에 옮겨놓으신 경우 이 메시지는 무시하셔도 됩니다.';
$lang->apcu_clear_cache_function_not_found = 'apcu를 사용하지 않는 서버입니다.';
$lang->opcache_reset_function_not_found = 'opcache를 사용하지 않는 서버입니다.';

View file

@ -8,4 +8,18 @@
<section class="section">
<div class="server_env">{$str_info}</div>
<div class="server_env">[Tasks]<br /><a href="javascript:apcu_clear_cache()">apcu_clear_cache()</a><br /><a href="javascript:opcache_reset()">opcache_reset()</a></div>
</section>
<script>
function apcu_clear_cache() {
exec_json('admin.procAdminClearApcu', { }, function(data) {
alert(data.message);
});
}
function opcache_reset() {
exec_json('admin.procAdminClearOpcache', { }, function(data) {
alert(data.message);
});
}
</script>