DNRoot::deletesnapshot PHP Method

deletesnapshot() public method

Permission checks are handled in {@link DataArchives()}. Submissions are handled through {@link doDelete()}.
public deletesnapshot ( SS_HTTPRequest $request ) : HTMLText
$request SS_HTTPRequest
return HTMLText
    public function deletesnapshot(\SS_HTTPRequest $request)
    {
        $this->setCurrentActionType(self::ACTION_SNAPSHOT);
        /** @var DNDataArchive $dataArchive */
        $dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID'));
        if (!$dataArchive) {
            throw new SS_HTTPResponse_Exception('Archive not found', 404);
        }
        if (!$dataArchive->canDelete()) {
            throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403);
        }
        $form = $this->getDeleteForm($this->request, $dataArchive);
        // View currently only available via ajax
        return $form->forTemplate();
    }