3 namespace dokuwiki\Action
;
5 use dokuwiki\Action\Exception\ActionAbort
;
6 use dokuwiki\Action\Exception\ActionException
;
11 * Quick revert to an old revision
13 * @package dokuwiki\Action
15 class Revert
extends AbstractUserAction
18 public function minimumPermission()
27 * @throws ActionException
28 * @todo check for writability of the current page ($INFO might do it wrong and check the attic version)
30 public function preProcess()
32 if (!checkSecurityToken()) throw new ActionException();
38 // when no revision is given, delete current one
39 // FIXME this feature is not exposed in the GUI currently
41 $sum = $lang['deleted'];
43 $text = rawWiki($ID, $REV);
44 if (!$text) throw new ActionException(); //something went wrong
45 $sum = sprintf($lang['restored'], dformat($REV));
49 if (checkwordblock($text)) {
50 msg($lang['wordblock'], -1);
51 throw new ActionException('edit');
54 saveWikiText($ID, $text, $sum, false);
58 // continue with draftdel -> redirect -> show
59 throw new ActionAbort('draftdel');