mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Add option to empty the contents of the cache dir, not delete it
files/cache 폴더에 다른 파티션이나 램디스크 등이 마운트되어 있는 경우 캐시파일 재생성시 폴더를 삭제할 수 없어 오작동하는 문제를 우회하기 위해 폴더 자체를 삭제하지 않고 내용만 비우는 옵션을 추가함.
This commit is contained in:
parent
b6aac0beac
commit
ae4fd85bfe
6 changed files with 58 additions and 5 deletions
|
|
@ -20,7 +20,9 @@ return array(
|
|||
'engine' => null,
|
||||
),
|
||||
),
|
||||
'cache' => array(),
|
||||
'cache' => array(
|
||||
'truncate_method' => 'delete',
|
||||
),
|
||||
'ftp' => array(
|
||||
'host' => 'localhost',
|
||||
'port' => 21,
|
||||
|
|
|
|||
|
|
@ -58,8 +58,25 @@ class adminAdminController extends admin
|
|||
function procAdminRecompileCacheFile()
|
||||
{
|
||||
// rename cache dir
|
||||
Rhymix\Framework\Storage::move(\RX_BASEDIR . 'files/cache', \RX_BASEDIR . 'files/cache_' . time());
|
||||
Rhymix\Framework\Storage::createDirectory(\RX_BASEDIR . 'files/cache');
|
||||
$truncate_method = Rhymix\Framework\Config::get('cache.truncate_method');
|
||||
if ($truncate_method === 'empty')
|
||||
{
|
||||
$tmp_basedir = \RX_BASEDIR . 'files/cache/truncate_' . time();
|
||||
Rhymix\Framework\Storage::createDirectory($tmp_basedir);
|
||||
$dirs = Rhymix\Framework\Storage::readDirectory(\RX_BASEDIR . 'files/cache', true, false, false);
|
||||
if ($dirs)
|
||||
{
|
||||
foreach ($dirs as $dir)
|
||||
{
|
||||
Rhymix\Framework\Storage::moveDirectory($dir, $tmp_basedir . '/' . basename($dir));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Rhymix\Framework\Storage::move(\RX_BASEDIR . 'files/cache', \RX_BASEDIR . 'files/cache_' . time());
|
||||
Rhymix\Framework\Storage::createDirectory(\RX_BASEDIR . 'files/cache');
|
||||
}
|
||||
|
||||
// remove module extend cache
|
||||
Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/config/module_extend.php');
|
||||
|
|
@ -90,14 +107,24 @@ class adminAdminController extends admin
|
|||
}
|
||||
|
||||
// remove old cache dir
|
||||
$tmp_cache_list = FileHandler::readDir(\RX_BASEDIR . 'files', '/^(cache_[0-9]+)/');
|
||||
if ($truncate_method === 'empty')
|
||||
{
|
||||
$tmp_cache_list = FileHandler::readDir(\RX_BASEDIR . 'files/cache', '/^(truncate_[0-9]+)/');
|
||||
$tmp_cache_prefix = \RX_BASEDIR . 'files/cache/';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmp_cache_list = FileHandler::readDir(\RX_BASEDIR . 'files', '/^(cache_[0-9]+)/');
|
||||
$tmp_cache_prefix = \RX_BASEDIR . 'files/';
|
||||
}
|
||||
|
||||
if($tmp_cache_list)
|
||||
{
|
||||
foreach($tmp_cache_list as $tmp_dir)
|
||||
{
|
||||
if(strval($tmp_dir) !== '')
|
||||
{
|
||||
$tmp_dir = \RX_BASEDIR . 'files/' . strval($tmp_dir);
|
||||
$tmp_dir = $tmp_cache_prefix . $tmp_dir;
|
||||
if (!Rhymix\Framework\Storage::isDirectory($tmp_dir))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -759,6 +786,12 @@ class adminAdminController extends admin
|
|||
Rhymix\Framework\Config::set('cache', array());
|
||||
}
|
||||
|
||||
// Cache truncate method
|
||||
if (in_array($vars->cache_truncate_method, array('delete', 'empty')))
|
||||
{
|
||||
Rhymix\Framework\Config::set('cache.truncate_method', $vars->cache_truncate_method);
|
||||
}
|
||||
|
||||
// Thumbnail settings
|
||||
$oDocumentModel = getModel('document');
|
||||
$document_config = $oDocumentModel->getDocumentConfig();
|
||||
|
|
|
|||
|
|
@ -508,6 +508,7 @@ class adminAdminView extends admin
|
|||
Context::set('object_cache_port', null);
|
||||
Context::set('object_cache_dbnum', 1);
|
||||
}
|
||||
Context::set('cache_truncate_method', Rhymix\Framework\Config::get('cache.truncate_method'));
|
||||
|
||||
// Thumbnail settings
|
||||
$oDocumentModel = getModel('document');
|
||||
|
|
|
|||
|
|
@ -168,6 +168,10 @@ $lang->cache_default_ttl = 'Cache default TTL';
|
|||
$lang->cache_host = 'Host';
|
||||
$lang->cache_port = 'Port';
|
||||
$lang->cache_dbnum = 'DB Number';
|
||||
$lang->cache_truncate_method = 'Cache Truncate Method';
|
||||
$lang->cache_truncate_method_delete = 'Delete cache folder itself';
|
||||
$lang->cache_truncate_method_empty = 'Delete content of cache folder';
|
||||
$lang->about_cache_truncate_method = 'It is faster and more reliable to delete the cache folder itself.<br />Choose the option to delete content only if the cache folder cannot be deleted, e.g. it is a mountpoint.';
|
||||
$lang->msg_cache_handler_not_supported = 'Your server does not support the selected cache method, or Rhymix is unable to use the cache with the given settings.';
|
||||
$lang->msg_invalid_default_url = 'The default URL is invalid.';
|
||||
$lang->msg_default_url_ssl_inconsistent = 'In order to use SSL always, the default URL must also begin with https://';
|
||||
|
|
|
|||
|
|
@ -169,6 +169,10 @@ $lang->cache_default_ttl = '캐시 기본 TTL';
|
|||
$lang->cache_host = '호스트';
|
||||
$lang->cache_port = '포트';
|
||||
$lang->cache_dbnum = 'DB번호';
|
||||
$lang->cache_truncate_method = '캐시 비우기 방법';
|
||||
$lang->cache_truncate_method_delete = '캐시 폴더를 삭제';
|
||||
$lang->cache_truncate_method_empty = '캐시 내용만 삭제';
|
||||
$lang->about_cache_truncate_method = '캐시 폴더를 삭제하는 방법이 더 빠르고 안정적입니다.<br />내용만 삭제하는 방법은 램디스크를 캐시 폴더로 사용하는 등 폴더 자체를 삭제해서는 안 되는 경우에만 선택하십시오.';
|
||||
$lang->msg_cache_handler_not_supported = '선택하신 캐시 방식을 서버에서 지원하지 않거나, 주어진 정보로 캐시에 접속할 수 없습니다.';
|
||||
$lang->msg_invalid_default_url = '기본 URL이 올바르지 않습니다.';
|
||||
$lang->msg_default_url_ssl_inconsistent = 'SSL을 항상 사용하실 경우 기본 URL도 https://로 시작해야 합니다.';
|
||||
|
|
|
|||
|
|
@ -172,6 +172,15 @@
|
|||
<input type="text" name="cache_default_ttl" id="cache_default_ttl" value="{$cache_default_ttl}" /> {$lang->unit_sec}
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->cache_truncate_method}</label>
|
||||
<div class="x_controls">
|
||||
<label for="cache_truncate_method_delete" class="x_inline"><input type="radio" name="cache_truncate_method" id="cache_truncate_method_delete" value="delete" checked="checked"|cond="$cache_truncate_method !== 'empty'" /> {$lang->cache_truncate_method_delete}</label>
|
||||
<label for="cache_truncate_method_empty" class="x_inline"><input type="radio" name="cache_truncate_method" id="cache_truncate_method_empty" value="empty" checked="checked"|cond="$cache_truncate_method === 'empty'" /> {$lang->cache_truncate_method_empty}</label>
|
||||
<br />
|
||||
<p class="x_help-block">{$lang->about_cache_truncate_method}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->minify_scripts}</label>
|
||||
<div class="x_controls">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue