X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Factions%2FRevertAction.php;h=d025878491a2dfc5efc6211e42499b97867764f6;hb=79557c5fb351c92c657e2ed6d03ff6b8a3bd55a0;hp=92428cf1eb2db6735e6bfc694f4b7bfd359d7103;hpb=cbcdf9314d572d64216ea95ba765f347f4cf0504;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/actions/RevertAction.php b/includes/actions/RevertAction.php index 92428cf1eb..d025878491 100644 --- a/includes/actions/RevertAction.php +++ b/includes/actions/RevertAction.php @@ -24,30 +24,11 @@ */ /** - * Dummy class for pages not in NS_FILE - * - * @ingroup Actions - */ -class RevertAction extends Action { - - public function getName() { - return 'revert'; - } - - public function show() { - $this->getOutput()->showErrorPage( 'nosuchaction', 'nosuchactiontext' ); - } - - public function execute() { - } -} - -/** - * Class for pages in NS_FILE + * File reversion user interface * * @ingroup Actions */ -class RevertFileAction extends FormAction { +class RevertAction extends FormAction { /** * @var OldLocalFile */ @@ -62,6 +43,9 @@ class RevertFileAction extends FormAction { } protected function checkCanExecute( User $user ) { + if ( $this->getTitle()->getNamespace() !== NS_FILE ) { + throw new ErrorPageError( $this->msg( 'nosuchaction' ), $this->msg( 'nosuchactiontext' ) ); + } parent::checkCanExecute( $user ); $oldimage = $this->getRequest()->getText( 'oldimage' ); @@ -160,8 +144,6 @@ class RevertFileAction extends FormAction { } protected function getDescription() { - $this->getOutput()->addBacklinkSubtitle( $this->getTitle() ); - - return ''; + return OutputPage::buildBacklinkSubtitle( $this->getTitle() ); } }