mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-09 10:16:36 +02:00
Merge remote-tracking branch 'upstream/develop' into ticket/11015
* upstream/develop: (196 commits) [ticket/11219] Coding guidelines and naming consistency changes [ticket/10841] Revert more whitespace changes. [ticket/10841] Revert whitespace changes. [ticket/10841] adding space after if [ticket/10841] removing unnecessary spacing [ticket/10841] changing affectedrows check to COUNT in sql [ticket/10841] Modifying style and language selectors in UCP [ticket/11247] Fix wrong property reference in flock class. [ticket/10602] Avoid a race condition. [ticket/10602] Use last_queue_run for its intended purpose. [ticket/10716] Collect standard error from executed php process. [ticket/10716] Skip test if php is not in PATH. [ticket/10716] Exclude our dependencies from linting. [ticket/10103] New and improved wording. [ticket/10716] Only lint on php 5.3+. [ticket/10103] Assert with messages. [ticket/10103] assertLessThan/assertGreaterThan. [ticket/10103] Inline assignment is bad? [ticket/10103] $rv had too few characters. [ticket/10103] Correct flock class documentation. ... Conflicts: phpBB/includes/functions.php tests/cache/cache_test.php
This commit is contained in:
@@ -49,7 +49,7 @@ class phpbb_di_extension_ext extends Extension
|
||||
{
|
||||
if (file_exists($path . '/config/services.yml'))
|
||||
{
|
||||
$loader = new YamlFileLoader($container, new FileLocator(phpbb_real_path($path . '/config')));
|
||||
$loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($path . '/config')));
|
||||
$loader->load('services.yml');
|
||||
}
|
||||
}
|
||||
|
68
phpBB/includes/di/pass/kernel_pass.php
Normal file
68
phpBB/includes/di/pass/kernel_pass.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?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_kernel_pass 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('dispatcher');
|
||||
|
||||
foreach ($container->findTaggedServiceIds('kernel.event_listener') as $id => $events)
|
||||
{
|
||||
foreach ($events as $event)
|
||||
{
|
||||
$priority = isset($event['priority']) ? $event['priority'] : 0;
|
||||
|
||||
if (!isset($event['event']))
|
||||
{
|
||||
throw new InvalidArgumentException(sprintf('Service "%1$s" must define the "event" attribute on "kernel.event_listener" tags.', $id));
|
||||
}
|
||||
|
||||
if (!isset($event['method']))
|
||||
{
|
||||
throw new InvalidArgumentException(sprintf('Service "%1$s" must define the "method" attribute on "kernel.event_listener" tags.', $id));
|
||||
}
|
||||
|
||||
$definition->addMethodCall('addListenerService', array($event['event'], array($id, $event['method']), $priority));
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($container->findTaggedServiceIds('kernel.event_subscriber') as $id => $attributes)
|
||||
{
|
||||
// We must assume that the class value has been correctly filled, even if the service is created by a factory
|
||||
$class = $container->getDefinition($id)->getClass();
|
||||
|
||||
$refClass = new ReflectionClass($class);
|
||||
$interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface';
|
||||
if (!$refClass->implementsInterface($interface))
|
||||
{
|
||||
throw new InvalidArgumentException(sprintf('Service "%1$s" must implement interface "%2$s".', $id, $interface));
|
||||
}
|
||||
|
||||
$definition->addMethodCall('addSubscriberService', array($id, $class));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user