mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
[ticket/16955] Clean up filesystem and files classes
PHPBB3-16955
This commit is contained in:
@@ -329,7 +329,7 @@ class filesystem implements filesystem_interface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function phpbb_chmod($files, $perms = null, $recursive = false, $force_chmod_link = false)
|
||||
public function phpbb_chmod($file, $perms = null, $recursive = false, $force_chmod_link = false)
|
||||
{
|
||||
if (is_null($perms))
|
||||
{
|
||||
@@ -374,26 +374,26 @@ class filesystem implements filesystem_interface
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach ($this->to_iterator($files) as $file)
|
||||
foreach ($this->to_iterator($file) as $current_file)
|
||||
{
|
||||
$file_uid = @fileowner($file);
|
||||
$file_gid = @filegroup($file);
|
||||
$file_uid = @fileowner($current_file);
|
||||
$file_gid = @filegroup($current_file);
|
||||
|
||||
// Change owner
|
||||
if ($file_uid !== $this->chmod_info['common_owner'])
|
||||
{
|
||||
$this->chown($file, $this->chmod_info['common_owner'], $recursive);
|
||||
$this->chown($current_file, $this->chmod_info['common_owner'], $recursive);
|
||||
}
|
||||
|
||||
// Change group
|
||||
if ($file_gid !== $this->chmod_info['common_group'])
|
||||
{
|
||||
$this->chgrp($file, $this->chmod_info['common_group'], $recursive);
|
||||
$this->chgrp($current_file, $this->chmod_info['common_group'], $recursive);
|
||||
}
|
||||
|
||||
clearstatcache();
|
||||
$file_uid = @fileowner($file);
|
||||
$file_gid = @filegroup($file);
|
||||
$file_uid = @fileowner($current_file);
|
||||
$file_gid = @filegroup($current_file);
|
||||
}
|
||||
}
|
||||
catch (filesystem_exception $e)
|
||||
@@ -431,9 +431,9 @@ class filesystem implements filesystem_interface
|
||||
case 'owner':
|
||||
try
|
||||
{
|
||||
$this->chmod($files, $perms, $recursive, $force_chmod_link);
|
||||
$this->chmod($file, $perms, $recursive, $force_chmod_link);
|
||||
clearstatcache();
|
||||
if ($this->is_readable($files) && $this->is_writable($files))
|
||||
if ($this->is_readable($file) && $this->is_writable($file))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -445,9 +445,9 @@ class filesystem implements filesystem_interface
|
||||
case 'group':
|
||||
try
|
||||
{
|
||||
$this->chmod($files, $perms, $recursive, $force_chmod_link);
|
||||
$this->chmod($file, $perms, $recursive, $force_chmod_link);
|
||||
clearstatcache();
|
||||
if ((!($perms & self::CHMOD_READ) || $this->is_readable($files, $recursive)) && (!($perms & self::CHMOD_WRITE) || $this->is_writable($files, $recursive)))
|
||||
if ((!($perms & self::CHMOD_READ) || $this->is_readable($file, $recursive)) && (!($perms & self::CHMOD_WRITE) || $this->is_writable($file, $recursive)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -458,7 +458,7 @@ class filesystem implements filesystem_interface
|
||||
}
|
||||
case 'other':
|
||||
default:
|
||||
$this->chmod($files, $perms, $recursive, $force_chmod_link);
|
||||
$this->chmod($file, $perms, $recursive, $force_chmod_link);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -241,7 +241,7 @@ interface filesystem_interface
|
||||
*
|
||||
* @param ?string $path Path to resolve
|
||||
*
|
||||
* @return string Resolved path
|
||||
* @return string|false Resolved path or false if path could not be resolved
|
||||
*/
|
||||
public function realpath($path);
|
||||
|
||||
|
@@ -69,7 +69,7 @@ class helper
|
||||
* Try to resolve real path when PHP's realpath failes to do so
|
||||
*
|
||||
* @param string $path
|
||||
* @return bool|string
|
||||
* @return string|false
|
||||
*/
|
||||
protected static function phpbb_own_realpath($path)
|
||||
{
|
||||
@@ -175,7 +175,7 @@ class helper
|
||||
*
|
||||
* @param string $path Path to resolve
|
||||
*
|
||||
* @return string Resolved path
|
||||
* @return string|false Resolved path or false if path could not be resolved
|
||||
*/
|
||||
public static function realpath($path)
|
||||
{
|
||||
|
Reference in New Issue
Block a user