1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 03:54:10 +01:00

Merge pull request #3453 from RMcGirr83/ticket/13477

[ticket/13477] Update file cache driver for extension paths
This commit is contained in:
Marc Alexander 2015-03-05 16:02:46 +01:00
commit d0ab101c32

View File

@ -279,6 +279,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
@ -334,6 +335,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, '_'));
@ -516,6 +518,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);
@ -584,4 +587,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);
}
}