public function ajax_clear() { /*写入应用列表缓存*/ $applist = $this->applications_db->listinfo('', '', 1, 100, 'appid'); setcache('applist', $applist); $applistinfo = getcacheinfo('applist'); $return['filesize'] = sizecount($applistinfo['filesize']); $return['filemtime'] = date('Y-m-d H:i:s', $applistinfo['filemtime']); exit(json_encode($return)); }
/** * ����ģ���ǩ���� * @param string $name ������ * @param integer $times ����ʱ�� */ function tpl_cache($name, $times = 0) { $filepath = 'tpl_data'; $info = getcacheinfo($name, $filepath); if (SYS_TIME - $info['filemtime'] >= $times) { return false; } else { return getcache($name, $filepath); } }
function deletethreadcaches($tids) { global $cachethreadon; if (!$cachethreadon) { return FALSE; } include_once DISCUZ_ROOT . './include/forum.func.php'; if (!empty($tids)) { foreach (explode(',', $tids) as $tid) { $fileinfo = getcacheinfo($tid); @unlink($fileinfo['filename']); } } return TRUE; }
function viewthread_loadcache() { global $_G; $_G['forum']['livedays'] = ceil((TIMESTAMP - $_G['forum']['dateline']) / 86400); $_G['forum']['lastpostdays'] = ceil((TIMESTAMP - $_G['forum']['lastthreadpost']) / 86400); $threadcachemark = 100 - ($_G['forum']['displayorder'] * 15 + $_G['thread']['digest'] * 10 + min($_G['thread']['views'] / max($_G['forum']['livedays'], 10) * 2, 50) + max(-10, 15 - $_G['forum']['lastpostdays']) + min($_G['thread']['replies'] / $_G['setting']['postperpage'] * 1.5, 15)); if ($threadcachemark < $_G['forum']['threadcaches']) { $threadcache = getcacheinfo($_G['tid']); if (TIMESTAMP - $threadcache['filemtime'] > $_G['setting']['cachethreadlife']) { @unlink($threadcache['filename']); define('CACHE_FILE', $threadcache['filename']); } else { readfile($threadcache['filename']); viewthread_updateviews($_G['forum_thread']['threadtableid']); $_G['setting']['debug'] && debuginfo(); $_G['setting']['debug'] ? die('<script type="text/javascript">document.getElementById("debuginfo").innerHTML = " ' . ($_G['setting']['debug'] ? 'Updated at ' . gmdate("H:i:s", $threadcache['filemtime'] + 3600 * 8) . ', Processed in ' . $debuginfo['time'] . ' second(s), ' . $debuginfo['queries'] . ' Queries' . ($_G['gzipcompress'] ? ', Gzip enabled' : '') : '') . '";</script>') : die; } } }
function deletethreadcaches($tids) { global $_G; if (!$_G['setting']['cachethreadon']) { return FALSE; } require_once libfile('function/forumlist'); if (!empty($tids)) { foreach (explode(',', $tids) as $tid) { $fileinfo = getcacheinfo($tid); @unlink($fileinfo['filename']); } } return TRUE; }
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: index_classics.inc.php 21260 2009-11-23 08:33:35Z monkey $ */ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } require_once DISCUZ_ROOT . './include/forum.func.php'; $discuz_action = 1; if ($cacheindexlife && !$discuz_uid && $showoldetails != 'yes' && (!$_DCACHE['settings']['frameon'] || $_DCACHE['settings']['frameon'] && $_GET['frameon'] != 'yes') && empty($gid)) { $indexcache = getcacheinfo(0); if ($timestamp - $indexcache['filemtime'] > $cacheindexlife) { @unlink($indexcache['filename']); define('CACHE_FILE', $indexcache['filename']); $styleid = $_DCACHE['settings']['styleid']; } elseif ($indexcache['filename']) { @readfile($indexcache['filename']); $debug && debuginfo(); $debug ? die('<script type="text/javascript">document.getElementById("debuginfo").innerHTML = " ' . ($debug ? 'Updated at ' . gmdate("H:i:s", $indexcache['filemtime'] + 3600 * 8) . ', Processed in ' . $debuginfo['time'] . ' second(s), ' . $debuginfo['queries'] . ' Queries' . ($gzipcompress ? ', Gzip enabled' : '') : '') . '";</script>') : die; } } if (isset($showoldetails)) { switch ($showoldetails) { case 'no': dsetcookie('onlineindex', 0, 86400 * 365); break; case 'yes':
function get_index_page_guest_cache() { global $_G; $indexcache = getcacheinfo(0); if (TIMESTAMP - $indexcache['filemtime'] > $_G['setting']['cacheindexlife']) { @unlink($indexcache['filename']); define('CACHE_FILE', $indexcache['filename']); } elseif ($indexcache['filename']) { @readfile($indexcache['filename']); $updatetime = dgmdate($indexcache['filemtime'], 'H:i:s'); $gzip = $_G['gzipcompress'] ? ', Gzip enabled' : ''; echo "<script type=\"text/javascript\">\r\n\t\t\tif(\$('debuginfo')) {\r\n\t\t\t\t\$('debuginfo').innerHTML = '. This page is cached at {$updatetime} {$gzip} .';\r\n\t\t\t}\r\n\t\t\t</script>"; exit; } }
function viewthread_loadcache() { global $tid, $forum, $timestamp, $cachethreadlife, $_DCACHE, $gzipcompress, $debug, $styleid; $forum['livedays'] = ceil(($timestamp - $forum['dateline']) / 86400); $forum['lastpostdays'] = ceil(($timestamp - $forum['lastthreadpost']) / 86400); $threadcachemark = 100 - ($forum['displayorder'] * 15 + $forum['digest'] * 10 + min($forum['views'] / max($forum['livedays'], 10) * 2, 50) + max(-10, 15 - $forum['lastpostdays']) + min($forum['replies'] / $_DCACHE['settings']['postperpage'] * 1.5, 15)); if ($threadcachemark < $forum['threadcaches']) { $threadcache = getcacheinfo($tid); if ($timestamp - $threadcache['filemtime'] > $cachethreadlife) { @unlink($threadcache['filename']); define('CACHE_FILE', $threadcache['filename']); $styleid = $_DCACHE['settings']['styleid']; @(include DISCUZ_ROOT . './forumdata/cache/style_' . $styleid . '.php'); } else { readfile($threadcache['filename']); viewthread_updateviews(); $debug && debuginfo(); $debug ? die('<script type="text/javascript">document.getElementById("debuginfo").innerHTML = " ' . ($debug ? 'Updated at ' . gmdate("H:i:s", $threadcache['filemtime'] + 3600 * 8) . ', Processed in ' . $debuginfo['time'] . ' second(s), ' . $debuginfo['queries'] . ' Queries' . ($gzipcompress ? ', Gzip enabled' : '') : '') . '";</script>') : die; } } }
function get_index_page_guest_cache() { global $_G; $indexcache = getcacheinfo(0); if (TIMESTAMP - $indexcache['filemtime'] > $_G['setting']['cacheindexlife']) { @unlink($indexcache['filename']); define('CACHE_FILE', $indexcache['filename']); $_G['setting']['styleid'] = $_G['cache']['settings']['styleid']; $styleid = $_G['setting']['styleid']; } elseif ($indexcache['filename']) { @readfile($indexcache['filename']); $_G['setting']['debug'] && debuginfo(); $_G['setting']['debug'] ? die('<script type="text/javascript">document.getElementById("debuginfo").innerHTML = " ' . ($_G['setting']['debug'] ? 'Updated at ' . gmdate("H:i:s", $indexcache['filemtime'] + 3600 * 8) . ', Processed in ' . $debuginfo['time'] . ' second(s), ' . $debuginfo['queries'] . ' Queries' . ($_G['gzipcompress'] ? ', Gzip enabled' : '') : '') . '";</script>') : die; } }