diff options
author | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-04-16 20:44:02 +0200 |
---|---|---|
committer | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-04-16 20:44:02 +0200 |
commit | f077b72d0ddabd13350bea276069b68d5df4a89c (patch) | |
tree | d072352cd49d016b203a2e1de5464cfd9b9dd0c8 /phpBB/phpbb/cache/driver/file.php | |
parent | db9ef52fdd40e2ae8118f458bd12eda540b57bd3 (diff) | |
parent | 4bdef6fd21a5dcab455b0cd1ee2652de606929c3 (diff) | |
download | forums-f077b72d0ddabd13350bea276069b68d5df4a89c.tar forums-f077b72d0ddabd13350bea276069b68d5df4a89c.tar.gz forums-f077b72d0ddabd13350bea276069b68d5df4a89c.tar.bz2 forums-f077b72d0ddabd13350bea276069b68d5df4a89c.tar.xz forums-f077b72d0ddabd13350bea276069b68d5df4a89c.zip |
Merge pull request #3487 from MateBartus/ticket/13697
[ticket/13697] Moving filesystem related functions to filesystem service
Diffstat (limited to 'phpBB/phpbb/cache/driver/file.php')
-rw-r--r-- | phpBB/phpbb/cache/driver/file.php | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 32086458ee..bb055d3acf 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -21,6 +21,11 @@ class file extends \phpbb\cache\driver\base var $var_expires = array(); /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** * Set cache path * * @param string $cache_dir Define the path to the cache directory (default: $phpbb_root_path . 'cache/') @@ -30,6 +35,7 @@ class file extends \phpbb\cache\driver\base global $phpbb_root_path, $phpbb_container; $this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_root_path . 'cache/' . $phpbb_container->getParameter('core.environment') . '/'; + $this->filesystem = new \phpbb\filesystem\filesystem(); if (!is_dir($this->cache_dir)) { @@ -69,14 +75,8 @@ class file extends \phpbb\cache\driver\base if (!$this->_write('data_global')) { - if (!function_exists('phpbb_is_writable')) - { - global $phpbb_root_path; - include($phpbb_root_path . 'includes/functions.' . $phpEx); - } - // Now, this occurred how often? ... phew, just tell the user then... - if (!phpbb_is_writable($this->cache_dir)) + if (!$this->filesystem->is_writable($this->cache_dir)) { // We need to use die() here, because else we may encounter an infinite loop (the message handler calls $cache->unload()) die('Fatal: ' . $this->cache_dir . ' is NOT writable.'); @@ -574,13 +574,14 @@ class file extends \phpbb\cache\driver\base fclose($handle); - if (!function_exists('phpbb_chmod')) + try { - global $phpbb_root_path; - include($phpbb_root_path . 'includes/functions.' . $phpEx); + $this->filesystem->phpbb_chmod($file, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing } - - phpbb_chmod($file, CHMOD_READ | CHMOD_WRITE); $return_value = true; } |