Completed
Push — master ( 9b78f7...5dcb4f )
by Andreas
08:15 queued 03:39
created

Revert::__construct()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 9
nc 2
nop 0
dl 0
loc 12
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
namespace dokuwiki\Menu\Item;
4
5
/**
6
 * Class Revert
7
 *
8
 * Quick revert to the currently shown page revision
9
 */
10
class Revert extends AbstractItem {
11
12
    /** @inheritdoc */
13
    public function __construct() {
14
        global $REV;
15
        global $INFO;
16
        parent::__construct();
17
18
        if(!$INFO['ismanager'] || !$REV || !$INFO['writable']) {
19
            throw new \RuntimeException('revert not available');
20
        }
21
        $this->params['rev'] = $REV;
22
        $this->params['sectok'] = getSecurityToken();
23
        $this->svg = DOKU_INC . 'lib/images/menu/06-revert_replay.svg';
24
    }
25
26
}
27