Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -467,7 +467,7 @@ |
468 | 468 | $wgHooks['ArticleSaveComplete'][] = 'FlaggedRevsHooks::maybeNullEditReview'; |
469 | 469 | |
470 | 470 | # Add CSS/JS as needed |
471 | | -$wgHooks['BeforePageDisplay'][] = 'FlaggedRevsHooks::injectStyleAndJS'; |
| 471 | +$wgHooks['BeforePageDisplay'][] = 'FlaggedRevsHooks::onBeforePageDisplay'; |
472 | 472 | $wgHooks['MakeGlobalVariablesScript'][] = 'FlaggedRevsHooks::injectGlobalJSVars'; |
473 | 473 | |
474 | 474 | # Extra cache updates for stable versions |
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php |
— | — | @@ -224,8 +224,8 @@ |
225 | 225 | |
226 | 226 | 'revreview-locked-title' => 'Edits must be reviewed before being published on this page.', |
227 | 227 | 'revreview-unlocked-title' => 'Edits do not require review before being published on this page.', |
228 | | - 'revreview-locked' => '\'\'\'Edits must be [[{{MediaWiki:Validationpage}}|reviewed]] before being published on this page.\'\'\'', |
229 | | - 'revreview-unlocked' => 'Edits do not require [[{{MediaWiki:Validationpage}}|review]] before being published on this page.', |
| 228 | + 'revreview-locked' => '\'\'\'Note:\'\'\' Edits must be [[{{MediaWiki:Validationpage}}|reviewed]] before being published on this page.', |
| 229 | + 'revreview-unlocked' => '\'\'\'Note:\'\'\' Edits do not require [[{{MediaWiki:Validationpage}}|review]] before being published on this page.', |
230 | 230 | |
231 | 231 | 'revreview-ak-review' => 's', # do not translate or duplicate this message to other languages |
232 | 232 | 'accesskey-ca-current' => 'v', # do not translate or duplicate this message to other languages |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -1541,7 +1541,11 @@ |
1542 | 1542 | $sv = FlaggedRevision::newFromStable( $article->getTitle(), FR_MASTER/*consistent*/ ); |
1543 | 1543 | if( $sv && $sv->getRevId() == $rev->getId() ) { |
1544 | 1544 | global $wgMemc; |
1545 | | - # Update stable cache |
| 1545 | + # Update stable page cache. Don't cache redirects; |
| 1546 | + # it would go unused and complicate things. |
| 1547 | + if( !Title::newFromRedirect( $text ) ) { |
| 1548 | + FlaggedRevs::updatePageCache( $article, $wgUser, $stableOutput ); |
| 1549 | + } |
1546 | 1550 | self::updatePageCache( $article, $user, $poutput ); |
1547 | 1551 | # Update page tracking fields |
1548 | 1552 | self::updateStableVersion( $article, $rev, $rev->getId() ); |
Index: trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php |
— | — | @@ -512,7 +512,8 @@ |
513 | 513 | # Set our versioning params cache |
514 | 514 | FlaggedRevs::setIncludeVersionCache( $rev->getId(), $tmpParams, $imgParams ); |
515 | 515 | # Parse the text and check if all templates/files match up |
516 | | - $stableOutput = FlaggedRevs::parseStableText( $article, $rev->getText(), $rev->getId() ); |
| 516 | + $text = $rev->getText(); |
| 517 | + $stableOutput = FlaggedRevs::parseStableText( $article, $text, $rev->getId() ); |
517 | 518 | $err =& $stableOutput->fr_includeErrors; |
518 | 519 | if( !$noMatch ) { // template/files must all be specified |
519 | 520 | if( !empty($err) |
— | — | @@ -592,8 +593,11 @@ |
593 | 594 | if( $sv && $sv->getRevId() == $rev->getId() ) { |
594 | 595 | global $wgParserCacheExpireTime; |
595 | 596 | $this->page->invalidateCache(); |
596 | | - # Update stable cache with the revision we reviewed |
597 | | - FlaggedRevs::updatePageCache( $article, $wgUser, $stableOutput ); |
| 597 | + # Update stable cache with the revision we reviewed. |
| 598 | + # Don't cache redirects; it would go unused and complicate things. |
| 599 | + if( !Title::newFromRedirect( $text ) ) { |
| 600 | + FlaggedRevs::updatePageCache( $article, $wgUser, $stableOutput ); |
| 601 | + } |
598 | 602 | # We can set the sync cache key already |
599 | 603 | $includesSynced = true; |
600 | 604 | if( $poutput->fr_newestImageTime > $stableOutput->fr_newestImageTime ) { |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | * Add FlaggedRevs css for relevant special pages. |
77 | 77 | */ |
78 | 78 | public static function InjectStyleForSpecial() { |
79 | | - global $wgTitle, $wgOut, $wgUser; |
| 79 | + global $wgTitle, $wgOut; |
80 | 80 | if( empty($wgTitle) || $wgTitle->getNamespace() !== NS_SPECIAL ) { |
81 | 81 | return true; |
82 | 82 | } |
— | — | @@ -95,6 +95,18 @@ |
96 | 96 | return true; |
97 | 97 | } |
98 | 98 | |
| 99 | + public static function onBeforePageDisplay() { |
| 100 | + global $wgOut; |
| 101 | + if( $wgOut->isArticleRelated() ) { |
| 102 | + $view = FlaggedArticleView::singleton(); |
| 103 | + $view->displayTag(); // show notice bar/icon in subtitle |
| 104 | + self::injectStyleAndJS(); // full CSS/JS |
| 105 | + } else { |
| 106 | + self::InjectStyleForSpecial(); // try special page CSS |
| 107 | + } |
| 108 | + return true; |
| 109 | + } |
| 110 | + |
99 | 111 | public static function markUnderReview( $output, $article, $title, $user, $request ) { |
100 | 112 | $action = $request->getVal( 'action', 'view' ); |
101 | 113 | $reviewing = ( $action == 'history' ); // default |
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | /** |
119 | 119 | * Output review notice |
120 | 120 | */ |
121 | | - protected function displayTag() { |
| 121 | + public function displayTag() { |
122 | 122 | global $wgOut, $wgRequest; |
123 | 123 | $this->load(); |
124 | 124 | // UI may be limited to unobtrusive patrolling system |
— | — | @@ -232,8 +232,6 @@ |
233 | 233 | if( is_null($frev) ) { |
234 | 234 | # Add "no reviewed version" tag, but not for printable output |
235 | 235 | $this->showUnreviewedPage( $tag, $prot ); |
236 | | - # Show notice bar/icon |
237 | | - $this->displayTag(); |
238 | 236 | return true; |
239 | 237 | } |
240 | 238 | # Get flags and date |
— | — | @@ -275,8 +273,6 @@ |
276 | 274 | "$tag</div>"; |
277 | 275 | $this->reviewNotice .= $tag; |
278 | 276 | } |
279 | | - # Show notice bar/icon |
280 | | - $this->displayTag(); |
281 | 277 | |
282 | 278 | return true; |
283 | 279 | } |
— | — | @@ -328,7 +324,7 @@ |
329 | 325 | # Get stable version sync status |
330 | 326 | $synced = FlaggedRevs::stableVersionIsSynced( $srev, $this->article ); |
331 | 327 | if( $synced ) { |
332 | | - $this->getReviewNotes( $srev ); // Still the same |
| 328 | + $this->setReviewNotes( $srev ); // Still the same |
333 | 329 | } else { |
334 | 330 | $this->maybeShowTopDiff( $srev, $quality ); // user may want diff (via prefs) |
335 | 331 | } |
— | — | @@ -464,7 +460,7 @@ |
465 | 461 | } |
466 | 462 | } |
467 | 463 | # Output HTML |
468 | | - $this->getReviewNotes( $frev ); |
| 464 | + $this->setReviewNotes( $frev ); |
469 | 465 | $wgOut->addParserOutput( $parserOut ); |
470 | 466 | # Index the stable version only |
471 | 467 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
— | — | @@ -488,12 +484,19 @@ |
489 | 485 | $quality = FlaggedRevs::isQuality( $flags ); |
490 | 486 | $pristine = FlaggedRevs::isPristine( $flags ); |
491 | 487 | # Get parsed stable version |
| 488 | + $redirHtml = ''; |
492 | 489 | $parserOut = FlaggedRevs::getPageCache( $this->article, $wgUser ); |
493 | 490 | if( $parserOut == false ) { |
494 | 491 | $text = $srev->getRevText(); |
495 | | - $parserOut = FlaggedRevs::parseStableText( $this->article, $text, $srev->getRevId() ); |
496 | | - # Update the stable version cache |
497 | | - FlaggedRevs::updatePageCache( $this->article, $wgUser, $parserOut ); |
| 492 | + # Check if this is a redirect... |
| 493 | + $rTarget = $this->article->followRedirectText( $text ); |
| 494 | + if( $rTarget ) { |
| 495 | + $redirHtml = $this->article->viewRedirect( $rTarget ); |
| 496 | + } else { |
| 497 | + $parserOut = FlaggedRevs::parseStableText( $this->article, $text, $srev->getRevId() ); |
| 498 | + # Update the stable version cache |
| 499 | + FlaggedRevs::updatePageCache( $this->article, $wgUser, $parserOut ); |
| 500 | + } |
498 | 501 | } |
499 | 502 | $synced = FlaggedRevs::stableVersionIsSynced( $srev, $this->article, $parserOut, null ); |
500 | 503 | # Construct some tagging |
— | — | @@ -537,8 +540,12 @@ |
538 | 541 | } |
539 | 542 | } |
540 | 543 | # Output HTML |
541 | | - $this->getReviewNotes( $srev ); |
542 | | - $wgOut->addParserOutput( $parserOut ); |
| 544 | + $this->setReviewNotes( $srev ); |
| 545 | + if( $redirHtml != '' ) { |
| 546 | + $wgOut->addHtml( $redirHtml ); |
| 547 | + } else { |
| 548 | + $wgOut->addParserOutput( $parserOut ); |
| 549 | + } |
543 | 550 | } |
544 | 551 | |
545 | 552 | /** |
— | — | @@ -1033,16 +1040,15 @@ |
1034 | 1041 | * @param FlaggedRevision $frev |
1035 | 1042 | * @return string, revision review notes |
1036 | 1043 | */ |
1037 | | - public function getReviewNotes( $frev ) { |
| 1044 | + public function setReviewNotes( $frev ) { |
1038 | 1045 | global $wgUser; |
1039 | 1046 | $this->load(); |
1040 | | - if( FlaggedRevs::allowComments() && $frev && $frev->getComment() ) { |
1041 | | - $notes = "<br /><div class='flaggedrevs_notes plainlinks'>"; |
1042 | | - $notes .= wfMsgExt('revreview-note', array('parseinline'), |
| 1047 | + if( $frev && FlaggedRevs::allowComments() && $frev->getComment() != '' ) { |
| 1048 | + $this->reviewNotes = "<br /><div class='flaggedrevs_notes plainlinks'>"; |
| 1049 | + $this->reviewNotes .= wfMsgExt('revreview-note', array('parseinline'), |
1043 | 1050 | User::whoIs( $frev->getUser() ) ); |
1044 | | - $notes .= '<br /><i>' . $wgUser->getSkin()->formatComment( $frev->getComment() ) . |
1045 | | - '</i></div>'; |
1046 | | - $this->reviewNotes = $notes; |
| 1051 | + $this->reviewNotes .= '<br /><i>' . |
| 1052 | + $wgUser->getSkin()->formatComment( $frev->getComment() ) . '</i></div>'; |
1047 | 1053 | } |
1048 | 1054 | } |
1049 | 1055 | |