[ Index ]

PHP Cross Reference of MyBB

title

Body

[close]

/inc/tasks/ -> threadviews.php (source)

   1  <?php
   2  /**
   3   * MyBB 1.6
   4   * Copyright 2010 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://mybb.com
   7   * License: http://mybb.com/about/license
   8   *
   9   * $Id: threadviews.php 5297 2010-12-28 22:01:14Z Tomm $
  10   */
  11  
  12  function task_threadviews($task)
  13  {
  14      global $mybb, $db, $lang;
  15      
  16      $threadviews = array();
  17  
  18      if($mybb->settings['delayedthreadviews'] != 1)
  19      {
  20          return;
  21      }
  22  
  23      // Update thread views
  24      $query = $db->query("
  25          SELECT tid, COUNT(tid) AS views
  26          FROM ".TABLE_PREFIX."threadviews
  27          GROUP BY tid
  28      ");
  29      while($threadview = $db->fetch_array($query))
  30      {
  31          $db->update_query("threads", array('views' => "views+{$threadview['views']}"), "tid='{$threadview['tid']}'", 1, true);
  32      }
  33      
  34      $db->write_query("TRUNCATE TABLE ".TABLE_PREFIX."threadviews");
  35      
  36      add_task_log($task, $lang->task_threadviews_ran);
  37  }
  38  ?>


Generated: Tue Oct 8 19:19:50 2013 Cross-referenced by PHPXref 0.7.1