xref: /dokuwiki/inc/Menu/Item/Revert.php (revision 93b8c351fad5246a7a91c86418f15bec833dc99f)
1*93b8c351SAndreas Gohr<?php
2*93b8c351SAndreas Gohr
3*93b8c351SAndreas Gohrnamespace dokuwiki\Menu\Item;
4*93b8c351SAndreas Gohr
5*93b8c351SAndreas Gohrclass Revert extends AbstractItem {
6*93b8c351SAndreas Gohr
7*93b8c351SAndreas Gohr    /** @inheritdoc */
8*93b8c351SAndreas Gohr    public function __construct() {
9*93b8c351SAndreas Gohr        global $REV;
10*93b8c351SAndreas Gohr        global $INFO;
11*93b8c351SAndreas Gohr        parent::__construct();
12*93b8c351SAndreas Gohr
13*93b8c351SAndreas Gohr        if(!$INFO['ismanager'] || !$REV || !$INFO['writable']) {
14*93b8c351SAndreas Gohr            throw new \RuntimeException('revert not available');
15*93b8c351SAndreas Gohr        }
16*93b8c351SAndreas Gohr        $this->params['rev'] = $REV;
17*93b8c351SAndreas Gohr        $this->params['sectok'] = getSecurityToken();
18*93b8c351SAndreas Gohr        $this->svg = DOKU_BASE . 'lib/images/menu/06-revert_replay.svg';
19*93b8c351SAndreas Gohr    }
20*93b8c351SAndreas Gohr
21*93b8c351SAndreas Gohr}
22