From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- includes/actions/MarkpatrolledAction.php | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'includes/actions/MarkpatrolledAction.php') diff --git a/includes/actions/MarkpatrolledAction.php b/includes/actions/MarkpatrolledAction.php index a5d76627..ae9223f4 100644 --- a/includes/actions/MarkpatrolledAction.php +++ b/includes/actions/MarkpatrolledAction.php @@ -28,30 +28,25 @@ class MarkpatrolledAction extends FormlessAction { return 'markpatrolled'; } - public function getRestriction() { - return 'read'; - } - protected function getDescription() { return ''; } - protected function checkCanExecute( User $user ) { - if ( !$user->matchEditToken( $this->getRequest()->getVal( 'token' ), $this->getRequest()->getInt( 'rcid' ) ) ) { - throw new ErrorPageError( 'sessionfailure-title', 'sessionfailure' ); - } - - return parent::checkCanExecute( $user ); - } - public function onView() { - $rc = RecentChange::newFromId( $this->getRequest()->getInt( 'rcid' ) ); + $request = $this->getRequest(); + $rcId = $request->getInt( 'rcid' ); + $rc = RecentChange::newFromId( $rcId ); if ( is_null( $rc ) ) { throw new ErrorPageError( 'markedaspatrollederror', 'markedaspatrollederrortext' ); } - $errors = $rc->doMarkPatrolled( $this->getUser() ); + $user = $this->getUser(); + if ( !$user->matchEditToken( $request->getVal( 'token' ), $rcId ) ) { + throw new ErrorPageError( 'sessionfailure-title', 'sessionfailure' ); + } + + $errors = $rc->doMarkPatrolled( $user ); if ( in_array( array( 'rcpatroldisabled' ), $errors ) ) { throw new ErrorPageError( 'rcpatroldisabled', 'rcpatroldisabledtext' ); @@ -67,19 +62,18 @@ class MarkpatrolledAction extends FormlessAction { $return = SpecialPage::getTitleFor( $returnto ); if ( in_array( array( 'markedaspatrollederror-noautopatrol' ), $errors ) ) { - $this->getOutput()->setPageTitle( wfMsg( 'markedaspatrollederror' ) ); + $this->getOutput()->setPageTitle( $this->msg( 'markedaspatrollederror' ) ); $this->getOutput()->addWikiMsg( 'markedaspatrollederror-noautopatrol' ); $this->getOutput()->returnToMain( null, $return ); return; } - if ( !empty( $errors ) ) { - $this->getOutput()->showPermissionsErrorPage( $errors ); - return; + if ( count( $errors ) ) { + throw new PermissionsError( 'patrol', $errors ); } # Inform the user - $this->getOutput()->setPageTitle( wfMsg( 'markedaspatrolled' ) ); + $this->getOutput()->setPageTitle( $this->msg( 'markedaspatrolled' ) ); $this->getOutput()->addWikiMsg( 'markedaspatrolledtext', $rc->getTitle()->getPrefixedText() ); $this->getOutput()->returnToMain( null, $return ); } -- cgit v1.2.3-54-g00ecf