|
楼主 |
发表于 2019-12-25 15:23:44
|
显示全部楼层
- function callback_formhash($input,&$filemtime){
- return replace_formhash($filemtime, $input);
- }
- function viewthread_loadcache() {
- global $_G;
- $_G['thread']['livedays'] = ceil((TIMESTAMP - $_G['thread']['dateline']) / 86400);
- $_G['thread']['lastpostdays'] = ceil((TIMESTAMP - $_G['thread']['lastpost']) / 86400);
- $threadcachemark = 100 - (
- $_G['thread']['digest'] * 20 +
- min($_G['thread']['views'] / max($_G['thread']['livedays'], 10) * 2, 50) +
- max(-10, (15 - $_G['thread']['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 {
- $start_time = microtime(TRUE);
- $filemtime = $threadcache['filemtime'];
- ob_start("callback_formhash");
- readfile($threadcache['filename']);
- viewthread_updateviews($_G['forum_thread']['threadtableid']);
- $updatetime = dgmdate($filemtime, 'Y-m-d H:i:s');
- $gzip = $_G['gzipcompress'] ? ', Gzip On' : '';
- echo '<script type="text/javascript">$("debuginfo") ? $("debuginfo").innerHTML = ", Updated at '.$updatetime.', Processed in '.sprintf("%0.6f", microtime(TRUE) - $start_time).' second(s)'.$gzip.'." : "";</script></body></html>';
- ob_end_flush();
- exit();
- }
- }
- }
复制代码 |
|