diff options
Diffstat (limited to 'platform/www/inc/Action/Draftdel.php')
-rw-r--r-- | platform/www/inc/Action/Draftdel.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/platform/www/inc/Action/Draftdel.php b/platform/www/inc/Action/Draftdel.php new file mode 100644 index 0000000..756c0e8 --- /dev/null +++ b/platform/www/inc/Action/Draftdel.php @@ -0,0 +1,38 @@ +<?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 for the current page and user if any + * + * Redirects to show, afterwards. + * + * @throws ActionAbort + */ + public function preProcess() { + global $INFO, $ID; + $draft = new \dokuwiki\Draft($ID, $INFO['client']); + if ($draft->isDraftAvailable()) { + $draft->deleteDraft(); + } + + throw new ActionAbort('redirect'); + } + +} |