/** * Renames the directory. * @param string $destination The new name. * @param boolean $overwrite If already exists overwrite it or not. * @param boolean $mt Keep the modification time of the directory or not. * @throws FileException If failed to rename the directory. * @return boolean True on success. */ public function rename($destination, $overwrite = false, $mt = false) { if (dirname($destination) == ".") { $destination = $this->getDirectory() . DS . $destination; } $destination = $this->preparePath($destination); $dir = Config::$root . $destination; if (file_exists($dir)) { if (!$overwrite) { throw new FileException(array("'%s' already exists.", $destination)); } $d = new Directory($destination); $d->delete(); } if (!rename($this->pathAbsolute, $dir)) { throw new FileException(array("Failed to rename '%s'.", $this->path)); } $this->setPath($destination); if ($mt) { $filemtime = $this->getModificationTime(); @touch($this->pathAbsolute, $filemtime); } return true; }
public function delete() { $this->initPath(); parent::delete(); $this->updateQuota(); }
/** * Deletes the entire cache directory */ protected function dirDelete() { try { $dir = new Directory($this->fileDirectory); $dir->delete(); } catch (FileException $e) { } }