mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-09 04:48:53 +00:00
We cannot use container tags at run time if we are using a cached, compiled container object (i.e. phpbb_cache_container) so we have to load them beforehand. PHPBB3-11152
66 lines
1.1 KiB
PHP
66 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
*
|
|
* @package phpBB3
|
|
* @copyright (c) 2011 phpBB Group
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
*
|
|
*/
|
|
|
|
/**
|
|
* @ignore
|
|
*/
|
|
if (!defined('IN_PHPBB'))
|
|
{
|
|
exit;
|
|
}
|
|
|
|
use Symfony\Component\DependencyInjection\TaggedContainerInterface;
|
|
|
|
/**
|
|
* Provides cron manager with tasks
|
|
*
|
|
* Finds installed cron tasks and makes them available to the cron manager.
|
|
*
|
|
* @package phpBB3
|
|
*/
|
|
class phpbb_cron_task_provider implements IteratorAggregate
|
|
{
|
|
private $tasks;
|
|
|
|
public function __construct(phpbb_cron_task_collection $tasks, TaggedContainerInterface $container)
|
|
{
|
|
$this->tasks = $tasks;
|
|
$this->container = $container;
|
|
}
|
|
|
|
/**
|
|
* Retrieve an iterator over all items
|
|
*
|
|
* @return ArrayIterator An iterator for the array of cron tasks
|
|
*/
|
|
public function getIterator()
|
|
{
|
|
$tasks = array();
|
|
foreach ($this->tasks as $names)
|
|
{
|
|
foreach ($names as $name)
|
|
{
|
|
if (!$this->container->has($name))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
$task = $this->container->get($name);
|
|
if ($task instanceof phpbb_cron_task_base)
|
|
{
|
|
$task->set_name($name);
|
|
}
|
|
|
|
$tasks[] = $task;
|
|
}
|
|
}
|
|
|
|
return new ArrayIterator($tasks);
|
|
}
|
|
}
|