cron_todayviews_daily.php 647 B

12345678910111213141516171819202122232425
  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_todayviews_daily.php 26812 2011-12-23 08:21:29Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $updateviews = array();
  12. $deltids = array();
  13. foreach(C::t('forum_threadaddviews')->fetch_all_order_by_tid(500) as $tid => $addview) {
  14. $deltids[$tid] = $updateviews[$addview['addviews']][] = $tid;
  15. }
  16. if($deltids) {
  17. C::t('forum_threadaddviews')->delete($deltids);
  18. }
  19. foreach($updateviews as $views => $tids) {
  20. C::t('forum_thread')->increase($tids, array('views' => $views), true);
  21. }
  22. ?>