diff options
Diffstat (limited to 'wiki/inc/Action/Draftdel.php')
-rw-r--r-- | wiki/inc/Action/Draftdel.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/wiki/inc/Action/Draftdel.php b/wiki/inc/Action/Draftdel.php new file mode 100644 index 0000000..77378f7 --- /dev/null +++ b/wiki/inc/Action/Draftdel.php @@ -0,0 +1,36 @@ +<?php + +namespace dokuwiki\Action; + +use dokuwiki\Action\Exception\ActionAbort; + +/** + * Class Draftdel + * + * Delete a draft + * + * @package dokuwiki\Action + */ +class Draftdel extends AbstractAction { + + /** @inheritdoc */ + public function minimumPermission() { + return AUTH_EDIT; + } + + /** + * Delete an existing draft if any + * + * Reads draft information from $INFO. Redirects to show, afterwards. + * + * @throws ActionAbort + */ + public function preProcess() { + global $INFO; + @unlink($INFO['draft']); + $INFO['draft'] = null; + + throw new ActionAbort('redirect'); + } + +} |