解决XIUNO清空缓存后,今日注册用户、今日发帖、今天主题被清零BUG。
新建一个钩子文件model_runtime_init_end.php放在任何一个插件的hook目录内即可。
model_runtime_init_end.php代码如下:
-
<?php exit;
-
global $time;
-
$todaystarttime = strtotime(date('Y-m-d', $time));
-
$runtime['todayusers'] = user_count(array('create_date'=>array('>'=>$todaystarttime)));
-
$runtime['todayposts'] = post_count(array('create_date'=>array('>'=>$todaystarttime)));
-
$runtime['todaythreads'] = thread_count(array('create_date'=>array('>'=>$todaystarttime)));
-
$runtime['todayposts'] -= $runtime['todaythreads'];
-
$runtime['cron_1_last_date'] = $todaystarttime;
-
$runtime['cron_2_last_date'] = $todaystarttime;
-
cache_set('runtime', $runtime);
-
?>
如果当天已经清理过缓存,那么今日注册用户、今日发帖、今天主题记录已经被清空,当天统计的记录肯定是不准确的,所以从第二天起数字准确无误。
如果想当天就准确无误也是可以做到的,但没有什么意义。