/** * @param int $iTimeToClearInHours = 24 * * @return bool */ public function GC($iTimeToClearInHours = 24) { if (0 < $iTimeToClearInHours) { \MailSo\Base\Utils::RecTimeDirRemove($this->sCacheFolder, 60 * 60 * $iTimeToClearInHours, \time()); return true; } return false; }
/** * @param string $sTempPath * @param int $iTime2Kill * @param int $iNow * * @return bool */ public static function RecTimeDirRemove($sTempPath, $iTime2Kill, $iNow) { $iFileCount = 0; $sTempPath = rtrim($sTempPath, '\\/'); if (@\is_dir($sTempPath)) { $rDirH = @\opendir($sTempPath); if ($rDirH) { $bRemoveAllDirs = true; while (($sFile = @\readdir($rDirH)) !== false) { if ('.' !== $sFile && '..' !== $sFile) { if (@\is_dir($sTempPath . '/' . $sFile)) { if (!\MailSo\Base\Utils::RecTimeDirRemove($sTempPath . '/' . $sFile, $iTime2Kill, $iNow)) { $bRemoveAllDirs = false; } } else { $iFileCount++; } } } @\closedir($rDirH); } if ($iFileCount > 0) { if (\MailSo\Base\Utils::TimeFilesRemove($sTempPath, $iTime2Kill, $iNow)) { return @\rmdir($sTempPath); } } else { return $bRemoveAllDirs ? @\rmdir($sTempPath) : false; } return false; } return true; }
/** * @return bool */ public function gc() { return \MailSo\Base\Utils::RecTimeDirRemove($this->sDataPath . $this->sPath, 60 * 60 * 6, time()); }
/** * @return bool */ public function gc() { return \MailSo\Base\Utils::RecTimeDirRemove($this->sDataPath . '/temp/.cache/', 60 * 60 * 6, time()); }