mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/11698] Moving all autoloadable files to phpbb/
PHPBB3-11698
This commit is contained in:
93
phpBB/phpbb/cron/task/core/prune_all_forums.php
Normal file
93
phpBB/phpbb/cron/task/core/prune_all_forums.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prune all forums cron task.
|
||||
*
|
||||
* It is intended to be invoked from system cron.
|
||||
* This task will find all forums for which pruning is enabled, and will
|
||||
* prune all forums as necessary.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
|
||||
{
|
||||
protected $phpbb_root_path;
|
||||
protected $php_ext;
|
||||
protected $config;
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $phpbb_root_path The root path
|
||||
* @param string $php_ext The PHP extension
|
||||
* @param phpbb_config $config The config
|
||||
* @param phpbb_db_driver $db The db connection
|
||||
*/
|
||||
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, phpbb_db_driver $db)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
if (!function_exists('auto_prune'))
|
||||
{
|
||||
include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext);
|
||||
}
|
||||
|
||||
$sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, forum_flags, prune_freq
|
||||
FROM ' . FORUMS_TABLE . "
|
||||
WHERE enable_prune = 1
|
||||
AND prune_next < " . time();
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['prune_days'])
|
||||
{
|
||||
auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']);
|
||||
}
|
||||
|
||||
if ($row['prune_viewed'])
|
||||
{
|
||||
auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']);
|
||||
}
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task can run, given current board configuration.
|
||||
*
|
||||
* This cron task will only run when system cron is utilised.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_runnable()
|
||||
{
|
||||
return (bool) $this->config['use_system_cron'];
|
||||
}
|
||||
}
|
163
phpBB/phpbb/cron/task/core/prune_forum.php
Normal file
163
phpBB/phpbb/cron/task/core/prune_forum.php
Normal file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prune one forum cron task.
|
||||
*
|
||||
* It is intended to be used when cron is invoked via web.
|
||||
* This task can decide whether it should be run using data obtained by viewforum
|
||||
* code, without making additional database queries.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements phpbb_cron_task_parametrized
|
||||
{
|
||||
protected $phpbb_root_path;
|
||||
protected $php_ext;
|
||||
protected $config;
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* If $forum_data is given, it is assumed to contain necessary information
|
||||
* about a single forum that is to be pruned.
|
||||
*
|
||||
* If $forum_data is not given, forum id will be retrieved via request_var
|
||||
* and a database query will be performed to load the necessary information
|
||||
* about the forum.
|
||||
*/
|
||||
protected $forum_data;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $phpbb_root_path The root path
|
||||
* @param string $php_ext The PHP extension
|
||||
* @param phpbb_config $config The config
|
||||
* @param phpbb_db_driver $db The db connection
|
||||
*/
|
||||
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, phpbb_db_driver $db)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Manually set forum data.
|
||||
*
|
||||
* @param array $forum_data Information about a forum to be pruned.
|
||||
*/
|
||||
public function set_forum_data($forum_data)
|
||||
{
|
||||
$this->forum_data = $forum_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
if (!function_exists('auto_prune'))
|
||||
{
|
||||
include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext);
|
||||
}
|
||||
|
||||
if ($this->forum_data['prune_days'])
|
||||
{
|
||||
auto_prune($this->forum_data['forum_id'], 'posted', $this->forum_data['forum_flags'], $this->forum_data['prune_days'], $this->forum_data['prune_freq']);
|
||||
}
|
||||
|
||||
if ($this->forum_data['prune_viewed'])
|
||||
{
|
||||
auto_prune($this->forum_data['forum_id'], 'viewed', $this->forum_data['forum_flags'], $this->forum_data['prune_viewed'], $this->forum_data['prune_freq']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task can run, given current board configuration.
|
||||
*
|
||||
* This cron task will not run when system cron is utilised, as in
|
||||
* such cases prune_all_forums task would run instead.
|
||||
*
|
||||
* Additionally, this task must be given the forum data, either via
|
||||
* the constructor or parse_parameters method.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_runnable()
|
||||
{
|
||||
return !$this->config['use_system_cron'] && $this->forum_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task should run now, because enough time
|
||||
* has passed since it was last run.
|
||||
*
|
||||
* Forum pruning interval is specified in the forum data.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function should_run()
|
||||
{
|
||||
return $this->forum_data['enable_prune'] && $this->forum_data['prune_next'] < time();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns parameters of this cron task as an array.
|
||||
* The array has one key, f, whose value is id of the forum to be pruned.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_parameters()
|
||||
{
|
||||
return array('f' => $this->forum_data['forum_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses parameters found in $request, which is an instance of
|
||||
* phpbb_request_interface.
|
||||
*
|
||||
* It is expected to have a key f whose value is id of the forum to be pruned.
|
||||
*
|
||||
* @param phpbb_request_interface $request Request object.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function parse_parameters(phpbb_request_interface $request)
|
||||
{
|
||||
$this->forum_data = null;
|
||||
if ($request->is_set('f'))
|
||||
{
|
||||
$forum_id = $request->variable('f', 0);
|
||||
|
||||
$sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, forum_flags, prune_freq
|
||||
FROM ' . FORUMS_TABLE . "
|
||||
WHERE forum_id = $forum_id";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
$this->forum_data = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
82
phpBB/phpbb/cron/task/core/queue.php
Normal file
82
phpBB/phpbb/cron/task/core/queue.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue cron task. Sends email and jabber messages queued by other scripts.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_cron_task_core_queue extends phpbb_cron_task_base
|
||||
{
|
||||
protected $phpbb_root_path;
|
||||
protected $php_ext;
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $phpbb_root_path The root path
|
||||
* @param string $php_ext The PHP extension
|
||||
* @param phpbb_config $config The config
|
||||
*/
|
||||
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
if (!class_exists('queue'))
|
||||
{
|
||||
include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext);
|
||||
}
|
||||
$queue = new queue();
|
||||
$queue->process();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task can run, given current board configuration.
|
||||
*
|
||||
* Queue task is only run if the email queue (file) exists.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_runnable()
|
||||
{
|
||||
return file_exists($this->phpbb_root_path . 'cache/queue.' . $this->php_ext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task should run now, because enough time
|
||||
* has passed since it was last run.
|
||||
*
|
||||
* The interval between queue runs is specified in board configuration.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function should_run()
|
||||
{
|
||||
return $this->config['last_queue_run'] < time() - $this->config['queue_interval_config'];
|
||||
}
|
||||
}
|
76
phpBB/phpbb/cron/task/core/tidy_cache.php
Normal file
76
phpBB/phpbb/cron/task/core/tidy_cache.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tidy cache cron task.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base
|
||||
{
|
||||
protected $config;
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param phpbb_config $config The config
|
||||
* @param phpbb_cache_driver_interface $cache The cache driver
|
||||
*/
|
||||
public function __construct(phpbb_config $config, phpbb_cache_driver_interface $cache)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->cache->tidy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task can run, given current board configuration.
|
||||
*
|
||||
* Tidy cache cron task runs if the cache implementation in use
|
||||
* supports tidying.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_runnable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task should run now, because enough time
|
||||
* has passed since it was last run.
|
||||
*
|
||||
* The interval between cache tidying is specified in board
|
||||
* configuration.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function should_run()
|
||||
{
|
||||
return $this->config['cache_last_gc'] < time() - $this->config['cache_gc'];
|
||||
}
|
||||
}
|
70
phpBB/phpbb/cron/task/core/tidy_database.php
Normal file
70
phpBB/phpbb/cron/task/core/tidy_database.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tidy database cron task.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base
|
||||
{
|
||||
protected $phpbb_root_path;
|
||||
protected $php_ext;
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $phpbb_root_path The root path
|
||||
* @param string $php_ext The PHP extension
|
||||
* @param phpbb_config $config The config
|
||||
*/
|
||||
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
if (!function_exists('tidy_database'))
|
||||
{
|
||||
include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext);
|
||||
}
|
||||
tidy_database();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task should run now, because enough time
|
||||
* has passed since it was last run.
|
||||
*
|
||||
* The interval between database tidying is specified in board
|
||||
* configuration.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function should_run()
|
||||
{
|
||||
return $this->config['database_last_gc'] < time() - $this->config['database_gc'];
|
||||
}
|
||||
}
|
104
phpBB/phpbb/cron/task/core/tidy_search.php
Normal file
104
phpBB/phpbb/cron/task/core/tidy_search.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tidy search cron task.
|
||||
*
|
||||
* Will only run when the currently selected search backend supports tidying.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
|
||||
{
|
||||
protected $phpbb_root_path;
|
||||
protected $php_ext;
|
||||
protected $auth;
|
||||
protected $config;
|
||||
protected $db;
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $phpbb_root_path The root path
|
||||
* @param string $php_ext The PHP extension
|
||||
* @param phpbb_auth $auth The auth
|
||||
* @param phpbb_config $config The config
|
||||
* @param phpbb_db_driver $db The db connection
|
||||
* @param phpbb_user $user The user
|
||||
*/
|
||||
public function __construct($phpbb_root_path, $php_ext, phpbb_auth $auth, phpbb_config $config, phpbb_db_driver $db, phpbb_user $user)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Select the search method
|
||||
$search_type = basename($this->config['search_type']);
|
||||
|
||||
// We do some additional checks in the module to ensure it can actually be utilised
|
||||
$error = false;
|
||||
$search = new $search_type($error, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user);
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$search->tidy();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task can run, given current board configuration.
|
||||
*
|
||||
* Search cron task is runnable in all normal use. It may not be
|
||||
* runnable if the search backend implementation selected in board
|
||||
* configuration does not exist.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_runnable()
|
||||
{
|
||||
// Select the search method
|
||||
$search_type = basename($this->config['search_type']);
|
||||
|
||||
return class_exists($search_type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task should run now, because enough time
|
||||
* has passed since it was last run.
|
||||
*
|
||||
* The interval between search tidying is specified in board
|
||||
* configuration.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function should_run()
|
||||
{
|
||||
return $this->config['search_last_gc'] < time() - $this->config['search_gc'];
|
||||
}
|
||||
}
|
63
phpBB/phpbb/cron/task/core/tidy_sessions.php
Normal file
63
phpBB/phpbb/cron/task/core/tidy_sessions.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tidy sessions cron task.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base
|
||||
{
|
||||
protected $config;
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param phpbb_config $config The config
|
||||
* @param phpbb_user $user The user
|
||||
*/
|
||||
public function __construct(phpbb_config $config, phpbb_user $user)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->user->session_gc();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task should run now, because enough time
|
||||
* has passed since it was last run.
|
||||
*
|
||||
* The interval between session tidying is specified in board
|
||||
* configuration.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function should_run()
|
||||
{
|
||||
return $this->config['session_last_gc'] < time() - $this->config['session_gc'];
|
||||
}
|
||||
}
|
84
phpBB/phpbb/cron/task/core/tidy_warnings.php
Normal file
84
phpBB/phpbb/cron/task/core/tidy_warnings.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tidy warnings cron task.
|
||||
*
|
||||
* Will only run when warnings are configured to expire.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base
|
||||
{
|
||||
protected $phpbb_root_path;
|
||||
protected $php_ext;
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $phpbb_root_path The root path
|
||||
* @param string $php_ext The PHP extension
|
||||
* @param phpbb_config $config The config
|
||||
*/
|
||||
public function __construct($phpbb_root_path, $php_ext, phpbb_config $config)
|
||||
{
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
if (!function_exists('tidy_warnings'))
|
||||
{
|
||||
include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext);
|
||||
}
|
||||
tidy_warnings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task can run, given current board configuration.
|
||||
*
|
||||
* If warnings are set to never expire, this cron task will not run.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_runnable()
|
||||
{
|
||||
return (bool) $this->config['warnings_expire_days'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task should run now, because enough time
|
||||
* has passed since it was last run.
|
||||
*
|
||||
* The interval between warnings tidying is specified in board
|
||||
* configuration.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function should_run()
|
||||
{
|
||||
return $this->config['warnings_last_gc'] < time() - $this->config['warnings_gc'];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user