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    /** @inheritdoc */
13    public function __construct()
14    {
15        global $REV;
16        global $INFO;
17        global $INPUT;
18        parent::__construct();
19
20        if (!$REV || !$INFO['writable'] || $INPUT->server->str('REMOTE_USER') === '') {
21            throw new \RuntimeException('revert not available');
22        }
23        $this->params['rev'] = $REV;
24        $this->params['sectok'] = getSecurityToken();
25        $this->svg = DOKU_INC . 'lib/images/menu/06-revert_replay.svg';
26    }
27}
28