[ Index ]

PHP Cross Reference of MyBB 1.8.38

title

Body

[close]

/inc/tasks/ -> hourlycleanup.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_hourlycleanup($task)
  12  {
  13      global $db, $lang, $plugins;
  14  
  15      $time = array(
  16          'threads' => TIME_NOW,
  17          'searchlog' => TIME_NOW-(60*60*24),
  18          'captcha' => TIME_NOW-(60*60*24),
  19          'question' => TIME_NOW-(60*60*24)
  20      );
  21  
  22      if(is_object($plugins))
  23      {
  24          $args = array(
  25              'task' => &$task,
  26              'time' => &$time
  27          );
  28          $plugins->run_hooks('task_hourlycleanup', $args);
  29      }
  30      
  31      require_once   MYBB_ROOT."inc/class_moderation.php";
  32      $moderation = new Moderation;
  33  
  34      // Delete moved threads with time limits
  35      $query = $db->simple_select('threads', 'tid', "deletetime != '0' AND deletetime < '".(int)$time['threads']."'");
  36      while($tid = $db->fetch_field($query, 'tid'))
  37      {
  38          $moderation->delete_thread($tid);
  39      }
  40  
  41      // Delete old searches
  42      $db->delete_query("searchlog", "dateline < '".(int)$time['searchlog']."'");
  43  
  44      // Delete old captcha images
  45      $cut = TIME_NOW-(60*60*24*7);
  46      $db->delete_query("captcha", "dateline < '".(int)$time['captcha']."'");
  47  
  48      // Delete old registration questions
  49      $cut = TIME_NOW-(60*60*24*7);
  50      $db->delete_query("questionsessions", "dateline < '".(int)$time['question']."'");
  51  
  52      add_task_log($task, $lang->task_hourlycleanup_ran);
  53  }


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