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:
38
phpBB/includes/di/pass/cron.php
Normal file
38
phpBB/includes/di/pass/cron.php
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user