r112181 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112180‎ | r112181 | r112182 >
Date:02:04, 23 February 2012
Author:yaron
Status:deferred
Tags:
Comment:
Renamed onArticleViewHeader() to setArticleHeader(), to be more descriptive; fixed caching when $egApprovedRevsBlankIfUnapproved is set
Modified paths:
  • /trunk/extensions/ApprovedRevs/ApprovedRevs.hooks.php (modified) (history)
  • /trunk/extensions/ApprovedRevs/ApprovedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ApprovedRevs/ApprovedRevs.php
@@ -64,7 +64,7 @@
6565 $wgHooks['LoadExtensionSchemaUpdates'][] = 'ApprovedRevsHooks::describeDBSchema';
6666 $wgHooks['EditPage::showEditForm:initial'][] = 'ApprovedRevsHooks::addWarningToEditPage';
6767 $wgHooks['sfHTMLBeforeForm'][] = 'ApprovedRevsHooks::addWarningToSFForm';
68 -$wgHooks['ArticleViewHeader'][] = 'ApprovedRevsHooks::onArticleViewHeader';
 68+$wgHooks['ArticleViewHeader'][] = 'ApprovedRevsHooks::setArticleHeader';
6969
7070 // logging
7171 $wgLogTypes['approval'] = 'approval';
Index: trunk/extensions/ApprovedRevs/ApprovedRevs.hooks.php
@@ -584,7 +584,7 @@
585585 *
586586 * @return true
587587 */
588 - public static function onArticleViewHeader( Article &$article, &$outputDone, &$useParserCache ) {
 588+ public static function setArticleHeader( Article &$article, &$outputDone, &$useParserCache ) {
589589 global $wgOut, $wgRequest, $egApprovedRevsBlankIfUnapproved;
590590
591591 if ( ApprovedRevs::pageIsApprovable( $article->getTitle() )
@@ -594,6 +594,10 @@
595595
596596 if ( $egApprovedRevsBlankIfUnapproved &&
597597 ( empty( $approvedId ) || ( $wgRequest->getCheck( 'oldid' ) && $wgRequest->getInt( 'oldid' ) != $approvedId ) ) ) {
 598+ // Disable caching, so that if it's a specific
 599+ // ID being shown that happens to be the
 600+ // latest, it doesn't show a blank page.
 601+ $useParserCache = false;
598602 $wgOut->addHTML( '<span style="margin-left:10.75px">' );
599603
600604 if ( $wgRequest->getCheck( 'oldid' ) ) {
@@ -629,5 +633,4 @@
630634
631635 return true;
632636 }
633 -
634637 }

Status & tagging log