mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/17189] Check folder permissions before writing
PHPBB3-17189
This commit is contained in:
parent
e1052bd168
commit
3b622bc005
3 changed files with 5 additions and 5 deletions
|
@ -161,7 +161,7 @@ function installer_shutdown_function($display_errors)
|
||||||
|
|
||||||
$cache = new \phpbb\cache\driver\file(__DIR__ . '/../cache/installer');
|
$cache = new \phpbb\cache\driver\file(__DIR__ . '/../cache/installer');
|
||||||
$filesystem = new \phpbb\filesystem\filesystem();
|
$filesystem = new \phpbb\filesystem\filesystem();
|
||||||
if (strpos($error['file'], $filesystem->realpath($cache->cache_dir)) !== false)
|
if (strpos($error['file'], $filesystem->realpath($cache->cache_dir)) !== false && is_writable($cache->cache_dir))
|
||||||
{
|
{
|
||||||
$file_age = @filemtime($error['file']);
|
$file_age = @filemtime($error['file']);
|
||||||
|
|
||||||
|
|
4
phpBB/phpbb/cache/driver/file.php
vendored
4
phpBB/phpbb/cache/driver/file.php
vendored
|
@ -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->cache_dir = !is_null($cache_dir) ? $cache_dir : $phpbb_container->getParameter('core.cache_dir');
|
||||||
$this->filesystem = new \phpbb\filesystem\filesystem();
|
$this->filesystem = new \phpbb\filesystem\filesystem();
|
||||||
|
|
||||||
if (!is_dir($this->cache_dir))
|
if ($this->filesystem->is_writable($this->cache_dir . '/../') && !is_dir($this->cache_dir))
|
||||||
{
|
{
|
||||||
@mkdir($this->cache_dir, 0777, true);
|
mkdir($this->cache_dir, 0777, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -398,13 +398,13 @@ class filesystem implements filesystem_interface
|
||||||
$file_gid = @filegroup($file);
|
$file_gid = @filegroup($file);
|
||||||
|
|
||||||
// Change owner
|
// 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);
|
$this->chown($file, $this->chmod_info['common_owner'], $recursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change group
|
// 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);
|
$this->chgrp($file, $this->chmod_info['common_group'], $recursive);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue