解决XIUNO清空缓存后,今日注册用户、今日发帖、今天主题被清零BUG

折腾 2023-3-10 2198

解决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);
    ?>

如果当天已经清理过缓存,那么今日注册用户、今日发帖、今天主题记录已经被清空,当天统计的记录肯定是不准确的,所以从第二天起数字准确无误.

──── 0人觉得很赞 ────
最新回复 (0)
    暂无回复,快来抢沙发吧

    暂无回复,快来抢沙发吧

返回