r112935 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112934‎ | r112935 | r112936 >
Date:10:47, 3 March 2012
Author:aaron
Status:ok
Tags:
Comment:
Optimized onTitleMoveComplete() to avoid master DB queries
Modified paths:
  • /trunk/extensions/FlaggedRevs/backend/FlaggedRevs.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/backend/FlaggedRevs.hooks.php
@@ -57,27 +57,27 @@
5858
5959 /**
6060 * (a) Update flaggedrevs page/tracking tables
61 - * (b) Autoreview pages moved into content NS
 61+ * (b) Autoreview pages moved into reviewable namespaces (bug 19379)
6262 */
6363 public static function onTitleMoveComplete(
6464 Title $otitle, Title $ntitle, $user, $pageId
6565 ) {
66 - $fa = FlaggableWikiPage::getTitleInstance( $ntitle );
67 - $fa->loadPageData( 'fromdbmaster' );
68 - // Re-validate NS/config (new title may not be reviewable)
69 - if ( $fa->isReviewable() ) {
70 - // Moved from non-reviewable to reviewable NS?
71 - // Auto-review such edits like new pages...
72 - if ( !FlaggedRevs::inReviewNamespace( $otitle )
73 - && FlaggedRevs::autoReviewNewPages()
74 - && $ntitle->userCan( 'autoreview' ) )
75 - {
 66+ if ( !FlaggedRevs::inReviewNamespace( $otitle )
 67+ && FlaggedRevs::inReviewNamespace( $ntitle )
 68+ && FlaggedRevs::autoReviewNewPages()
 69+ ) {
 70+ $fa = FlaggableWikiPage::getTitleInstance( $ntitle );
 71+ $fa->loadPageData( 'fromdbmaster' );
 72+ // Re-validate NS/config (new title may not be reviewable)
 73+ if ( $fa->isReviewable() && $ntitle->userCan( 'autoreview' ) ) {
 74+ // Auto-review such edits like new pages...
7675 $rev = Revision::newFromTitle( $ntitle );
7776 if ( $rev ) { // sanity
7877 FlaggedRevs::autoReviewEdit( $fa, $user, $rev );
7978 }
8079 }
8180 }
 81+
8282 # Update page and tracking tables and clear cache
8383 FlaggedRevs::stableVersionUpdates( $otitle );
8484 FlaggedRevs::HTMLCacheUpdates( $otitle );

Status & tagging log