Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

prune_notifications.php

Zuletzt modifiziert: 09.10.2024, 12:55 - Dateigröße: 1.33 KiB


 01  <?php
 02  /**
 03  *
 04  * This file is part of the phpBB Forum Software package.
 05  *
 06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 07  * @license GNU General Public License, version 2 (GPL-2.0)
 08  *
 09  * 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  }
 62