public function __destruct() { try { FileUtils::removeDirectory($this->path, true); } catch (BaseException $e) { // boo! deal with garbage yourself. } }
public function drop() { // removed, but not created yet if (!is_writable($this->path)) { return true; } $toRemove = realpath($this->path) . '.' . microtime(true) . getmypid() . '.' . '.removing'; try { rename($this->path, $toRemove); } catch (BaseException $e) { // already removed during race return true; } FileUtils::removeDirectory($toRemove, true); return true; }
private function spawnCacheDir() { $cachePath = ONPHP_CLASS_CACHE . 'testCache/'; if (file_exists($cachePath)) { if (is_file($cachePath)) { unlink($cachePath); } elseif (is_dir($cachePath)) { FileUtils::removeDirectory($cachePath, true); } } mkdir($cachePath, 0777, true); return $cachePath; }
/** * @return RubberFileSystem **/ public function clean() { // just to return 'true' FileUtils::removeDirectory($this->directory, true); return parent::clean(); }