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