r52400 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52399‎ | r52400 | r52401 >
Date:15:27, 25 June 2009
Author:aaron
Status:ok
Tags:
Comment:
bug 19379 When moving pages from user namespace to article namespace, flag automatically
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -384,7 +384,7 @@
385385 # Clear dead config rows
386386 $wgHooks['ArticleDeleteComplete'][] = 'FlaggedRevsHooks::onArticleDelete';
387387 $wgHooks['ArticleRevisionVisiblitySet'][] = 'FlaggedRevsHooks::onRevisionDelete';
388 -$wgHooks['TitleMoveComplete'][] = 'FlaggedRevsHooks::updatePendingPostMove';
 388+$wgHooks['TitleMoveComplete'][] = 'FlaggedRevsHooks::onTitleMoveComplete';
389389 # Check on undelete/merge for changes to stable version
390390 $wgHooks['ArticleMergeComplete'][] = 'FlaggedRevsHooks::updateFromMerge';
391391 $wgHooks['ArticleRevisionUndeleted'][] = 'FlaggedRevsHooks::updateFromRestore';
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -164,12 +164,29 @@
165165 return true;
166166 }
167167
168 - public static function updatePendingPostMove( &$otitle, &$ntitle, $user, $pageId ) {
 168+ /**
 169+ * Update pending revision table
 170+ * Autoreview pages moved into content NS
 171+ */
 172+ public static function onTitleMoveComplete( &$otitle, &$ntitle, $user, $pageId ) {
 173+ global $wgFlaggedRevsAutoReviewNew;
169174 $fa = FlaggedArticle::getTitleInstance( $ntitle );
170 - // re-validate NS/config (new title may not be reviewable)
171 - if( !$fa->isReviewable() || !$fa->getStableRev(FR_MASTER) ) {
172 - self::clearDeadLinks( $pageId );
 175+ // Re-validate NS/config (new title may not be reviewable)
 176+ if( $fa->isReviewable() ) {
 177+ // Moved from non-reviewable to reviewable NS?
 178+ if( $wgFlaggedRevsAutoReviewNew && $user->isAllowed('autoreview')
 179+ && !FlaggedRevs::isPageReviewable( $otitle ) )
 180+ {
 181+ $article = new Article( $ntitle );
 182+ $rev = Revision::newFromTitle( $ntitle );
 183+ // Treat this kind of like a new page...
 184+ FlaggedRevs::autoReviewEdit( $article, $user, $rev->getText(), $rev );
 185+ return true; // pending list handled
 186+ } else if( $fa->getStableRev(FR_MASTER) ) {
 187+ return true; // nothing to do
 188+ }
173189 }
 190+ self::clearDeadLinks( $pageId );
174191 return true;
175192 }
176193

Status & tagging log