1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 03:54:10 +01:00

[feature/dic] Rewrite cron system to use DIC

PHPBB3-10739
This commit is contained in:
Igor Wiedler 2012-04-09 00:22:55 +02:00
parent 9165a045c5
commit 2e76620c88
16 changed files with 257 additions and 165 deletions

View File

@ -88,42 +88,43 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
// Set PHP error handler to ours
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/config'));
$phpbb_container = new ContainerBuilder();
$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/config'));
$loader->load('parameters.yml');
$loader->load('services.yml');
$container->setParameter('core.root_path', $phpbb_root_path);
$container->setParameter('core.php_ext', $phpEx);
$phpbb_container->setParameter('core.root_path', $phpbb_root_path);
$phpbb_container->setParameter('core.php_ext', $phpEx);
$phpbb_container->set('container', $phpbb_container);
// Setup class loader first
$phpbb_class_loader = $container->get('class_loader');
$phpbb_class_loader_ext = $container->get('class_loader.ext');
$phpbb_class_loader = $phpbb_container->get('class_loader');
$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext');
// set up caching
$cache = $container->get('cache');
$cache = $phpbb_container->get('cache');
// Instantiate some basic classes
$phpbb_dispatcher = $container->get('dispatcher');
$request = $container->get('request');
$user = $container->get('user');
$auth = $container->get('auth');
$db = $container->get('dbal.conn');
$phpbb_dispatcher = $phpbb_container->get('dispatcher');
$request = $phpbb_container->get('request');
$user = $phpbb_container->get('user');
$auth = $phpbb_container->get('auth');
$db = $phpbb_container->get('dbal.conn');
// make sure request_var uses this request instance
request_var('', 0, false, false, $request); // "dependency injection" for a function
// Grab global variables, re-cache if necessary
$config = $container->get('config');
$config = $phpbb_container->get('config');
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
// load extensions
$phpbb_extension_manager = $container->get('ext.manager');
$phpbb_subscriber_loader = $container->get('event.subscriber_loader');
$phpbb_extension_manager = $phpbb_container->get('ext.manager');
$phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader');
$template = $container->get('template');
$style = $container->get('style');
$template = $phpbb_container->get('template');
$style = $phpbb_container->get('style');
// Add own hook handler
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
@ -136,5 +137,5 @@ foreach ($cache->obtain_hooks() as $hook)
if (!$config['use_system_cron'])
{
$cron = $container->get('cron.manager');
$cron = $phpbb_container->get('cron.manager');
}

View File

@ -0,0 +1,72 @@
services:
cron.task.core.prune_all_forums:
class: phpbb_cron_task_core_prune_all_forums
arguments:
- %core.root_path%
- %core.php_ext%
- @config
- @dbal.conn
tags:
- { name: cron.task }
cron.task.core.prune_forum:
class: phpbb_cron_task_core_prune_forum
arguments:
- %core.root_path%
- %core.php_ext%
- @config
- @dbal.conn
tags:
- { name: cron.task }
cron.task.core.queue:
class: phpbb_cron_task_core_queue
arguments:
- %core.root_path%
- %core.php_ext%
- @config
tags:
- { name: cron.task }
cron.task.core.tidy_cache:
class: phpbb_cron_task_core_tidy_cache
arguments:
- @config
- @cache.driver
tags:
- { name: cron.task }
cron.task.core.tidy_database:
class: phpbb_cron_task_core_tidy_database
arguments:
- %core.root_path%
- %core.php_ext%
- @config
tags:
- { name: cron.task }
cron.task.core.tidy_search:
class: phpbb_cron_task_core_tidy_search
arguments:
- %core.root_path%
- %core.php_ext%
- @config
tags:
- { name: cron.task }
cron.task.core.tidy_sessions:
class: phpbb_cron_task_core_tidy_sessions
arguments:
- @config
- @user
tags:
- { name: cron.task }
cron.task.core.tidy_warnings:
class: phpbb_cron_task_core_tidy_warnings
arguments:
- %core.root_path%
- %core.php_ext%
- @config
tags:
- { name: cron.task }

View File

@ -1,3 +1,6 @@
imports:
- { resource: cron_tasks.yml }
services:
class_loader:
class: phpbb_class_loader
@ -107,7 +110,7 @@ services:
cron.task_provider:
class: phpbb_cron_task_provider
arguments:
- @ext.manager
- @container
cron.manager:
class: phpbb_cron_manager

View File

