blob: 9994d707f28aa99caa6e53111d741dfbf56f5dc6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
<?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\Container;
/**
* 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 $container;
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)
{
$task = $this->container->get($name);
if ($task instanceof phpbb_cron_task_base) {
$task->set_name($name);
}
$tasks[] = $task;
}
return new ArrayIterator($tasks);
}
}
|