论坛风格切换
  • 3760阅读
  • 1回复

[常用修复工具]更新修复板块今日发帖数 [复制链接]

上一主题 下一主题
离线rickyleo
 

发帖
315
金币
0
威望
99
只看楼主 倒序阅读 使用道具 楼主  发表于: 2012-03-27
现在删帖操作是不会对板块的今日发帖数进行减操作的,但是有些网站编辑的奖金是通过板块的今日发帖数来进行核发的,所以站长在统计当日板块今日发帖数的时候必须要拿到准确的数据,所以有了这个工具的诞生,小功能献上~
打开template/admin/updatecache.htm文件,找到:
  1. <form action="$basename&" method=post>
  2.       <input type="hidden" name=action value='usergroup'>
  3.       <tr class="tr1 vt">
  4.         <td class="td1">更新系统组成员头衔</td>
  5.         <td class="td2"><span class="bt2"><span>
  6.           <button type="submit">更 新</button>
  7.           </span></span></td>
  8.         <td class="td2"><div class="help_a">使用此功能可修复版主头衔错误和系统组头衔错误的问题</div></td>
  9.       </tr>
  10.     </form>
下方添加如下代码:
  1. <form action="$basename&" method=post>
  2.       <input type="hidden" name=action value='forumtpost'>
  3.       <tr class="tr1 vt">
  4.         <td class="td1">更新当前板块今日发帖数</td>
  5.         <td class="td2"><span class="bt2"><span>
  6.           <button type="submit">更 新</button>
  7.           </span></span></td>
  8.         <td class="td2"><div class="help_a">使用此功能可修复当前所有板块最准确的今日发帖数</div></td>
  9.       </tr>
  10.     </form>
打开admin/aboutcache.php,找到:
  1. elseif($_POST['action'] == 'usergroup') {
  2. .....
  3. }
下方添加如下代码:
  1. elseif($action == 'forumtpost'){
  2.         /**
  3.          * 更新当前板块今日发帖数 by rickyleo
  4.          */
  5.         $forumTpost = $rt = $thread = array();
  6.         $tdtime        = PwStrtoTime(get_date($timestamp,'Y-m-d'));
  7.         
  8.         $query = $db->query("SELECT fid,tpost FROM pw_forumdata ORDER BY fid ASC");
  9.         while ($rt = $db->fetch_array($query)){
  10.             $threadQuery = $db->query("SELECT tid,ptable FROM pw_threads
  11.                                        WHERE fid=".S::sqlEscape($rt['fid'])." AND postdate >= ".S::sqlEscape($tdtime));
  12.             while ($thread = $db->fetch_array($threadQuery)){
  13.                 $tReply = 0;
  14.                 $postsTable = GetPtable($thread['ptable'], $thread['tid']);
  15.                 $tReply = $db->get_value("SELECT COUNT(*) AS count FROM ".S::sqlMetadata($postsTable)."
  16.                                           WHERE tid=".S::sqlEscape($thread['tid'])." AND postdate >= ".S::sqlEscape($tdtime));
  17.                 
  18.                 $forumTpost[$rt['fid']] += 1+$tReply;
  19.             }
  20.             $db->free_result($threadQuery);
  21.         }
  22.         $db->free_result($query);
  23.         
  24.         foreach ($forumTpost AS $fid => $tpost){
  25.             //$db->update("UPDATE pw_forumdata SET tpost=".S::sqlEscape($tpost)." WHERE fid=".S::sqlEscape($fid));
  26.             pwQuery::update('pw_forumdata', 'fid=:fid', array($fid), array('tpost'=>$tpost));
  27.         }
  28.         unset($forumTpost);
  29.         
  30.         if (Perf::checkMemcache()){
  31.             // 清除index页面的版块缓存
  32.             $_cacheService = Perf::getCacheService();
  33.             $_cacheService->delete('all_forums_info');
  34.             // 清除thread页面版块缓存
  35.             $query = $db->query('SELECT fid FROM pw_forumdata');
  36.             while($rt = $db->fetch_array($query)){
  37.                 $_cacheService->delete('forumdata_announce_' . $rt['fid']);
  38.             }
  39.         }
  40.         adminmsg('operate_success');
  41.     }
功能在后台: 数据 » 全站缓存  缓存管理  





离线qhauapms

发帖
5
金币
0
威望
0
只看该作者 沙发  发表于: 2012-10-19
顶起来,支持楼主 顶~~~~~~~~~~~~~~~<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>祛痘印的小窍门
快速回复
限100 字节
批量上传需要先选择文件,再选择上传
 
提到某人:
选择好友
上一个 下一个