Recursive function for cleaning cache file in the given directory
public _cleanDir ( string $dir, string $group = false, string $mode = 'ingroup' ) : boolean | ||
$dir | string | directory complete path (with a trailing slash) |
$group | string | name of the cache group |
$mode | string | flush cache mode : 'old', 'ingroup', 'notingroup', 'callback_myFunction' |
return | boolean | true if no problem |
/** * Garbage collect expired cache data * * @return boolean * * @since 11.1 */ public function gc() { $result = true; static::$CacheLiteInstance->setOption('automaticCleaningFactor', 1); static::$CacheLiteInstance->setOption('hashedDirectoryLevel', 1); $success1 = static::$CacheLiteInstance->_cleanDir($this->_root . '/', false, 'old'); if (!($dh = opendir($this->_root . '/'))) { return false; } while ($file = readdir($dh)) { if ($file != '.' && $file != '..' && $file != '.svn') { $file2 = $this->_root . '/' . $file; if (is_dir($file2)) { $result = $result && static::$CacheLiteInstance->_cleanDir($file2 . '/', false, 'old'); } } } $success = $success1 && $result; return $success; }