mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 17:51:40 +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
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue