aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/cron/task/provider.php
diff options
context:
space:
mode:
authorDavid King <imkingdavid@gmail.com>2012-10-21 16:09:43 -0400
committerIgor Wiedler <igor@wiedler.ch>2012-11-10 11:40:49 +0100
commitcb2725dd5a04118de8628e10f940e926f4fa8fa1 (patch)
treecb79bf44756d029efe62cde8d3d98cf1ae00b5a3 /phpBB/includes/cron/task/provider.php
parentad3edf505a9e9ef7f139b033f70a1106539ce0de (diff)
downloadforums-cb2725dd5a04118de8628e10f940e926f4fa8fa1.tar
forums-cb2725dd5a04118de8628e10f940e926f4fa8fa1.tar.gz
forums-cb2725dd5a04118de8628e10f940e926f4fa8fa1.tar.bz2
forums-cb2725dd5a04118de8628e10f940e926f4fa8fa1.tar.xz
forums-cb2725dd5a04118de8628e10f940e926f4fa8fa1.zip
[feature/compiled-dic] Fix cron task loading
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
Diffstat (limited to 'phpBB/includes/cron/task/provider.php')
-rw-r--r--phpBB/includes/cron/task/provider.php27
1 files changed, 17 insertions, 10 deletions
diff --git a/phpBB/includes/cron/task/provider.php b/phpBB/includes/cron/task/provider.php
index 134723ebd1..08e54a651a 100644
--- a/phpBB/includes/cron/task/provider.php
+++ b/phpBB/includes/cron/task/provider.php
@@ -26,10 +26,11 @@ use Symfony\Component\DependencyInjection\TaggedContainerInterface;
*/
class phpbb_cron_task_provider implements IteratorAggregate
{
- private $container;
+ private $tasks;
- public function __construct(TaggedContainerInterface $container)
+ public function __construct(phpbb_cron_task_collection $tasks, TaggedContainerInterface $container)
{
+ $this->tasks = $tasks;
$this->container = $container;
}
@@ -40,18 +41,24 @@ class phpbb_cron_task_provider implements IteratorAggregate
*/
public function getIterator()
{
- $definitions = $this->container->findTaggedServiceIds('cron.task');
-
$tasks = array();
- foreach ($definitions as $name => $definition)
+ foreach ($this->tasks as $names)
{
- $task = $this->container->get($name);
- if ($task instanceof phpbb_cron_task_base)
+ foreach ($names as $name)
{
- $task->set_name($name);
- }
+ if (!$this->container->has($name))
+ {
+ continue;
+ }
- $tasks[] = $task;
+ $task = $this->container->get($name);
+ if ($task instanceof phpbb_cron_task_base)
+ {
+ $task->set_name($name);
+ }
+
+ $tasks[] = $task;
+ }
}
return new ArrayIterator($tasks);