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