1
0
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:
rxu
2025-07-28 22:51:14 +07:00
parent 788e408ceb
commit 7056bcba91
6 changed files with 30 additions and 42 deletions

View File

@@ -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);

View File

@@ -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;