mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-11 03:04:09 +02:00
[ticket/17535] Address code review comments
PHPBB-17535
This commit is contained in:
46
phpBB/phpbb/cache/driver/base.php
vendored
46
phpBB/phpbb/cache/driver/base.php
vendored
@@ -31,32 +31,32 @@ abstract class base implements \phpbb\cache\driver\driver_interface
|
||||
try
|
||||
{
|
||||
$iterator = new \DirectoryIterator($this->cache_dir);
|
||||
|
||||
foreach ($iterator as $fileInfo)
|
||||
{
|
||||
if ($fileInfo->isDot())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$filename = $fileInfo->getFilename();
|
||||
if ($fileInfo->isDir())
|
||||
{
|
||||
$this->remove_dir($fileInfo->getPathname());
|
||||
}
|
||||
else if (strpos($filename, 'container_') === 0 ||
|
||||
strpos($filename, 'autoload_') === 0 ||
|
||||
strpos($filename, 'url_matcher') === 0 ||
|
||||
strpos($filename, 'url_generator') === 0 ||
|
||||
strpos($filename, 'sql_') === 0 ||
|
||||
strpos($filename, 'data_') === 0)
|
||||
{
|
||||
$this->remove_file($fileInfo->getPathname());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($iterator as $fileInfo)
|
||||
{
|
||||
if ($fileInfo->isDot())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$filename = $fileInfo->getFilename();
|
||||
if ($fileInfo->isDir())
|
||||
{
|
||||
$this->remove_dir($fileInfo->getPathname());
|
||||
}
|
||||
else if (strpos($filename, 'container_') === 0 ||
|
||||
strpos($filename, 'autoload_') === 0 ||
|
||||
strpos($filename, 'url_matcher') === 0 ||
|
||||
strpos($filename, 'url_generator') === 0 ||
|
||||
strpos($filename, 'sql_') === 0 ||
|
||||
strpos($filename, 'data_') === 0)
|
||||
{
|
||||
$this->remove_file($fileInfo->getPathname());
|
||||
}
|
||||
// Do not return, to purge vars cached in memory
|
||||
}
|
||||
|
||||
unset($this->vars);
|
||||
|
13
phpBB/phpbb/cache/driver/memory.php
vendored
13
phpBB/phpbb/cache/driver/memory.php
vendored
@@ -50,18 +50,7 @@ abstract class memory extends \phpbb\cache\driver\base
|
||||
*/
|
||||
function purge()
|
||||
{
|
||||
unset($this->vars);
|
||||
unset($this->sql_rowset);
|
||||
unset($this->sql_row_pointer);
|
||||
|
||||
if (function_exists('opcache_reset'))
|
||||
{
|
||||
@opcache_reset();
|
||||
}
|
||||
|
||||
$this->vars = [];
|
||||
$this->sql_rowset = [];
|
||||
$this->sql_row_pointer = [];
|
||||
parent::purge();
|
||||
|
||||
$this->is_modified = true;
|
||||
|
||||
|
Reference in New Issue
Block a user