[ Index ]

PHP Cross Reference of phpBB-3.3.14-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 $cache_dir;
  24      protected $config;
  25  
  26      /**
  27       * Constructor.
  28       *
  29       * @param string $phpbb_root_path The root path
  30       * @param string $php_ext PHP file extension
  31       * @param \phpbb\config\config $config The config
  32       * @param string $cache_dir phpBB cache directory
  33       */
  34  	public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, $cache_dir)
  35      {
  36          $this->phpbb_root_path = $phpbb_root_path;
  37          $this->php_ext = $php_ext;
  38          $this->config = $config;
  39          $this->cache_dir = $cache_dir;
  40      }
  41  
  42      /**
  43      * Runs this cron task.
  44      *
  45      * @return null
  46      */
  47  	public function run()
  48      {
  49          if (!class_exists('queue'))
  50          {
  51              include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext);
  52          }
  53          $queue = new \queue();
  54          $queue->process();
  55      }
  56  
  57      /**
  58      * Returns whether this cron task can run, given current board configuration.
  59      *
  60      * Queue task is only run if the email queue (file) exists.
  61      *
  62      * @return bool
  63      */
  64  	public function is_runnable()
  65      {
  66          return file_exists($this->cache_dir . 'queue.' . $this->php_ext);
  67      }
  68  
  69      /**
  70      * Returns whether this cron task should run now, because enough time
  71      * has passed since it was last run.
  72      *
  73      * The interval between queue runs is specified in board configuration.
  74      *
  75      * @return bool
  76      */
  77  	public function should_run()
  78      {
  79          return $this->config['last_queue_run'] < time() - $this->config['queue_interval'];
  80      }
  81  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1