@ -44,23 +44,24 @@ if (isset($_GET['avatar']))
require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
$phpbb_container = new ContainerBuilder();
$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config'));
$loader->load('parameters.yml');
$loader->load('services.yml');
$container->setParameter('core.root_path', $phpbb_root_path);
$container->setParameter('core.php_ext', $phpEx);
$phpbb_container->setParameter('core.root_path', $phpbb_root_path);
$phpbb_container->setParameter('core.php_ext', $phpEx);
$phpbb_container->set('container', $phpbb_container);
$phpbb_class_loader = $container->get('class_loader');
$phpbb_class_loader_ext = $container->get('class_loader.ext');
$phpbb_class_loader = $phpbb_container->get('class_loader');
$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext');
// set up caching
$cache = $container->get('cache');
$cache = $phpbb_container->get('cache');
$phpbb_dispatcher = $container->get('dispatcher');
$request = $container->get('request');
$db = $container->get('dbal.conn');
$phpbb_dispatcher = $phpbb_container->get('dispatcher');
$request = $phpbb_container->get('request');
$db = $phpbb_container->get('dbal.conn');
// Connect to DB
if (!@$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false))
@ -71,13 +72,13 @@ if (isset($_GET['avatar']))
request_var('', 0, false, false, $request);
$config = $container->get('config');
$config = $phpbb_container->get('config');
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
// load extensions
$phpbb_extension_manager = $container->get('ext.manager');
$phpbb_subscriber_loader = $container->get('event.subscriber_loader');
$phpbb_extension_manager = $phpbb_container->get('ext.manager');
$phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader');
// worst-case default
$browser = strtolower($request->header('User-Agent', 'msie 6.0'));

View File

@ -35,26 +35,25 @@ class phpbb_cron_manager
/**
* Constructor. Loads all available tasks.
*
* @param array|Traversable $task_names Provides an iterable set of task names
* @param array|Traversable $tasks Provides an iterable set of task names
*/
public function __construct($task_names)
public function __construct($tasks)
{
$this->load_tasks($task_names);
$this->load_tasks($tasks);
}
/**
* Loads tasks given by name, wraps them
* and puts them into $this->tasks.
*
* @param array|Traversable $task_names Array of strings
* @param array|Traversable $tasks Array of instances of phpbb_cron_task
*
* @return void
*/
public function load_tasks($task_names)
public function load_tasks($tasks)
{
foreach ($task_names as $task_name)
foreach ($tasks as $task)
{
$task = new $task_name();
$wrapper = new phpbb_cron_task_wrapper($task);
$this->tasks[] = $wrapper;
}
@ -120,27 +119,4 @@ class phpbb_cron_manager
}
return null;
}
/**
* Creates an instance of parametrized cron task $name with args $args.
* The constructed task is wrapped with cron task wrapper before being returned.
*
* @param string $name The task name, which is the same as cron task class name.
* @param array $args Will be passed to the task class's constructor.
*
* @return phpbb_cron_task_wrapper|null
*/
public function instantiate_task($name, array $args)
{
$task = $this->find_task($name);
if ($task)
{
// task here is actually an instance of cron task wrapper
$class = $task->get_name();
$task = new $class($args);
// need to wrap the new task too
$task = new phpbb_cron_task_wrapper($task);
}
return $task;
}
}

View File

@ -26,6 +26,16 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
{
private $phpbb_root_path, $phpEx, $config, $db;
public function __construct($phpbb_root_path, $phpEx, phpbb_config $config, dbal $db)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = $phpEx;
$this->config = $config;
$this->db = $db;
}
/**
* Runs this cron task.
*
@ -33,19 +43,17 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
*/
public function run()
{
global $phpbb_root_path, $phpEx, $db;
if (!function_exists('auto_prune'))
{
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include($this->phpbb_root_path . 'includes/functions_admin.' . $this->phpEx);
}
$sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, forum_flags, prune_freq
FROM ' . FORUMS_TABLE . "
WHERE enable_prune = 1
WHERE enable_prune = 1
AND prune_next < " . time();
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
if ($row['prune_days'])
{
@ -57,7 +65,7 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']);
}
}
$db->sql_freeresult($result);
$this->db->sql_freeresult($result);
}
/**
@ -69,7 +77,6 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
*/
public function is_runnable()
{
global $config;
return (bool) $config['use_system_cron'];
return (bool) $this->config['use_system_cron'];
}
}

View File

