1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 15:16:16 +02:00

Merge branch '3.1.x'

This commit is contained in:
Marc Alexander 2015-03-05 16:02:48 +01:00
commit a33c99b3fd

View File

@ -285,6 +285,7 @@ class file extends \phpbb\cache\driver\base
if ($var_name[0] == '_')
{
global $phpEx;
$var_name = $this->clean_varname($var_name);
return file_exists($this->cache_dir . 'data' . $var_name . ".$phpEx");
}
else
@ -340,6 +341,7 @@ class file extends \phpbb\cache\driver\base
{
global $phpEx;
$filename = $this->clean_varname($filename);
$file = "{$this->cache_dir}$filename.$phpEx";
$type = substr($filename, 0, strpos($filename, '_'));
@ -522,6 +524,7 @@ class file extends \phpbb\cache\driver\base
{
global $phpEx;
$filename = $this->clean_varname($filename);
$file = "{$this->cache_dir}$filename.$phpEx";
$lock = new \phpbb\lock\flock($file);
@ -590,4 +593,15 @@ class file extends \phpbb\cache\driver\base
return $return_value;
}
/**
* Replace slashes in the file name
*
* @param string $varname name of a cache variable
* @return string $varname name that is safe to use as a filename
*/
protected function clean_varname($varname)
{
return str_replace('/', '-', $varname);
}
}