/** * Removes file * * @throws FileSystemException if removing of file fails * @return TRUE if file has successfully been removed */ public function delete() { // use PHP if ($this->accessMode == self::PHP_ACCESS || $this->accessMode == self::UNKNOWN_ACCESS) { try { $objFilePhp = new FileSystemFile($this->file); $objFilePhp->delete(); clearstatcache(); if (!file_exists($objFilePhp->getAbsoluteFilePath())) { return true; } } catch (FileSystemFileException $e) { \DBG::msg('FileSystemFile: ' . $e->getMessage()); } } // use FTP if ($this->accessMode == self::FTP_ACCESS || $this->accessMode == self::UNKNOWN_ACCESS) { try { $objFileFtp = new FTPFile($this->file); $objFileFtp->delete(); clearstatcache(); if (!file_exists($objFileFtp->getAbsoluteFilePath())) { return true; } } catch (FTPFileException $e) { \DBG::msg('FTPFile: ' . $e->getMessage()); } } throw new FileSystemException('File: Unable to delete file ' . $this->file . '!'); }
/** * Removes file * * @throws FileSystemException if removing of file fails * @return TRUE if file has successfully been removed */ public function delete() { // use PHP if ($this->accessMode == self::PHP_ACCESS || $this->accessMode == self::UNKNOWN_ACCESS) { try { $fsFile = new FileSystemFile($this->file); $fsFile->delete(); } catch (FileSystemFileException $e) { \DBG::msg('FileSystemFile: ' . $e->getMessage()); } } // use FTP if ($this->accessMode == self::FTP_ACCESS || $this->accessMode == self::UNKNOWN_ACCESS) { try { $ftpFile = new FTPFile($this->file); $ftpFile->delete(); } catch (FTPFileException $e) { \DBG::msg('FTPFile: ' . $e->getMessage()); } } clearstatcache(); if (file_exists($this->file)) { throw new FileSystemException('File: Unable to delete file ' . $this->file . '!'); } return true; }
/** * @param bool $recursive * @param bool $onlyContents In the case of a directory, only delete the files it contains if TRUE * or the entire directory otherwise * @return bool TRUE if the file has been successfully deleted, FALSE otherwise */ public function delete($recursive = false, $onlyContents = false) { $this->checkConnectPermission(); return parent::delete($recursive, $onlyContents); }