@ -26,31 +26,25 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements phpbb_cron_task_parametrized
{
private $phpbb_root_path, $phpEx, $config, $db;
private $forum_data;
public function __construct($phpbb_root_path, $phpEx, phpbb_config $config, dbal $db)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = $phpEx;
$this->config = $config;
$this->db = $db;
}
/**
* Constructor.
*
* 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.
* Manually set forum data.
*
* @param array $forum_data Information about a forum to be pruned.
*/
public function __construct($forum_data = null)
public function set_forum_data($forum_data)
{
global $db;
if ($forum_data)
{
$this->forum_data = $forum_data;
}
else
{
$this->forum_data = null;
}
$this->forum_data = $forum_data;
}
/**
@ -60,10 +54,9 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
*/
public function run()
{
global $phpbb_root_path, $phpEx;
if (!function_exists('auto_prune'))
{
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include($this->phpbb_root_path . 'includes/functions_admin.' . $this->phpEx);
}
if ($this->forum_data['prune_days'])
@ -90,8 +83,7 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
*/
public function is_runnable()
{
global $config;
return !$config['use_system_cron'] && $this->forum_data;
return !$this->config['use_system_cron'] && $this->forum_data;
}
/**
@ -130,8 +122,6 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
*/
public function parse_parameters(phpbb_request_interface $request)
{
global $db;
$this->forum_data = null;
if ($request->is_set('f'))
{
@ -140,9 +130,9 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
$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 = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
if ($row)
{

View File

@ -22,6 +22,15 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_cron_task_core_queue extends phpbb_cron_task_base
{
private $phpbb_root_path, $phpEx, $config;
public function __construct($phpbb_root_path, $phpEx, phpbb_config $config)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = $phpEx;
$this->config = $config;
}
/**
* Runs this cron task.
*
@ -29,10 +38,9 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base
*/
public function run()
{
global $phpbb_root_path, $phpEx;
if (!class_exists('queue'))
{
include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->phpEx);
}
$queue = new queue();
$queue->process();
@ -47,8 +55,7 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base
*/
public function is_runnable()
{
global $phpbb_root_path, $phpEx;
return file_exists($phpbb_root_path . 'cache/queue.' . $phpEx);
return file_exists($this->phpbb_root_path . 'cache/queue.' . $this->phpEx);
}
/**
@ -61,7 +68,6 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base
*/
public function should_run()
{
global $config;
return $config['last_queue_run'] < time() - $config['queue_interval_config'];
return $this->config['last_queue_run'] < time() - $this->config['queue_interval_config'];
}
}

View File

@ -22,6 +22,14 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base
{
private $config, $cache;
public function __construct(phpbb_config $config, phpbb_cache_driver_interface $cache)
{
$this->config = $config;
$this->cache = $cache;
}
/**
* Runs this cron task.
*
@ -29,8 +37,7 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base
*/
public function run()
{
global $cache;
$cache->tidy();
$this->cache->tidy();
}
/**
@ -43,8 +50,7 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base
*/
public function is_runnable()
{
global $cache;
return method_exists($cache, 'tidy');
return method_exists($this->cache, 'tidy');
}
/**
@ -58,7 +64,6 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base
*/
public function should_run()
{
global $config;
return $config['cache_last_gc'] < time() - $config['cache_gc'];
return $this->config['cache_last_gc'] < time() - $this->config['cache_gc'];
}
}

View File

@ -22,6 +22,15 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base
{
private $phpbb_root_path, $phpEx, $config;
public function __construct($phpbb_root_path, $phpEx, phpbb_config $config)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = $phpEx;
$this->config = $config;
}
/**
* Runs this cron task.
*
@ -29,10 +38,9 @@ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base
*/
public function run()
{
global $phpbb_root_path, $phpEx;
if (!function_exists('tidy_database'))
{
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include($this->phpbb_root_path . 'includes/functions_admin.' . $this->phpEx);
}
tidy_database();
}
@ -48,7 +56,6 @@ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base
*/
public function should_run()
{
global $config;
return $config['database_last_gc'] < time() - $config['database_gc'];
return $this->config['database_last_gc'] < time() - $this->config['database_gc'];
}
}

View File

@ -24,6 +24,15 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
{
private $phpbb_root_path, $phpEx, $config;
public function __construct($phpbb_root_path, $phpEx, phpbb_config $config)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = $phpEx;
$this->config = $config;
}
/**
* Runs this cron task.
*
@ -31,14 +40,12 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
*/
public function run()
{
global $phpbb_root_path, $phpEx, $config, $error;
// Select the search method
$search_type = basename($config['search_type']);
$search_type = basename($this->config['search_type']);
if (!class_exists($search_type))
{
include("{$phpbb_root_path}includes/search/$search_type.$phpEx");
include($this->phpbb_root_path . "includes/search/$search_type." . $this->phpEx);
}
// We do some additional checks in the module to ensure it can actually be utilised
@ -62,12 +69,10 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
*/
public function is_runnable()
{
global $phpbb_root_path, $phpEx, $config;
// Select the search method
$search_type = basename($config['search_type']);
$search_type = basename($this->config['search_type']);
return file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx);
return file_exists($this->phpbb_root_path . 'includes/search/' . $search_type . '.' . $this->phpEx);
}
/**
@ -81,7 +86,6 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
*/
public function should_run()
{
global $config;
return $config['search_last_gc'] < time() - $config['search_gc'];
return $this->config['search_last_gc'] < time() - $this->config['search_gc'];
}
}

View File

@ -22,6 +22,14 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base
{
private $config, $user;
public function __construct(phpbb_config $config, phpbb_user $user)
{
$this->config = $config;
$this->user = $user;
}
/**
* Runs this cron task.
*
@ -29,8 +37,7 @@ class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base
*/
public function run()
{
global $user;
$user->session_gc();
$this->user->session_gc();
}
/**
@ -44,7 +51,6 @@ class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base
*/
public function should_run()
{
global $config;
return $config['session_last_gc'] < time() - $config['session_gc'];
return $this->config['session_last_gc'] < time() - $this->config['session_gc'];
}
}

View File

@ -24,6 +24,15 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base
{
private $phpbb_root_path, $phpEx, $config;
public function __construct($phpbb_root_path, $phpEx, phpbb_config $config)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = $phpEx;
$this->config = $config;
}
/**
* Runs this cron task.
*
@ -31,10 +40,9 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base
*/
public function run()
{
global $phpbb_root_path, $phpEx;
if (!function_exists('tidy_warnings'))
{
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include($this->phpbb_root_path . 'includes/functions_admin.' . $this->phpEx);
}
tidy_warnings();
}
@ -48,8 +56,7 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base
*/
public function is_runnable()
{
global $config;
return (bool) $config['warnings_expire_days'];
return (bool) $this->config['warnings_expire_days'];
}
/**
@ -63,7 +70,6 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base
*/
public function should_run()
{
global $config;
return $config['warnings_last_gc'] < time() - $config['warnings_gc'];
return $this->config['warnings_last_gc'] < time() - $this->config['warnings_gc'];
}
}

