cron_todaypost_daily.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: cron_todaypost_daily.php 31920 2012-10-24 09:18:33Z zhengqingpeng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $yesterdayposts = intval(C::t('forum_forum')->fetch_sum_todaypost());
  12. C::t('forum_forum')->update_oldrank_and_yesterdayposts();
  13. $historypost = C::t('common_setting')->fetch('historyposts');
  14. $hpostarray = explode("\t", $historypost);
  15. $_G['setting']['historyposts'] = $hpostarray[1] < $yesterdayposts ? "$yesterdayposts\t$yesterdayposts" : "$yesterdayposts\t$hpostarray[1]";
  16. C::t('common_setting')->update('historyposts', $_G['setting']['historyposts']);
  17. $date = date('Y-m-d', TIMESTAMP - 86400);
  18. C::t('forum_statlog')->insert_stat_log($date);
  19. C::t('forum_forum')->clear_todayposts();
  20. $rank = 1;
  21. foreach(C::t('forum_statlog')->fetch_all_rank_by_logdate($date) as $value) {
  22. C::t('forum_forum')->update($value['fid'], array('rank' => $rank));
  23. $rank++;
  24. }
  25. savecache('historyposts', $_G['setting']['historyposts']);
  26. ?>