aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2015-05-20 10:53:16 +0200
committerMarc Alexander <admin@m-a-styles.de>2015-05-20 10:53:16 +0200
commit466b71023524960e791291f3a7abe9c99af25daa (patch)
treef0cba9c620ddb0eca742bf97bea1a40ac4e0a3c9 /phpBB
parent023f15f5feaf731d6c5ce283ab11f8448e3d05c4 (diff)
parentd48e95bb3a17f111e9d4d8111630be44ef9019e4 (diff)
downloadforums-466b71023524960e791291f3a7abe9c99af25daa.tar
forums-466b71023524960e791291f3a7abe9c99af25daa.tar.gz
forums-466b71023524960e791291f3a7abe9c99af25daa.tar.bz2
forums-466b71023524960e791291f3a7abe9c99af25daa.tar.xz
forums-466b71023524960e791291f3a7abe9c99af25daa.zip
Merge pull request #3608 from Nicofuma/ticket/13829
[ticket/13829] Don't fail if the cache isn't writeable
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/phpbb/routing/router.php59
1 files changed, 37 insertions, 22 deletions
diff --git a/phpBB/phpbb/routing/router.php b/phpBB/phpbb/routing/router.php
index dd5bffe22b..2f89d4e884 100644
--- a/phpBB/phpbb/routing/router.php
+++ b/phpBB/phpbb/routing/router.php
@@ -14,6 +14,7 @@
namespace phpbb\routing;
use Symfony\Component\Config\ConfigCache;
+use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper;
use Symfony\Component\Routing\Matcher\UrlMatcher;
@@ -252,22 +253,29 @@ class router implements RouterInterface
*/
protected function create_dumped_url_matcher()
{
- $cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_matcher.{$this->php_ext}", defined('DEBUG'));
- if (!$cache->isFresh())
+ try
{
- $dumper = new PhpMatcherDumper($this->get_routes());
+ $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',
- 'base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher',
- );
+ $options = array(
+ 'class' => 'phpbb_url_matcher',
+ 'base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher',
+ );
- $cache->write($dumper->dump($options), $this->get_routes()->getResources());
- }
+ $cache->write($dumper->dump($options), $this->get_routes()->getResources());
+ }
- require_once($cache->getPath());
+ require_once($cache->getPath());
- $this->matcher = new \phpbb_url_matcher($this->context);
+ $this->matcher = new \phpbb_url_matcher($this->context);
+ }
+ catch (IOException $e)
+ {
+ $this->create_new_url_matcher();
+ }
}
/**
@@ -300,22 +308,29 @@ class router implements RouterInterface
*/
protected function create_dumped_url_generator()
{
- $cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_generator.{$this->php_ext}", defined('DEBUG'));
- if (!$cache->isFresh())
+ try
{
- $dumper = new PhpGeneratorDumper($this->get_routes());
+ $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',
- 'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
- );
+ $options = array(
+ 'class' => 'phpbb_url_generator',
+ 'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
+ );
- $cache->write($dumper->dump($options), $this->get_routes()->getResources());
- }
+ $cache->write($dumper->dump($options), $this->get_routes()->getResources());
+ }
- require_once($cache->getPath());
+ require_once($cache->getPath());
- $this->generator = new \phpbb_url_generator($this->context);
+ $this->generator = new \phpbb_url_generator($this->context);
+ }
+ catch (IOException $e)
+ {
+ $this->create_new_url_generator();
+ }
}
/**