mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge pull request #3453 from RMcGirr83/ticket/13477
[ticket/13477] Update file cache driver for extension paths
This commit is contained in:
commit
d0ab101c32
1 changed files with 14 additions and 0 deletions
14
phpBB/phpbb/cache/driver/file.php
vendored
14
phpBB/phpbb/cache/driver/file.php
vendored
|
@ -279,6 +279,7 @@ class file extends \phpbb\cache\driver\base
|
||||||
if ($var_name[0] == '_')
|
if ($var_name[0] == '_')
|
||||||
{
|
{
|
||||||
global $phpEx;
|
global $phpEx;
|
||||||
|
$var_name = $this->clean_varname($var_name);
|
||||||
return file_exists($this->cache_dir . 'data' . $var_name . ".$phpEx");
|
return file_exists($this->cache_dir . 'data' . $var_name . ".$phpEx");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -334,6 +335,7 @@ class file extends \phpbb\cache\driver\base
|
||||||
{
|
{
|
||||||
global $phpEx;
|
global $phpEx;
|
||||||
|
|
||||||
|
$filename = $this->clean_varname($filename);
|
||||||
$file = "{$this->cache_dir}$filename.$phpEx";
|
$file = "{$this->cache_dir}$filename.$phpEx";
|
||||||
|
|
||||||
$type = substr($filename, 0, strpos($filename, '_'));
|
$type = substr($filename, 0, strpos($filename, '_'));
|
||||||
|
@ -516,6 +518,7 @@ class file extends \phpbb\cache\driver\base
|
||||||
{
|
{
|
||||||
global $phpEx;
|
global $phpEx;
|
||||||
|
|
||||||
|
$filename = $this->clean_varname($filename);
|
||||||
$file = "{$this->cache_dir}$filename.$phpEx";
|
$file = "{$this->cache_dir}$filename.$phpEx";
|
||||||
|
|
||||||
$lock = new \phpbb\lock\flock($file);
|
$lock = new \phpbb\lock\flock($file);
|
||||||
|
@ -584,4 +587,15 @@ class file extends \phpbb\cache\driver\base
|
||||||
|
|
||||||
return $return_value;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue