/**
  * 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()
 {
     if ($this->deleted) {
         return;
     }
     $files = $this->scan();
     foreach ($files as $file) {
         $file->delete();
     }
     // Allow filesystem transactions
     if (fFilesystem::isInsideTransaction()) {
         return fFilesystem::delete($this);
     }
     rmdir($this->directory);
     fFilesystem::updateDeletedMap($this->directory, debug_backtrace());
     fFilesystem::updateFilenameMapForDirectory($this->directory, '*DELETED at ' . time() . ' with token ' . uniqid('', TRUE) . '* ' . $this->directory);
 }
 /**
  * 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()
 {
     if ($this->deleted) {
         return;
     }
     if (!$this->getParent()->isWritable()) {
         throw new fEnvironmentException('The directory, %s, can not be deleted because the directory containing it is not writable', $this->directory);
     }
     $files = $this->scan();
     foreach ($files as $file) {
         $file->delete();
     }
     // Allow filesystem transactions
     if (fFilesystem::isInsideTransaction()) {
         return fFilesystem::recordDelete($this);
     }
     rmdir($this->directory);
     fFilesystem::updateDeletedMap($this->directory, debug_backtrace());
     fFilesystem::updateFilenameMapForDirectory($this->directory, '*DELETED at ' . time() . ' with token ' . uniqid('', TRUE) . '* ' . $this->directory);
 }