r101292 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101291‎ | r101292 | r101293 >
Date:00:11, 30 October 2011
Author:aaron
Status:ok
Tags:
Comment:
* Fixed undefined $rc var from r101286
* Made getRevQuality() and revIsFlagged() only need a rev ID
* Removed unused $wgUser
Modified paths:
  • /trunk/extensions/FlaggedRevs/business/RevisionReviewForm.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevision.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/FlaggablePageView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.hooks.php
@@ -474,7 +474,7 @@
475475 # has content different than what the user expected. However, if
476476 # the auto-merged edit was reviewed, then assume that it's OK.
477477 if ( $editTimestamp != $prevTimestamp
478 - && !FlaggedRevision::revIsFlagged( $title, $prevRevId, FR_MASTER )
 478+ && !FlaggedRevision::revIsFlagged( $prevRevId, FR_MASTER )
479479 ) {
480480 return false; // not flagged?
481481 }
@@ -601,7 +601,6 @@
602602 * (d) If the edit is neither reviewable nor patrolleable, silently mark it patrolled
603603 */
604604 public static function autoMarkPatrolled( RecentChange &$rc ) {
605 - global $wgUser;
606605 if ( empty( $rc->mAttribs['rc_this_oldid'] ) ) {
607606 return true;
608607 }
@@ -610,8 +609,7 @@
611610 // Is the page reviewable?
612611 if ( $fa->isReviewable() ) {
613612 $revId = $rc->mAttribs['rc_this_oldid'];
614 - $quality = FlaggedRevision::getRevQuality(
615 - $rc->mAttribs['rc_cur_id'], $revId, FR_MASTER );
 613+ $quality = FlaggedRevision::getRevQuality( $revId, FR_MASTER );
616614 // Reviewed => patrolled
617615 if ( $quality !== false && $quality >= FR_CHECKED ) {
618616 RevisionReviewForm::updateRecentChanges( $rc, 'patrol', $fa->getStableRev() );
Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevision.php
@@ -926,32 +926,29 @@
927927 }
928928
929929 /**
930 - * @param int $page_id
931930 * @param int $rev_id
932931 * @param $flags, FR_MASTER
933932 * @return mixed (int or false)
934933 * Get quality of a revision
935934 */
936 - public static function getRevQuality( $page_id, $rev_id, $flags = 0 ) {
 935+ public static function getRevQuality( $rev_id, $flags = 0 ) {
937936 $db = ( $flags & FR_MASTER ) ?
938937 wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
939938 return $db->selectField( 'flaggedrevs',
940939 'fr_quality',
941 - array( 'fr_page_id' => $page_id, 'fr_rev_id' => $rev_id ),
942 - __METHOD__,
943 - array( 'USE INDEX' => 'PRIMARY' )
 940+ array( 'fr_rev_id' => $rev_id ),
 941+ __METHOD__
944942 );
945943 }
946944
947945 /**
948 - * @param Title $title
949946 * @param int $rev_id
950947 * @param $flags, FR_MASTER
951948 * @return bool
952949 * Useful for quickly pinging to see if a revision is flagged
953950 */
954 - public static function revIsFlagged( Title $title, $rev_id, $flags = 0 ) {
955 - $quality = self::getRevQuality( $title->getArticleId(), $rev_id, $flags );
 951+ public static function revIsFlagged( $rev_id, $flags = 0 ) {
 952+ $quality = self::getRevQuality( $rev_id, $flags );
956953 return ( $quality !== false );
957954 }
958955
Index: trunk/extensions/FlaggedRevs/business/RevisionReviewForm.php
@@ -475,6 +475,9 @@
476476 /**
477477 * Update rc_patrolled fields in recent changes after (un)accepting a rev.
478478 * This maintains the patrolled <=> reviewed relationship for reviewable namespaces.
 479+ *
 480+ * RecentChange should only be passed in when an RC item is saved.
 481+ *
479482 * @param $rev Revision|RecentChange
480483 * @param $patrol string "patrol" or "unpatrol"
481484 * @param $srev FlaggedRevsion|null The new stable version
@@ -484,7 +487,7 @@
485488 global $wgUseRCPatrol;
486489
487490 if ( $rev instanceof RecentChange ) {
488 - $pageId = $rc->mAttribs['rc_cur_id'];
 491+ $pageId = $rev->mAttribs['rc_cur_id'];
489492 } else {
490493 $pageId = $rev->getPage();
491494 }
Index: trunk/extensions/FlaggedRevs/presentation/FlaggablePageView.php
@@ -1568,7 +1568,7 @@
15691569 protected static function getDiffRevMsgAndClass(
15701570 Revision $rev, FlaggedRevision $srev = null
15711571 ) {
1572 - $tier = FlaggedRevision::getRevQuality( $rev->getPage(), $rev->getId() );
 1572+ $tier = FlaggedRevision::getRevQuality( $rev->getId() );
15731573 if ( $tier !== false ) {
15741574 $msg = $tier
15751575 ? 'revreview-hist-quality'

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r101286* Cleanups to updateRecentChanges():...aaron21:36, 29 October 2011

Status & tagging log