[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/phpbb/cron/task/core/ -> queue.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  * Queue cron task. Sends email and jabber messages queued by other scripts.
  18  */
  19  class queue 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 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 (!class_exists('queue'))
  47          {
  48              include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext);
  49          }
  50          $queue = new \queue();
  51          $queue->process();
  52      }
  53  
  54      /**
  55      * Returns whether this cron task can run, given current board configuration.
  56      *
  57      * Queue task is only run if the email queue (file) exists.
  58      *
  59      * @return bool
  60      */
  61  	public function is_runnable()
  62      {
  63          return file_exists($this->phpbb_root_path . 'cache/queue.' . $this->php_ext);
  64      }
  65  
  66      /**
  67      * Returns whether this cron task should run now, because enough time
  68      * has passed since it was last run.
  69      *
  70      * The interval between queue runs is specified in board configuration.
  71      *
  72      * @return bool
  73      */
  74  	public function should_run()
  75      {
  76          return $this->config['last_queue_run'] < time() - $this->config['queue_interval'];
  77      }
  78  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1