1<?php 2 3namespace dokuwiki\Action; 4 5use dokuwiki\Draft; 6use dokuwiki\Action\Exception\ActionAbort; 7 8/** 9 * Class Draftdel 10 * 11 * Delete a draft 12 * 13 * @package dokuwiki\Action 14 */ 15class Draftdel extends AbstractAction { 16 17 /** @inheritdoc */ 18 public function minimumPermission() { 19 return AUTH_EDIT; 20 } 21 22 /** 23 * Delete an existing draft for the current page and user if any 24 * 25 * Redirects to show, afterwards. 26 * 27 * @throws ActionAbort 28 */ 29 public function preProcess() { 30 global $INFO, $ID; 31 $draft = new Draft($ID, $INFO['client']); 32 if ($draft->isDraftAvailable() && checkSecurityToken()) { 33 $draft->deleteDraft(); 34 } 35 36 throw new ActionAbort('redirect'); 37 } 38 39} 40