[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/phpbb/cron/task/core/ -> prune_notifications.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  * Prune notifications cron task.
  18  */
  19  class prune_notifications extends \phpbb\cron\task\base
  20  {
  21      protected $config;
  22      protected $notification_manager;
  23  
  24      /**
  25      * Constructor.
  26      *
  27      * @param \phpbb\config\config $config The config
  28      * @param \phpbb\notification\manager $notification_manager Notification manager
  29      */
  30  	public function __construct(\phpbb\config\config $config, \phpbb\notification\manager $notification_manager)
  31      {
  32          $this->config = $config;
  33          $this->notification_manager = $notification_manager;
  34      }
  35  
  36      /**
  37      * {@inheritdoc}
  38      */
  39  	public function run()
  40      {
  41          // time minus expire days in seconds
  42          $timestamp = time() - ($this->config['read_notification_expire_days'] * 60 * 60 * 24);
  43          $this->notification_manager->prune_notifications($timestamp);
  44      }
  45  
  46      /**
  47      * {@inheritdoc}
  48      */
  49  	public function is_runnable()
  50      {
  51          return (bool) $this->config['read_notification_expire_days'];
  52      }
  53  
  54      /**
  55      * {@inheritdoc}
  56      */
  57  	public function should_run()
  58      {
  59          return $this->config['read_notification_last_gc'] < time() - $this->config['read_notification_gc'];
  60      }
  61  }


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