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 18 /** @inheritdoc */ 19 public function minimumPermission() 20 { 21 return AUTH_EDIT; 22 } 23 24 /** 25 * Delete an existing draft for the current page and user if any 26 * 27 * Redirects to show, afterwards. 28 * 29 * @throws ActionAbort 30 */ 31 public function preProcess() 32 { 33 global $INFO, $ID; 34 $draft = new Draft($ID, $INFO['client']); 35 if ($draft->isDraftAvailable() && checkSecurityToken()) { 36 $draft->deleteDraft(); 37 } 38 39 throw new ActionAbort('redirect'); 40 } 41} 42