Completed
Push — master ( 13ce47...b2c9cd )
by Andreas
10:39 queued 06:48
created

Draft::checkPreconditions()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace dokuwiki\Action;
4
5
use dokuwiki\Action\Exception\ActionException;
6
7
/**
8
 * Class Draft
9
 *
10
 * Screen to see and recover a draft
11
 *
12
 * @package dokuwiki\Action
13
 * @fixme combine with Recover?
14
 */
15
class Draft extends AbstractAction {
16
17
    /** @inheritdoc */
18
    public function minimumPermission() {
19
        global $INFO;
20
        if($INFO['exists']) {
21
            return AUTH_EDIT;
22
        } else {
23
            return AUTH_CREATE;
24
        }
25
    }
26
27
    /** @inheritdoc */
28
    public function checkPreconditions() {
29
        parent::checkPreconditions();
30
        global $INFO;
31
        if(!file_exists($INFO['draft'])) throw new ActionException('edit');
32
    }
33
34
    /** @inheritdoc */
35
    public function tplContent() {
36
        html_draft();
37
    }
38
39
}
40