[ Index ]

PHP Cross Reference of MyBB 1.8.38

title

Body

[close]

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

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


2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref