Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * 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 . '!');
 }