r70819 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70818‎ | r70819 | r70820 >
Date:14:23, 10 August 2010
Author:platonides
Status:resolved
Tags:
Comment:
Don't give a User to ParserCache::getKey (old prototype, changed in r48544) but a ParserOptions
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -515,7 +515,7 @@
516516 * @param int $id Source revision Id
517517 * @return ParserOutput
518518 */
519 - public static function parseStableText( Title $title, $text, $id ) {
 519+ public static function parseStableText( Title $title, $text, $id, $parserOptions = null ) {
520520 global $wgParser;
521521 # Notify Parser if includes should be stabilized
522522 $resetManager = false;
@@ -532,8 +532,9 @@
533533 }
534534 }
535535 # Parse the new body, wikitext -> html
536 - $options = self::makeParserOptions(); // default options
537 - $parserOut = $wgParser->parse( $text, $title, $options, true, true, $id );
 536+ if ( is_null( $parserOptions ) )
 537+ $parserOptions = self::makeParserOptions(); // default options
 538+ $parserOut = $wgParser->parse( $text, $title, $parserOptions, true, true, $id );
538539 # Stable parse done!
539540 if ( $resetManager ) {
540541 $incManager->clear(); // reset the FRInclusionManager as needed
@@ -607,20 +608,20 @@
608609 /**
609610 * Like ParserCache::getKey() with stable-pcache instead of pcache
610611 */
611 - public static function getCacheKey( $parserCache, Article $article, $user ) {
612 - $key = $parserCache->getKey( $article, $user );
 612+ protected static function getCacheKey( $parserCache, Article $article, $popts ) {
 613+ $key = $parserCache->getKey( $article, $popts );
613614 $key = str_replace( ':pcache:', ':stable-pcache:', $key );
614615 return $key;
615616 }
616617
617618 /**
618619 * @param Article $article
619 - * @param User $user
 620+ * @param ParserOptions $popts
620621 * @param parserOutput $parserOut
621622 * Updates the stable cache of a page with the given $parserOut
622623 */
623624 public static function updatePageCache(
624 - Article $article, $user, ParserOutput $parserOut = null
 625+ Article $article, $popts, ParserOutput $parserOut = null
625626 ) {
626627 global $parserMemc, $wgParserCacheExpireTime, $wgEnableParserCache;
627628 wfProfileIn( __METHOD__ );
@@ -630,7 +631,7 @@
631632 return false;
632633 }
633634 $parserCache = ParserCache::singleton();
634 - $key = self::getCacheKey( $parserCache, $article, $user );
 635+ $key = self::getCacheKey( $parserCache, $article, $popts );
635636 # Add cache mark to HTML
636637 $now = wfTimestampNow();
637638 $parserOut->setCacheTime( $now );
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -497,7 +497,8 @@
498498 $redirHtml = $this->getRedirectHtml( $text );
499499 if ( $redirHtml == '' ) {
500500 $parserOut = FlaggedRevs::parseStableText(
501 - $this->article->getTitle(), $text, $frev->getRevId() );
 501+ $this->article->getTitle(), $text, $frev->getRevId(),
 502+ FlaggedRevs::::makeParserOptions() );
502503 }
503504 # Construct some tagging for non-printable outputs. Note that the pending
504505 # notice has all this info already, so don't do this if we added that already.
@@ -574,10 +575,11 @@
575576 # Don't parse redirects, use separate handling...
576577 if ( $redirHtml == '' ) {
577578 # Get the new stable output
 579+ $parserOptions = FlaggedRevs::makeParserOptions();
578580 $parserOut = FlaggedRevs::parseStableText(
579 - $this->article->getTitle(), $text, $srev->getRevId() );
 581+ $this->article->getTitle(), $text, $srev->getRevId(), $parserOptions );
580582 # Update the stable version cache & dependancies
581 - FlaggedRevs::updatePageCache( $this->article, $wgUser, $parserOut );
 583+ FlaggedRevs::updatePageCache( $this->article, $parserOptions, $parserOut );
582584 FlaggedRevs::updateCacheTracking( $this->article, $parserOut );
583585 } else {
584586 $parserOut = null;

Follow-up revisions

RevisionCommit summaryAuthorDate
r70870Fix syntax error from r70819demon12:13, 11 August 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r48544Fixed bug #11213 - [edit] section links in printable version interfere with c...aboostani23:27, 18 March 2009

Status & tagging log