cache 생성 및 삭제 작업중

This commit is contained in:
gnuboard
2013-01-23 19:08:59 +09:00
parent 0a6c2102c3
commit 989b76a14c
6 changed files with 69 additions and 21 deletions

View File

@ -1,15 +1,15 @@
<?
$menu['menu100'] = array (
array('100000', '환경설정', ''.$g4['admin_path'].'/config_form.php', 'config'),
array('', '기본환경설정', ''.$g4['admin_path'].'/config_form.php', 'cf_basic'),
array('', '관리권한설정', ''.$g4['admin_path'].'/auth_list.php', 'cf_auth'),
array('100300', '메일 테스트', ''.$g4['admin_path'].'/sendmail_test.php', 'cf_mailtest'),
//array('100400', '버전정보', ''.$g4['admin_path'].'/version.php', 'cf_version'),
array('100000', '환경설정', $g4['admin_path'].'/config_form.php', 'config'),
array('', '기본환경설정', $g4['admin_path'].'/config_form.php', 'cf_basic'),
array('', '관리권한설정', $g4['admin_path'].'/auth_list.php', 'cf_auth'),
array('100300', '메일 테스트', $g4['admin_path'].'/sendmail_test.php', 'cf_mailtest'),
//array('100400', '버전정보', $g4['admin_path'].'/version.php', 'cf_version'),
array('100500', 'phpinfo()', ''.$g4['admin_path'].'/phpinfo.php', 'cf_phpinfo'),
//array('100600', '업그레이드', ''.$g4['admin_path'].'/upgrade.php', 'cf_upgrade'),
//array('100700', '복구/최적화', ''.$g4['admin_path'].'/repair.php', 'cf_repair'),
array('100800', '세션파일 일괄삭제', ''.$g4['admin_path'].'/session_delete.php', 'cf_delete'),
array('100900','캐쉬파일 일괄삭제','#', 'cf_cache'),
//array('100600', '업그레이드', $g4['admin_path'].'/upgrade.php', 'cf_upgrade'),
//array('100700', '복구/최적화', $g4['admin_path'].'/repair.php', 'cf_repair'),
array('100800', '세션파일 일괄삭제', $g4['admin_path'].'/session_file_delete.php', 'cf_session'),
array('100900','캐쉬파일 일괄삭제', $g4['admin_path'].'/cache_file_delete.php', 'cf_cache'),
//array('', 'phpMyAdmin', ''.$g4['path'].'/'.$g4['phpmyadmin_dir'].'', 'cf_phpmyadmin')
);
?>

47
adm/cache_file_delete.php Normal file
View File

@ -0,0 +1,47 @@
<?
$sub_menu = "100900";
include_once("./_common.php");
if ($is_admin != "super")
alert("최고관리자만 접근 가능합니다.", $g4[path]);
$g4['title'] = "캐시파일 일괄삭제";
include_once("./admin.head.php");
?>
<div id="cache_del">
<p>
완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오.
<p>
<span id="delete_message">
</span>
</div>
<?
include_once("./admin.tail.php");
flush();
if (!$dir=@opendir($g4['cache_latest_path'])) {
echo "최신글 캐시디렉토리를 열지못했습니다.";
}
$cnt=0;
while($file=readdir($dir)) {
if ($file=='.' || $file=='..') continue;
$cache_file = $g4['cache_latest_path'].'/'.$file;
if (!$atime=@fileatime($cache_file))
continue;
$cnt++;
$return = unlink($cache_file);
echo "<script>document.getElementById('delete_message').innerHTML += '{$cache_file}<br/>';</script>\n";
flush();
if ($cnt%10==0)
echo "<script>document.getElementById('delete_message').innerHTML = '';</script>\n";
}
echo "<script>document.getElementById('delete_message').innerHTML += '최신글 캐시파일 {$cnt}건 삭제 완료.<br><br>프로그램의 실행을 끝마치셔도 좋습니다.';</script>\n";
?>

View File

@ -21,29 +21,25 @@ include_once("./admin.head.php");
include_once("./admin.tail.php");
flush();
$session_path = "$g4[path]/data/session"; // 세션이저장된 디렉토리
if (!$dir=@opendir($session_path)) {
if (!$dir=@opendir($g4['session_path'])) {
echo "세션 디렉토리를 열지못했습니다.";
}
$cnt=0;
while($file=readdir($dir)) {
if (!strstr($file,'sess_')) {
continue;
}
if (!strstr($file,'sess_')) continue;
if (strpos($file,'sess_')!=0) continue;
if (strpos($file,'sess_')!=0) {
continue;
}
$session_file = $g4['session_path'].'/'.$file;
if (!$atime=@fileatime("$session_path/$file")) {
if (!$atime=@fileatime($session_file)) {
continue;
}
if (time() > $atime + (3600 * 6)) { // 지난시간을 초로 계산해서 적어주시면 됩니다. default : 6시간전
$cnt++;
$return = unlink("$session_path/$file");
echo "<script>document.getElementById('ct').innerHTML += '$session_path/$file<br/>';</script>\n";
$return = unlink($session_file);
echo "<script>document.getElementById('ct').innerHTML += '{$session_file}<br/>';</script>\n";
flush();

View File

@ -156,6 +156,7 @@ fieldset button:focus, .fieldset_submit:focus {padding:0 15px;height:23px;border
/* 메일 테스트, 세션파일일괄삭제 */
#fsendmailtest p,
#session_del p {margin-bottom:20px;padding:13px;border:1px solid #ced9de;background:#fff;font-size:0.75em}
#cache_del p {margin-bottom:20px;padding:13px;border:1px solid #ced9de;background:#fff;font-size:0.75em}
/* pagination */
.pg {clear:both;margin:0 0 10px;padding-top:20px;font-size:0.75em;text-align:center}

View File

@ -22,6 +22,9 @@ $g4['data_path'] = $g4['path'].'/'.$g4['data_dir'];
$g4['cache_dir'] = 'cache';
$g4['cache_path'] = $g4['data_path'].'/'.$g4['cache_dir'];
$g4['session_dir'] = 'session';
$g4['session_path'] = $g4['data_path'].'/'.$g4['session_dir'];
$g4['cache_latest_dir'] = $g4['cache_dir'].'/latest';
$g4['cache_member_dir'] = $g4['cache_dir'].'/member';
$g4['cache_captcha_dir'] = $g4['cache_dir'].'/captcha';

View File

@ -10,7 +10,8 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $options='')
$latest_skin_path = skin_path().'/latest/'.$skin_dir;
$cache_file = $g4['cache_latest_path']."/{$bo_table}_{$skin_dir}_{$rows}_{$subject_len}.php";
if (!file_exists($cache_file)) {
//if (!file_exists($cache_file)) {
if (0) {
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";