r22441 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22440‎ | r22441 | r22442 >
Date:22:39, 25 May 2007
Author:aaron
Status:old
Tags:
Comment:
*Fix bug causing tags to get fucked up when parsed
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -131,18 +131,18 @@
132132 * All included pages/arguments are expanded out
133133 */
134134 public static function expandText( $text, $title ) {
135 - global $wgTitle;
 135+ global $wgParser;
 136+
 137+ $text = $text ? $text : '';
 138+ $wgParser->isStable = true; // Causes our hooks to trigger
136139
137 - if( !$text ) return '';
138 -
139 - $svParser = new Parser();
140 - $svParser->isStable = true;
141 -
142140 $options = new ParserOptions;
143 - $options->setRemoveComments( true ); // Less bandwidth maybe...
144 - $output = $svParser->preprocess( $text, $title, $options );
 141+ $options->setRemoveComments( true ); // Less banwidth?
 142+ $outputText = $wgParser->preprocess( $text, $title, $options );
145143
146 - return $output;
 144+ $wgParser->isStable = false; // Done!
 145+
 146+ return $outputText;
147147 }
148148
149149 /**
@@ -154,18 +154,17 @@
155155 * Get the HTML of a revision based on how it was during $timeframe
156156 */
157157 public static function parseStableText( $title, $text, $id=NULL, $options ) {
158 - global $wgUser;
 158+ global $wgParser;
159159
160 - $svParser = new Parser();
161 - $svParser->isStable = true;
162 -
163 - $options->setTidy(true);
 160+ $wgParser->isStable = true; // Causes our hooks to trigger
164161 # Don't show section-edit links
165162 # They can be old and misleading
166163 $options->setEditSection(false);
167164 # Parse the new body, wikitext -> html
168 - $parserOut = $svParser->parse( $text, $title, $options, true, true, $id );
 165+ $parserOut = $wgParser->parse( $text, $title, $options, true, true, $id );
169166
 167+ $wgParser->isStable = false; // Done!
 168+
170169 return $parserOut;
171170 }
172171
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.body.php
@@ -382,9 +382,6 @@
383383 // Update the article review log
384384 $this->updateLog( $this->page, $this->dims, $this->comment, $this->oldid, false );
385385
386 - # Clear the cache...
387 - $this->page->invalidateCache();
388 -
389386 $article = new Article( $this->page );
390387 // Update the links tables as a new stable version
391388 // may now be the default page.
@@ -397,8 +394,8 @@
398395 $u = new LinksUpdate( $this->page, $poutput );
399396 $u->doUpdate();
400397
401 - # Might as well update the cache while we're at it
402 - $parserCache->save( $poutput, $article, $wgUser );
 398+ # Clear the cache...
 399+ $this->page->invalidateCache();
403400 # Purge squid for this page only
404401 $this->page->purgeSquid();
405402