mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +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
|
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);
|
\MailSo\Base\Utils::RecTimeDirRemove($this->sCacheFolder, 3600 * $iTimeToClearInHours);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateCachedFileName(string $sKey, bool $bMkDir = false) : string
|
private function generateCachedFileName(string $sKey, bool $bMkDir = false) : string
|
||||||
|
|
|
||||||
|
|
@ -74,14 +74,9 @@ trait Admin
|
||||||
|
|
||||||
public function DoAdminClearCache() : array
|
public function DoAdminClearCache() : array
|
||||||
{
|
{
|
||||||
$this->Cacher()->GC(1);
|
$this->Cacher()->GC(0);
|
||||||
if (\is_dir(APP_PRIVATE_DATA . 'cache')) {
|
if (\is_dir(APP_PRIVATE_DATA . 'cache')) {
|
||||||
foreach (new \RecursiveIteratorIterator(
|
\MailSo\Base\Utils::RecRmDir(APP_PRIVATE_DATA.'cache');
|
||||||
new \RecursiveDirectoryIterator(APP_PRIVATE_DATA.'cache', \FilesystemIterator::SKIP_DOTS),
|
|
||||||
\RecursiveIteratorIterator::CHILD_FIRST) as $sName) {
|
|
||||||
$sName->isDir() ? \rmdir($sName) : \unlink($sName);
|
|
||||||
}
|
|
||||||
\clearstatcache();
|
|
||||||
}
|
}
|
||||||
return $this->TrueResponse(__FUNCTION__);
|
return $this->TrueResponse(__FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue