diff options
author | Marc Alexander <admin@m-a-styles.de> | 2015-01-24 10:05:34 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2015-01-24 10:05:34 +0100 |
commit | e2786c37dc1ef5c0e032e09bb6b7a18210eebfca (patch) | |
tree | 70166cb9c24bc9827e2bd8c0205df4fce9b1f13f /phpBB/phpbb | |
parent | fc91616fadc19aaf6423c541c748c3fb3ec70760 (diff) | |
parent | f4576c969ab3c3619564e8be7b71547049846bd5 (diff) | |
download | forums-e2786c37dc1ef5c0e032e09bb6b7a18210eebfca.tar forums-e2786c37dc1ef5c0e032e09bb6b7a18210eebfca.tar.gz forums-e2786c37dc1ef5c0e032e09bb6b7a18210eebfca.tar.bz2 forums-e2786c37dc1ef5c0e032e09bb6b7a18210eebfca.tar.xz forums-e2786c37dc1ef5c0e032e09bb6b7a18210eebfca.zip |
Merge pull request #3179 from Nicofuma/ticket/13372
[ticket/13372] Fix Url Generator/Matcher generation
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/routing/router.php | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/phpBB/phpbb/routing/router.php b/phpBB/phpbb/routing/router.php index 1003708540..40a829b73f 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); } /** |