mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 06:58:27 +03:00
Fix Cache->GC(0) for files
This commit is contained in:
parent
c605ff1767
commit
6215af5d74
2 changed files with 6 additions and 12 deletions
|
|
@ -74,13 +74,12 @@ class File implements \MailSo\Cache\DriverInterface
|
|||
|
||||
public function GC(int $iTimeToClearInHours = 24) : bool
|
||||
{
|
||||
if (0 < $iTimeToClearInHours)
|
||||
{
|
||||
if (0 === $iTimeToClearInHours) {
|
||||
\MailSo\Base\Utils::RecRmDir($this->sCacheFolder);
|
||||
} else {
|
||||
\MailSo\Base\Utils::RecTimeDirRemove($this->sCacheFolder, 3600 * $iTimeToClearInHours);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private function generateCachedFileName(string $sKey, bool $bMkDir = false) : string
|
||||
|
|
|
|||
|
|
@ -74,14 +74,9 @@ trait Admin
|
|||
|
||||
public function DoAdminClearCache() : array
|
||||
{
|
||||
$this->Cacher()->GC(1);
|
||||
$this->Cacher()->GC(0);
|
||||
if (\is_dir(APP_PRIVATE_DATA . 'cache')) {
|
||||
foreach (new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator(APP_PRIVATE_DATA.'cache', \FilesystemIterator::SKIP_DOTS),
|
||||
\RecursiveIteratorIterator::CHILD_FIRST) as $sName) {
|
||||
$sName->isDir() ? \rmdir($sName) : \unlink($sName);
|
||||
}
|
||||
\clearstatcache();
|
||||
\MailSo\Base\Utils::RecRmDir(APP_PRIVATE_DATA.'cache');
|
||||
}
|
||||
return $this->TrueResponse(__FUNCTION__);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue