1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

Merge pull request #6546 from Derky/ticket/17189

[Ticket/17189] Improve installer file permission checks
This commit is contained in:
Marc Alexander
2023-10-04 20:03:17 +02:00
4 changed files with 8 additions and 6 deletions

View File

@@ -37,9 +37,9 @@ class file extends \phpbb\cache\driver\base
$this->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_container->getParameter('core.cache_dir');
$this->filesystem = new \phpbb\filesystem\filesystem();
if (!is_dir($this->cache_dir))
if ($this->filesystem->is_writable(dirname($this->cache_dir)) && !is_dir($this->cache_dir))
{
@mkdir($this->cache_dir, 0777, true);
mkdir($this->cache_dir, 0777, true);
}
}

View File

@@ -398,13 +398,13 @@ class filesystem implements filesystem_interface
$file_gid = @filegroup($file);
// Change owner
if ($file_uid !== $this->chmod_info['common_owner'])
if (is_writable($file) && $file_uid !== $this->chmod_info['common_owner'])
{
$this->chown($file, $this->chmod_info['common_owner'], $recursive);
}
// Change group
if ($file_gid !== $this->chmod_info['common_group'])
if (is_writable($file) && $file_gid !== $this->chmod_info['common_group'])
{
$this->chgrp($file, $this->chmod_info['common_group'], $recursive);
}

View File

@@ -217,6 +217,7 @@ class check_filesystem extends \phpbb\install\task_base
catch (\phpbb\filesystem\exception\filesystem_exception $e)
{
// Do nothing
$this->response->add_warning_message($e->getMessage(), $e->get_filename());
}
}
@@ -232,6 +233,7 @@ class check_filesystem extends \phpbb\install\task_base
}
catch (\phpbb\filesystem\exception\filesystem_exception $e)
{
$this->response->add_warning_message($e->getMessage(), $e->get_filename());
// Do nothing
}
}