View File

@ -15,6 +15,8 @@ if (!defined('IN_PHPBB'))
exit;
}
use Symfony\Component\DependencyInjection\Container;
/**
* Provides cron manager with tasks
*
@ -22,27 +24,30 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
class phpbb_cron_task_provider extends phpbb_extension_provider
class phpbb_cron_task_provider implements IteratorAggregate
{
/**
* Finds cron task names using the extension manager.
*
* All PHP files in includes/cron/task/core/ are considered tasks. Tasks
* in extensions have to be located in a directory called cron or a subdir
* of a directory called cron. The class and filename must end in a _task
* suffix. Additionally all PHP files in includes/cron/task/core/ are
* tasks.
*
* @return array List of task names
*/
protected function find()
{
$finder = $this->extension_manager->get_finder();
private $container;
return $finder
->extension_suffix('_task')
->extension_directory('/cron')
->core_path('includes/cron/task/core/')
->get_classes();
public function __construct(Container $container)
{
$this->container = $container;
}
/**
* Retrieve an iterator over all items
*
* @return ArrayIterator An iterator for the array of cron tasks
*/
public function getIterator()
{
$definitions = $this->container->findTaggedServiceIds('cron.task');
$tasks = array();
foreach ($definitions as $name => $definition)
{
$tasks[] = $this->container->get($name);
}
return new ArrayIterator($tasks);
}
}

View File

@ -79,23 +79,24 @@ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
$phpbb_container = new ContainerBuilder();
$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config'));
$loader->load('parameters.yml');
$loader->load('services.yml');
$container->setParameter('core.root_path', $phpbb_root_path);
$container->setParameter('core.php_ext', $phpEx);
$container->setAlias('cache.driver.install', 'cache.driver');
$phpbb_container->setParameter('core.root_path', $phpbb_root_path);
$phpbb_container->setParameter('core.php_ext', $phpEx);
$phpbb_container->setAlias('cache.driver.install', 'cache.driver');
$phpbb_container->set('container', $phpbb_container);
$phpbb_class_loader = $container->get('class_loader');
$phpbb_class_loader_ext = $container->get('class_loader.ext');
$phpbb_class_loader = $phpbb_container->get('class_loader');
$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext');
// set up caching
$cache = $container->get('cache');
$cache = $phpbb_container->get('cache');
$phpbb_dispatcher = $container->get('dispatcher');
$request = $container->get('request');
$phpbb_dispatcher = $phpbb_container->get('dispatcher');
$request = $phpbb_container->get('request');
// make sure request_var uses this request instance
request_var('', 0, false, false, $request); // "dependency injection" for a function

View File

@ -193,7 +193,9 @@ if ($forum_data['forum_topics_per_page'])
// Do the forum Prune thang - cron type job ...
if (!$config['use_system_cron'])
{
$task = $cron->instantiate_task('cron_task_core_prune_forum', $forum_data);
$task = $container->get('cron.task.core.prune_forum');
$task = new phpbb_cron_task_wrapper($task);
$task->set_forum_data($forum_data);
if ($task && $task->is_ready())
{
$url = $task->get_url();