/** * 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() { $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); }