[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/phpbb/cron/task/core/ -> tidy_database.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\cron\task\core;
  15  
  16  /**
  17  * Tidy database cron task.
  18  */
  19  class tidy_database extends \phpbb\cron\task\base
  20  {
  21      protected $phpbb_root_path;
  22      protected $php_ext;
  23      protected $config;
  24  
  25      /**
  26      * Constructor.
  27      *
  28      * @param string $phpbb_root_path The root path
  29      * @param string $php_ext The PHP file extension
  30      * @param \phpbb\config\config $config The config
  31      */
  32  	public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config)
  33      {
  34          $this->phpbb_root_path = $phpbb_root_path;
  35          $this->php_ext = $php_ext;
  36          $this->config = $config;
  37      }
  38  
  39      /**
  40      * Runs this cron task.
  41      *
  42      * @return null
  43      */
  44  	public function run()
  45      {
  46          if (!function_exists('tidy_database'))
  47          {
  48              include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext);
  49          }
  50          tidy_database();
  51      }
  52  
  53      /**
  54      * Returns whether this cron task should run now, because enough time
  55      * has passed since it was last run.
  56      *
  57      * The interval between database tidying is specified in board
  58      * configuration.
  59      *
  60      * @return bool
  61      */
  62  	public function should_run()
  63      {
  64          return $this->config['database_last_gc'] < time() - $this->config['database_gc'];
  65      }
  66  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1