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