1f21dad39SAndreas Gohr<?php 2f21dad39SAndreas Gohr 3f21dad39SAndreas Gohrnamespace dokuwiki\Action; 4f21dad39SAndreas Gohr 56723156fSAndreas 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 */ 158c7c53b0SAndreas Gohrclass Draftdel extends AbstractAction 168c7c53b0SAndreas Gohr{ 17f21dad39SAndreas Gohr /** @inheritdoc */ 18*d868eb89SAndreas Gohr public function minimumPermission() 19*d868eb89SAndreas Gohr { 20f21dad39SAndreas Gohr return AUTH_EDIT; 21f21dad39SAndreas Gohr } 22f21dad39SAndreas Gohr 23231f749dSAndreas Gohr /** 240aabe6f8SMichael Große * Delete an existing draft for the current page and user if any 25231f749dSAndreas Gohr * 260aabe6f8SMichael Große * Redirects to show, afterwards. 27231f749dSAndreas Gohr * 28231f749dSAndreas Gohr * @throws ActionAbort 29231f749dSAndreas Gohr */ 30*d868eb89SAndreas Gohr public function preProcess() 31*d868eb89SAndreas Gohr { 320aabe6f8SMichael Große global $INFO, $ID; 336723156fSAndreas Gohr $draft = new Draft($ID, $INFO['client']); 34e6699927SAndreas Gohr if ($draft->isDraftAvailable() && checkSecurityToken()) { 350aabe6f8SMichael Große $draft->deleteDraft(); 360aabe6f8SMichael Große } 37231f749dSAndreas Gohr 3858528803SAndreas Gohr throw new ActionAbort('redirect'); 39f21dad39SAndreas Gohr } 40f21dad39SAndreas Gohr} 41