1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-23 09:00:48 +01:00

[ticket/14891] Use filesystem classes for checking on tmp dir

The cache dir will now also only be used if tmp dir does not exist
or if it's not writable.

PHPBB3-14891
This commit is contained in:
Marc Alexander 2016-12-09 11:10:28 +01:00
parent 5f56e9025b
commit 6a568719d0

View File

@ -13,7 +13,8 @@
namespace phpbb\di;
use \bantu\IniGetWrapper\IniGetWrapper;
use bantu\IniGetWrapper\IniGetWrapper;
use phpbb\filesystem\filesystem;
use ProxyManager\Configuration;
use ProxyManager\Factory\LazyLoadingValueHolderFactory;
use ProxyManager\GeneratorStrategy\EvaluatingGeneratorStrategy;
@ -45,7 +46,10 @@ class proxy_instantiator implements InstantiatorInterface
// Prevent trying to write to system temp dir in case of open_basedir
// restrictions being in effect
$ini_wrapper = new IniGetWrapper();
if ($ini_wrapper->getString('open_basedir') || !file_exists(sys_get_temp_dir()))
$filesystem = new filesystem();
$tmp_dir = sys_get_temp_dir();
if ($ini_wrapper->getString('open_basedir') &&
(!$filesystem->exists($tmp_dir) || !$filesystem->is_writable($tmp_dir)))
{
$config->setProxiesTargetDir($cache_dir);
}