Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
20.83% |
5 / 24 |
CRAP | |
43.18% |
174 / 403 |
filesystem | |
0.00% |
0 / 1 |
|
20.83% |
5 / 24 |
5284.10 | |
43.18% |
174 / 403 |
__construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
4 / 4 |
|||
chgrp | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 6 |
|||
chmod | |
0.00% |
0 / 1 |
28.05 | |
63.89% |
23 / 36 |
|||
chown | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 6 |
|||
clean_path | |
100.00% |
1 / 1 |
8 | |
100.00% |
14 / 14 |
|||
copy | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 4 |
|||
dump_file | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 4 |
|||
exists | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
is_absolute_path | |
100.00% |
1 / 1 |
4 | |
100.00% |
1 / 1 |
|||
is_readable | |
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 12 |
|||
is_writable | |
0.00% |
0 / 1 |
240 | |
0.00% |
0 / 26 |
|||
make_path_relative | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
mirror | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 6 |
|||
mkdir | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 6 |
|||
phpbb_chmod | |
0.00% |
0 / 1 |
270.87 | |
37.04% |
30 / 81 |
|||
realpath | |
0.00% |
0 / 1 |
6.02 | |
91.67% |
11 / 12 |
|||
remove | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 6 |
|||
rename | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 6 |
|||
symlink | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 4 |
|||
touch | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 6 |
|||
phpbb_is_writable | |
0.00% |
0 / 1 |
110 | |
0.00% |
0 / 22 |
|||
phpbb_own_realpath | |
0.00% |
0 / 1 |
15.47 | |
75.56% |
34 / 45 |
|||
to_iterator | |
100.00% |
1 / 1 |
3 | |
100.00% |
5 / 5 |
|||
resolve_path | |
0.00% |
0 / 1 |
105.80 | |
57.30% |
51 / 89 |
<?php | |
/** | |
* | |
* This file is part of the phpBB Forum Software package. | |
* | |
* @copyright (c) phpBB Limited <https://www.phpbb.com> | |
* @license GNU General Public License, version 2 (GPL-2.0) | |
* | |
* For full copyright and license information, please see | |
* the docs/CREDITS.txt file. | |
* | |
*/ | |
namespace phpbb\filesystem; | |
use phpbb\filesystem\exception\filesystem_exception; | |
/** | |
* A class with various functions that are related to paths, files and the filesystem | |
*/ | |
class filesystem implements filesystem_interface | |
{ | |
/** | |
* Store some information about file ownership for phpBB's chmod function | |
* | |
* @var array | |
*/ | |
protected $chmod_info; | |
/** | |
* Stores current working directory | |
* | |
* @var string|bool current working directory or false if it cannot be recovered | |
*/ | |
protected $working_directory; | |
/** | |
* Symfony's Filesystem component | |
* | |
* @var \Symfony\Component\Filesystem\Filesystem | |
*/ | |
protected $symfony_filesystem; | |
/** | |
* Constructor | |
*/ | |
public function __construct() | |
{ | |
$this->chmod_info = array(); | |
$this->symfony_filesystem = new \Symfony\Component\Filesystem\Filesystem(); | |
$this->working_directory = null; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function chgrp($files, $group, $recursive = false) | |
{ | |
try | |
{ | |
$this->symfony_filesystem->chgrp($files, $group, $recursive); | |
} | |
catch (\Symfony\Component\Filesystem\Exception\IOException $e) | |
{ | |
// Try to recover filename | |
// By the time this is written that is at the end of the message | |
$error = trim($e->getMessage()); | |
$file = substr($error, strrpos($error, ' ')); | |
throw new filesystem_exception('CANNOT_CHANGE_FILE_GROUP', $file, array(), $e); | |
} | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function chmod($files, $perms = null, $recursive = false, $force_chmod_link = false) | |
{ | |
if (is_null($perms)) | |
{ | |
// Default to read permission for compatibility reasons | |
$perms = self::CHMOD_READ; | |
} | |
// Check if we got a permission flag | |
if ($perms > self::CHMOD_ALL) | |