1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-09 10:16:36 +02:00

[ticket/13697] Moving filesystem related functions to filesystem service

* Moving filesystem service to \phpbb\filesystem namespace
 * Wraping Symfony's Filesystem component
 * Moving filesystem related functions from includes/functions.php
   into \phpbb\filesystem\filesystem
   Functions moved (and deprecated):
     - phpbb_chmod
     - phpbb_is_writable
     - phpbb_is_absolute
     - phpbb_own_realpath
     - phpbb_realpath
 * Adding interface for filesystem service

PHPBB3-13697
This commit is contained in:
MateBartus
2015-03-12 00:25:00 +01:00
parent f86c5d905b
commit 4bdef6fd21
82 changed files with 1859 additions and 657 deletions

View File

@@ -623,7 +623,7 @@ class messenger
*/
protected function setup_template()
{
global $config, $phpbb_path_helper, $user, $phpbb_extension_manager, $phpbb_container;
global $config, $phpbb_path_helper, $user, $phpbb_extension_manager, $phpbb_container, $phpbb_filesystem;
if ($this->template instanceof \phpbb\template\template)
{
@@ -641,7 +641,9 @@ class messenger
$phpbb_container,
$phpbb_container->getParameter('core.root_path') . 'cache/',
$phpbb_container->get('ext.manager'),
new \phpbb\template\twig\loader()
new \phpbb\template\twig\loader(
$phpbb_filesystem
)
),
$phpbb_container->getParameter('core.root_path') . 'cache/',
$phpbb_container->get('template.twig.extensions.collection'),
@@ -671,15 +673,21 @@ class queue
var $cache_file = '';
var $eol = "\n";
/**
* @var \phpbb\filesystem\filesystem_interface
*/
protected $filesystem;
/**
* constructor
*/
function queue()
{
global $phpEx, $phpbb_root_path;
global $phpEx, $phpbb_root_path, $phpbb_filesystem;
$this->data = array();
$this->cache_file = "{$phpbb_root_path}cache/queue.$phpEx";
$this->filesystem = $phpbb_filesystem;
}
/**
@@ -865,7 +873,14 @@ class queue
fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>");
fclose($fp);
phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);
try
{
$this->filesystem->phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);
}
catch (\phpbb\filesystem\exception\filesystem_exception $e)
{
// Do nothing
}
}
}
@@ -907,7 +922,14 @@ class queue
fwrite($fp, "<?php\nif (!defined('IN_PHPBB')) exit;\n\$this->queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>");
fclose($fp);
phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);
try
{
$this->filesystem->phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);
}
catch (\phpbb\filesystem\exception\filesystem_exception $e)
{
// Do nothing
}
}
$lock->release();