http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73817
Revision: 73817
Author: platonides
Date: 2010-09-27 16:13:39 +0000 (Mon, 27 Sep 2010)
Log Message:
-----------
Rename a variable, add some comment, spacing, and move article parsing with
article output, instead of getting the content at the top of the functions,
determine &$tag in the middle and then reevaluate the $redirHtml branch for
output.
Modified Paths:
--------------
trunk/extensions/FlaggedRevs/FlaggedArticleView.php
trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
Modified: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
===================================================================
--- trunk/extensions/FlaggedRevs/FlaggedArticleView.php 2010-09-27 15:59:58 UTC
(rev 73816)
+++ trunk/extensions/FlaggedRevs/FlaggedArticleView.php 2010-09-27 16:13:39 UTC
(rev 73817)
@@ -223,7 +223,7 @@
* Adds stable version status/info tags and notes
* Adds a quick review form on the bottom if needed
*/
- public function setPageContent( &$outputDone, &$pcache ) {
+ public function setPageContent( &$outputDone, &$useParserCache ) {
global $wgRequest, $wgOut, $wgLang, $wgContLang;
$this->load();
# Only trigger on article view for content pages, not for
protect/delete/hist...
@@ -267,7 +267,7 @@
$wgOut->returnToMain( false, $this->article->getTitle()
);
# Tell MW that parser output is done
$outputDone = true;
- $pcache = false;
+ $useParserCache = false;
return true;
}
// Is the page config altered?
@@ -291,13 +291,13 @@
if ( $old ) {
$this->showOldReviewedVersion( $srev, $frev, $tag,
$prot );
$outputDone = true; # Tell MW that parser output is done
- $pcache = false;
+ $useParserCache = false;
// Stable version requested by ID or relevant conditions met to
// to override page view.
} else if ( $stable || $this->pageOverride() ) {
- $this->showStableVersion( $srev, $tag, $prot );
+ $this->showStableVersion( $srev, $tag, $prot );
$outputDone = true; # Tell MW that parser output is done
- $pcache = false;
+ $useParserCache = false;
// Looking at some specific old revision (&oldid=x) or if
FlaggedRevs is not
// set to override given the relevant conditions (like
&stable=0) or there
// is no stable version.
@@ -494,14 +494,7 @@
# Get quality level
$quality = FlaggedRevs::isQuality( $flags );
$pristine = FlaggedRevs::isPristine( $flags );
- $text = $frev->getRevText();
- # Check if this is a redirect...
- $redirHtml = $this->getRedirectHtml( $text );
- if ( $redirHtml == '' ) {
- $parserOptions = FlaggedRevs::makeParserOptions();
- $parserOut = FlaggedRevs::parseStableText(
- $this->article->getTitle(), $text,
$frev->getRevId(), $parserOptions );
- }
+
# Construct some tagging for non-printable outputs. Note that
the pending
# notice has all this info already, so don't do this if we
added that already.
if ( !$wgOut->isPrintable() ) {
@@ -541,12 +534,21 @@
}
}
}
- # Output HTML
+ # Load the review notes which will be shown by
onSkinAfterContent
$this->setReviewNotes( $frev );
- if ( $redirHtml != '' ) {
+
+ # Check if this is a redirect...
+ $text = $frev->getRevText();
+ $redirHtml = $this->getRedirectHtml( $text );
+
+ # Parse and output HTML
+ if ( $redirHtml == '' ) {
+ $parserOptions = FlaggedRevs::makeParserOptions();
+ $parserOut = FlaggedRevs::parseStableText(
+ $this->article->getTitle(), $text,
$frev->getRevId(), $parserOptions );
+ $this->addParserOutput( $parserOut );
+ } else {
$wgOut->addHtml( $redirHtml );
- } else {
- $this->addParserOutput( $parserOut );
}
}
@@ -567,26 +569,7 @@
# Get quality level
$quality = FlaggedRevs::isQuality( $flags );
$pristine = FlaggedRevs::isPristine( $flags );
- # Get parsed stable version
- $redirHtml = '';
- $parserOut = FlaggedRevs::getPageCache( $this->article, $wgUser
);
- if ( !$parserOut ) {
- $text = $srev->getRevText();
- # Check if this is a redirect...
- $redirHtml = $this->getRedirectHtml( $text );
- # Don't parse redirects, use separate handling...
- if ( $redirHtml == '' ) {
- # Get the new stable output
- $parserOptions =
FlaggedRevs::makeParserOptions();
- $parserOut = FlaggedRevs::parseStableText(
- $this->article->getTitle(), $text,
$srev->getRevId(), $parserOptions );
- # Update the stable version cache & dependancies
- FlaggedRevs::updatePageCache( $this->article,
$parserOptions, $parserOut );
- FlaggedRevs::updateCacheTracking(
$this->article, $parserOut );
- } else {
- $parserOut = null;
- }
- }
+
$synced = $this->article->stableVersionIsSynced();
# Construct some tagging
if ( !$wgOut->isPrintable() && !(
$this->article->lowProfileUI() && $synced ) ) {
@@ -632,13 +615,31 @@
}
}
}
- # Output HTML
+
+ # Load the review notes which will be shown by
onSkinAfterContent
$this->setReviewNotes( $srev );
- if ( $redirHtml != '' ) {
- $wgOut->addHtml( $redirHtml );
- } else {
- // $parserOut will not be null here
- $this->addParserOutput( $parserOut );
+
+ # Get parsed stable version and output HTML
+ $redirHtml = '';
+ $parserOut = FlaggedRevs::getPageCache( $this->article, $wgUser
);
+ if ( !$parserOut ) {
+ $text = $srev->getRevText();
+ # Check if this is a redirect...
+ $redirHtml = $this->getRedirectHtml( $text );
+ # Don't parse redirects, use separate handling...
+ if ( $redirHtml == '' ) {
+ # Get the new stable output
+ $parserOptions =
FlaggedRevs::makeParserOptions();
+ $parserOut = FlaggedRevs::parseStableText(
+ $this->article->getTitle(), $text,
$srev->getRevId(), $parserOptions );
+ # Update the stable version cache & dependancies
+ FlaggedRevs::updatePageCache( $this->article,
$parserOptions, $parserOut );
+ FlaggedRevs::updateCacheTracking(
$this->article, $parserOut );
+
+ $this->addParserOutput( $parserOut );
+ } else {
+ $wgOut->addHtml( $redirHtml );
+ }
}
}
Modified: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
===================================================================
--- trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php 2010-09-27 15:59:58 UTC
(rev 73816)
+++ trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php 2010-09-27 16:13:39 UTC
(rev 73817)
@@ -1440,10 +1440,10 @@
return true;
}
- public static function onArticleViewHeader( &$article, &$outputDone,
&$pcache ) {
+ public static function onArticleViewHeader( &$article, &$outputDone,
&$useParserCache ) {
$view = FlaggedArticleView::singleton();
- $view->addStableLink( $outputDone, $pcache );
- $view->setPageContent( $outputDone, $pcache );
+ $view->addStableLink( $outputDone, $useParserCache );
+ $view->setPageContent( $outputDone, $useParserCache );
return true;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs