aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/routing
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-11-25 12:23:16 +0100
committerTristan Darricau <github@nicofuma.fr>2014-11-25 12:23:16 +0100
commitfd94027b40184b4c9eae10c6e5c1f8bee2c2a974 (patch)
treeddefa50e6be104b77f7834a3dcb8d97bdb0cedaf /phpBB/phpbb/routing
parent11c9d11482d28bf0ac193ea8c5ac0dd9695162e1 (diff)
downloadforums-fd94027b40184b4c9eae10c6e5c1f8bee2c2a974.tar
forums-fd94027b40184b4c9eae10c6e5c1f8bee2c2a974.tar.gz
forums-fd94027b40184b4c9eae10c6e5c1f8bee2c2a974.tar.bz2
forums-fd94027b40184b4c9eae10c6e5c1f8bee2c2a974.tar.xz
forums-fd94027b40184b4c9eae10c6e5c1f8bee2c2a974.zip
[ticket/13372] Fix Url Generator/Matcher generation
PHPBB3-13372
Diffstat (limited to 'phpBB/phpbb/routing')
-rw-r--r--phpBB/phpbb/routing/router.php45
1 files changed, 17 insertions, 28 deletions
diff --git a/phpBB/phpbb/routing/router.php b/phpBB/phpbb/routing/router.php
index 1003708540..c9c50534a2 100644
--- a/phpBB/phpbb/routing/router.php
+++ b/phpBB/phpbb/routing/router.php
@@ -13,6 +13,7 @@
namespace phpbb\routing;
+use Symfony\Component\Config\ConfigCache;
use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper;
use Symfony\Component\Routing\Matcher\UrlMatcher;
@@ -232,14 +233,7 @@ class router implements RouterInterface
return $this->matcher;
}
- if (defined('DEBUG'))
- {
- $this->create_new_url_matcher();
- }
- else
- {
- $this->create_dumped_url_matcher();
- }
+ $this->create_dumped_url_matcher();
return $this->matcher;
}
@@ -248,21 +242,22 @@ class router implements RouterInterface
*/
protected function create_dumped_url_matcher()
{
- if (!file_exists($this->phpbb_root_path . 'cache/url_matcher.' . $this->php_ext))
+ $cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_matcher.{$this->php_ext}", defined('DEBUG'));
+ if (!$cache->isFresh())
{
$dumper = new PhpMatcherDumper($this->get_routes());
$options = array(
- 'class' => 'phpbb_url_matcher',
+ 'class' => 'phpbb_url_matcher',
+ 'base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher',
);
- $dump = $dumper->dump($options);
- file_put_contents($this->phpbb_root_path . 'cache/url_matcher.' . $this->php_ext, $dump);
+ $cache->write($dumper->dump($options), $this->get_routes()->getResources());
}
- require_once($this->phpbb_root_path . 'cache/url_matcher.' . $this->php_ext);
+ require_once $cache;
- $this->matcher = new phpbb_url_matcher($this->context);
+ $this->matcher = new \phpbb_url_matcher($this->context);
}
/**
@@ -285,14 +280,7 @@ class router implements RouterInterface
return $this->generator;
}
- if (defined('DEBUG'))
- {
- $this->create_new_url_generator();
- }
- else
- {
- $this->create_dumped_url_generator();
- }
+ $this->create_dumped_url_generator();
return $this->generator;
}
@@ -302,21 +290,22 @@ class router implements RouterInterface
*/
protected function create_dumped_url_generator()
{
- if (!file_exists($this->phpbb_root_path . 'cache/url_generator.' . $this->php_ext))
+ $cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_generator.{$this->php_ext}", defined('DEBUG'));
+ if (!$cache->isFresh())
{
$dumper = new PhpGeneratorDumper($this->get_routes());
$options = array(
- 'class' => 'phpbb_url_generator',
+ 'class' => 'phpbb_url_generator',
+ 'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
);
- $dump = $dumper->dump($options);
- file_put_contents($this->phpbb_root_path . 'cache/url_generator.' . $this->php_ext, $dump);
+ $cache->write($dumper->dump($options), $this->get_routes()->getResources());
}
- require_once($this->phpbb_root_path . 'cache/url_generator.' . $this->php_ext);
+ require_once $cache;
- $this->generator = new phpbb_url_generator($this->context);
+ $this->generator = new \phpbb_url_generator($this->context);
}
/**