Ejemplo n.º 1
0
 /**
  * Sets write access to file's owner
  *
  * @throws FileSystemException if setting write access fails
  * @return  TRUE if file is already writable or setting write access was successful
  */
 public function makeWritable()
 {
     // use PHP
     if ($this->accessMode == self::PHP_ACCESS || $this->accessMode == self::UNKNOWN_ACCESS) {
         try {
             $fsFile = new FileSystemFile($this->file);
             $fsFile->makeWritable();
             return true;
         } 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->makeWritable();
             return true;
         } catch (FTPFileException $e) {
             \DBG::msg('FTPFile: ' . $e->getMessage());
         }
     }
     throw new FileSystemException('File: Unable to set write access to file ' . $this->file . '!');
 }