r76968 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76967‎ | r76968 | r76969 >
Date:21:45, 18 November 2010
Author:aaron
Status:ok (Comments)
Tags:
Comment:
Follow-up r76692: just redirect out in this very unlikely case (rather than failing with stacktrace)
Modified paths:
  • /trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php
@@ -991,7 +991,7 @@
992992 * UI things back up, since RevisionReview expects either true
993993 * or a string message key
994994 */
995 - private function rejectConfirmationForm( Revision $oldRev, $newRev ) {
 995+ private function rejectConfirmationForm( Revision $oldRev, Revision $newRev ) {
996996 global $wgOut, $wgLang;
997997 $thisPage = SpecialPage::getTitleFor( 'RevisionReview' );
998998
@@ -1000,7 +1000,8 @@
10011001 $dbr = wfGetDB( DB_SLAVE );
10021002 $oldid = $dbr->addQuotes( $oldRev->getId() );
10031003 $newid = $dbr->addQuotes( $newRev->getId() );
1004 - $res = $dbr->select( 'revision', array( 'rev_id', 'rev_user_text' ),
 1004+ $res = $dbr->select( 'revision',
 1005+ array( 'rev_id', 'rev_user_text' ),
10051006 array(
10061007 'rev_id > ' . $oldid,
10071008 'rev_id <= ' . $newid,
@@ -1008,13 +1009,15 @@
10091010 ),
10101011 __METHOD__
10111012 );
 1013+ if ( !$dbr->numRows( $res ) ) { // sanity check
 1014+ $wgOut->redirect( $this->getPage()->getFullUrl() );
 1015+ return;
 1016+ }
10121017
10131018 $rejectIds = array();
1014 - if( $res ) {
1015 - foreach( $res as $r ) {
1016 - $rejectIds[$r->rev_id] =
1017 - "[[User:{$r->rev_user_text}|{$r->rev_user_text}]]";
1018 - }
 1019+ foreach( $res as $r ) {
 1020+ $rejectIds[$r->rev_id] =
 1021+ "[[User:{$r->rev_user_text}|{$r->rev_user_text}]]";
10191022 }
10201023
10211024 // List of revisions being undone...

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r76692First followup to r75408, sanity check on result objectdemon18:09, 15 November 2010

Comments

#Comment by 😂 (talk | contribs)   21:47, 18 November 2010

Yeah that's cleaner.

Status & tagging log