Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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_all_forums.php

Zuletzt modifiziert: 01.05.2026, 11:26 - Dateigröße: 2.60 KiB


 001  <?php
 002  /**
 003  *
 004  * This file is part of the phpBB Forum Software package.
 005  *
 006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 007  * @license GNU General Public License, version 2 (GPL-2.0)
 008  *
 009  * For full copyright and license information, please see
 010  * the docs/CREDITS.txt file.
 011  *
 012  */
 013   
 014  namespace phpbb\cron\task\core;
 015   
 016  /**
 017  * Prune all forums cron task.
 018  *
 019  * It is intended to be invoked from system cron.
 020  * This task will find all forums for which pruning is enabled, and will
 021  * prune all forums as necessary.
 022  */
 023  class prune_all_forums extends \phpbb\cron\task\base
 024  {
 025      protected $phpbb_root_path;
 026      protected $php_ext;
 027      protected $config;
 028      protected $db;
 029   
 030      /**
 031      * Constructor.
 032      *
 033      * @param string $phpbb_root_path The root path
 034      * @param string $php_ext The PHP file extension
 035      * @param \phpbb\config\config $config The config
 036      * @param \phpbb\db\driver\driver_interface $db The db connection
 037      */
 038      public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db)
 039      {
 040          $this->phpbb_root_path = $phpbb_root_path;
 041          $this->php_ext = $php_ext;
 042          $this->config = $config;
 043          $this->db = $db;
 044      }
 045   
 046      /**
 047      * Runs this cron task.
 048      *
 049      * @return null
 050      */
 051      public function run()
 052      {
 053          if (!function_exists('auto_prune'))
 054          {
 055              include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext);
 056          }
 057   
 058          $sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, enable_shadow_prune, prune_shadow_days, prune_shadow_freq, prune_shadow_next, forum_flags, prune_freq
 059              FROM ' . FORUMS_TABLE;
 060          $result = $this->db->sql_query($sql);
 061          while ($row = $this->db->sql_fetchrow($result))
 062          {
 063              $log_prune = true;
 064   
 065              if ($row['enable_prune'] && $row['prune_next'] < time())
 066              {
 067                  if ($row['prune_days'])
 068                  {
 069                      auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq'], $log_prune);
 070                      $log_prune = false;
 071                  }
 072   
 073                  if ($row['prune_viewed'])
 074                  {
 075                      auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq'], $log_prune);
 076                      $log_prune = false;
 077                  }
 078              }
 079   
 080              if ($row['enable_shadow_prune'] && $row['prune_shadow_next'] < time() && $row['prune_shadow_days'])
 081              {
 082                  auto_prune($row['forum_id'], 'shadow', $row['forum_flags'], $row['prune_shadow_days'], $row['prune_shadow_freq'], $log_prune);
 083              }
 084          }
 085          $this->db->sql_freeresult($result);
 086      }
 087   
 088      /**
 089      * Returns whether this cron task can run, given current board configuration.
 090      *
 091      * This cron task will only run when system cron is utilised.
 092      *
 093      * @return bool
 094      */
 095      public function is_runnable()
 096      {
 097          return (bool) $this->config['use_system_cron'];
 098      }
 099  }
 100