xref: /dokuwiki/inc/Action/Draftdel.php (revision b4f2363aa1360136c8a826f09aaebc6505211c73)
1<?php
2
3namespace dokuwiki\Action;
4
5use dokuwiki\Action\Exception\ActionAbort;
6
7/**
8 * Class Draftdel
9 *
10 * Delete a draft
11 *
12 * @package dokuwiki\Action
13 */
14class Draftdel extends AbstractAction {
15
16    /** @inheritdoc */
17    public function minimumPermission() {
18        return AUTH_EDIT;
19    }
20
21    /**
22     * Delete an existing draft if any
23     *
24     * Reads draft information from $INFO. Redirects to show, afterwards.
25     *
26     * @throws ActionAbort
27     */
28    public function preProcess() {
29        global $INFO;
30        @unlink($INFO['draft']);
31        $INFO['draft'] = null;
32
33        throw new ActionAbort('redirect');
34    }
35
36}
37