现在删帖操作是不会对板块的今日发帖数进行减操作的,但是有些网站编辑的奖金是通过板块的今日发帖数来进行核发的,所以站长在统计当日板块今日发帖数的时候必须要拿到准确的数据,所以有了这个工具的诞生,小功能献上~
打开template/admin/updatecache.htm文件,找到:
- <form action="$basename&" method=post>
- <input type="hidden" name=action value='usergroup'>
- <tr class="tr1 vt">
- <td class="td1">更新系统组成员头衔</td>
- <td class="td2"><span class="bt2"><span>
- <button type="submit">更 新</button>
- </span></span></td>
- <td class="td2"><div class="help_a">使用此功能可修复版主头衔错误和系统组头衔错误的问题</div></td>
- </tr>
- </form>
下方添加如下代码:
- <form action="$basename&" method=post>
- <input type="hidden" name=action value='forumtpost'>
- <tr class="tr1 vt">
- <td class="td1">更新当前板块今日发帖数</td>
- <td class="td2"><span class="bt2"><span>
- <button type="submit">更 新</button>
- </span></span></td>
- <td class="td2"><div class="help_a">使用此功能可修复当前所有板块最准确的今日发帖数</div></td>
- </tr>
- </form>
打开admin/aboutcache.php,找到:
- elseif($_POST['action'] == 'usergroup') {
- .....
- }
下方添加如下代码:
- elseif($action == 'forumtpost'){
- /**
- * 更新当前板块今日发帖数 by rickyleo
- */
- $forumTpost = $rt = $thread = array();
- $tdtime = PwStrtoTime(get_date($timestamp,'Y-m-d'));
-
- $query = $db->query("SELECT fid,tpost FROM pw_forumdata ORDER BY fid ASC");
- while ($rt = $db->fetch_array($query)){
- $threadQuery = $db->query("SELECT tid,ptable FROM pw_threads
- WHERE fid=".S::sqlEscape($rt['fid'])." AND postdate >= ".S::sqlEscape($tdtime));
- while ($thread = $db->fetch_array($threadQuery)){
- $tReply = 0;
- $postsTable = GetPtable($thread['ptable'], $thread['tid']);
- $tReply = $db->get_value("SELECT COUNT(*) AS count FROM ".S::sqlMetadata($postsTable)."
- WHERE tid=".S::sqlEscape($thread['tid'])." AND postdate >= ".S::sqlEscape($tdtime));
-
- $forumTpost[$rt['fid']] += 1+$tReply;
- }
- $db->free_result($threadQuery);
- }
- $db->free_result($query);
-
- foreach ($forumTpost AS $fid => $tpost){
- //$db->update("UPDATE pw_forumdata SET tpost=".S::sqlEscape($tpost)." WHERE fid=".S::sqlEscape($fid));
- pwQuery::update('pw_forumdata', 'fid=:fid', array($fid), array('tpost'=>$tpost));
- }
- unset($forumTpost);
-
- if (Perf::checkMemcache()){
- // 清除index页面的版块缓存
- $_cacheService = Perf::getCacheService();
- $_cacheService->delete('all_forums_info');
- // 清除thread页面版块缓存
- $query = $db->query('SELECT fid FROM pw_forumdata');
- while($rt = $db->fetch_array($query)){
- $_cacheService->delete('forumdata_announce_' . $rt['fid']);
- }
- }
- adminmsg('operate_success');
- }
功能在后台:
数据 » 全站缓存 缓存管理