1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

[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
This commit is contained in:
David King
2012-10-21 16:09:43 -04:00
committed by Igor Wiedler
parent ad3edf505a
commit cb2725dd5a
8 changed files with 856 additions and 50 deletions

View File

@@ -0,0 +1,38 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 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\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
class phpbb_di_pass_cron implements CompilerPassInterface
{
/**
* Modify the container before it is passed to the rest of the code
*
* @param ContainerBuilder $container ContainerBuilder object
* @return null
*/
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('cron.task_collection');
foreach ($container->findTaggedServiceIds('cron.task') as $id => $data)
{
$definition->addMethodCall('offsetSet', array(null, $id));
}
}
}