[ticket/15765] Inject parameter

PHPBB3-15765
This commit is contained in:
rubencm 2018-09-13 14:44:59 +00:00 committed by Marc Alexander
parent 6b337e0882
commit 116eb64755
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
2 changed files with 10 additions and 7 deletions

View file

@ -7,6 +7,7 @@ services:
- '@routing.delegated_loader' - '@routing.delegated_loader'
- '%core.php_ext%' - '%core.php_ext%'
- '%core.cache_dir%' - '%core.cache_dir%'
- '%debug.url_generator%'
router.listener: router.listener:
class: Symfony\Component\HttpKernel\EventListener\RouterListener class: Symfony\Component\HttpKernel\EventListener\RouterListener

View file

@ -83,13 +83,14 @@ class router implements RouterInterface
/** /**
* Construct method * Construct method
* *
* @param ContainerInterface $container DI container * @param ContainerInterface $container DI container
* @param resources_locator_interface $resources_locator Resources locator * @param resources_locator_interface $resources_locator Resources locator
* @param LoaderInterface $loader Resources loader * @param LoaderInterface $loader Resources loader
* @param string $php_ext PHP file extension * @param string $php_ext PHP file extension
* @param string $cache_dir phpBB cache directory * @param string $cache_dir phpBB cache directory
* @param string $debug_url_generator Debug url generator
*/ */
public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, $php_ext, $cache_dir) public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, $php_ext, $cache_dir, $debug_url_generator)
{ {
$this->container = $container; $this->container = $container;
$this->resources_locator = $resources_locator; $this->resources_locator = $resources_locator;
@ -97,6 +98,7 @@ class router implements RouterInterface
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$this->context = new RequestContext(); $this->context = new RequestContext();
$this->cache_dir = $cache_dir; $this->cache_dir = $cache_dir;
$this->debug_url_generator = $debug_url_generator;
} }
/** /**
@ -255,7 +257,7 @@ class router implements RouterInterface
{ {
try try
{ {
$cache = new ConfigCache("{$this->cache_dir}url_generator.{$this->php_ext}", $this->container->getParameter('debug.url_generator')); $cache = new ConfigCache("{$this->cache_dir}url_generator.{$this->php_ext}", $this->debug_url_generator);
if (!$cache->isFresh()) if (!$cache->isFresh())
{ {
$dumper = new PhpGeneratorDumper($this->get_routes()); $dumper = new PhpGeneratorDumper($this->get_routes());