コード例 #1
0
ファイル: fDirectory.php プロジェクト: jsuarez/MyDesign
 /**
  * Will delete a directory and all files and directories inside of it
  * 
  * This operation will not be performed until the filesystem transaction
  * has been committed, if a transaction is in progress. Any non-Flourish
  * code (PHP or system) will still see this directory and all contents as
  * existing until that point.
  * 
  * @return void
  */
 public function delete()
 {
     $this->tossIfException();
     $files = $this->scan();
     foreach ($files as $file) {
         $file->delete();
     }
     // Allow filesystem transactions
     if (fFilesystem::isInsideTransaction()) {
         return fFilesystem::delete($this);
     }
     rmdir($this->directory);
     $exception = new fProgrammerException('The action requested can not be performed because the directory has been deleted');
     fFilesystem::updateExceptionMap($this->directory, $exception);
 }
コード例 #2
0
ファイル: fFile.php プロジェクト: jsuarez/MyDesign
 /**
  * Deletes the current file
  * 
  * This operation will NOT be performed until the filesystem transaction
  * has been committed, if a transaction is in progress. Any non-Flourish
  * code (PHP or system) will still see this file as existing until that
  * point.
  * 
  * @return void
  */
 public function delete()
 {
     // The only kind of stored exception is if the file has already
     // been deleted so in that case nothing needs to be done
     if ($this->exception) {
         return;
     }
     if (!$this->getDirectory()->isWritable()) {
         throw new fEnvironmentException('The file, %s, can not be deleted because the directory containing it is not writable', $this->file);
     }
     // Allow filesystem transactions
     if (fFilesystem::isInsideTransaction()) {
         return fFilesystem::recordDelete($this);
     }
     unlink($this->file);
     $exception = new fProgrammerException('The action requested can not be performed because the file has been deleted');
     fFilesystem::updateExceptionMap($this->file, $exception);
 }