1f21dad39SAndreas Gohr<?php 2f21dad39SAndreas Gohr 3f21dad39SAndreas Gohrnamespace dokuwiki\Action; 4f21dad39SAndreas Gohr 5*6723156fSAndreas Gohruse dokuwiki\Draft; 6f21dad39SAndreas Gohruse dokuwiki\Action\Exception\ActionAbort; 7f21dad39SAndreas Gohr 8ab583a1bSAndreas Gohr/** 9ab583a1bSAndreas Gohr * Class Draftdel 10ab583a1bSAndreas Gohr * 11ab583a1bSAndreas Gohr * Delete a draft 12ab583a1bSAndreas Gohr * 13ab583a1bSAndreas Gohr * @package dokuwiki\Action 14ab583a1bSAndreas Gohr */ 15f1246b76SAndreas Gohrclass Draftdel extends AbstractAction { 16f21dad39SAndreas Gohr 17f21dad39SAndreas Gohr /** @inheritdoc */ 18ec701221SAndreas Gohr public function minimumPermission() { 19f21dad39SAndreas Gohr return AUTH_EDIT; 20f21dad39SAndreas Gohr } 21f21dad39SAndreas Gohr 22231f749dSAndreas Gohr /** 230aabe6f8SMichael Große * Delete an existing draft for the current page and user if any 24231f749dSAndreas Gohr * 250aabe6f8SMichael Große * Redirects to show, afterwards. 26231f749dSAndreas Gohr * 27231f749dSAndreas Gohr * @throws ActionAbort 28231f749dSAndreas Gohr */ 29f21dad39SAndreas Gohr public function preProcess() { 300aabe6f8SMichael Große global $INFO, $ID; 31*6723156fSAndreas Gohr $draft = new Draft($ID, $INFO['client']); 32e6699927SAndreas Gohr if ($draft->isDraftAvailable() && checkSecurityToken()) { 330aabe6f8SMichael Große $draft->deleteDraft(); 340aabe6f8SMichael Große } 35231f749dSAndreas Gohr 3658528803SAndreas Gohr throw new ActionAbort('redirect'); 37f21dad39SAndreas Gohr } 38f21dad39SAndreas Gohr 39f21dad39SAndreas Gohr} 40