PHP开发笔记's Archiver

fangzhen 发表于 2011-1-20 09:52

dz 修改延时点击量更新的时间

dz6.0延时点击量更新的时间为1分钟,对于大网站来说这个数太大,所以需要优化,不然会死锁,具体修改如下:
function viewthread_updateviews() {
global $delayviewcount, $supe_pushstatusadd, $timestamp, $tablepre, $tid, $db, $adminid;
if(($delayviewcount == 1 || $delayviewcount == 3) && !$supe_pushstatusadd) {
  $logfile = './forumdata/cache/cache_threadviews.log';
  if(substr($timestamp, -1) == [color=red]'5'[/color]) {
   require_once DISCUZ_ROOT.'./include/misc.func.php';
   updateviews('threads', 'tid', 'views', $logfile);
  }
  if(@$fp = fopen(DISCUZ_ROOT.$logfile, 'a')) {
   fwrite($fp, "$tid\n");
   fclose($fp);
  } elseif($adminid == 1) {
   showmessage('view_log_invalid');
  }
} else {
  $db->query("UPDATE LOW_PRIORITY {$tablepre}threads SET views=views+1 $supe_pushstatusadd WHERE tid='$tid'", 'UNBUFFERED');
}
unset($supe_pushstatusadd);
}

[color=#ff0000]'5'[/color][color=black]按自身情况修改这个数就可以了。[/color]

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.