From 11fbc49e36cec085086cd7b57f6e46249153de92 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 15 Apr 2011 18:40:25 +0000 Subject: [PATCH] * Pass around parser options instead of users and made some parser options consistency fixes * Moved makeParserOptions to Article.php * Renamed currentIncludeVersions -> getRevIncludes * Renamed updatePageCache -> setPageCache * Moved FlaggedRevs::getCacheKey up --- includes/Article.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 67c8f91e4a..dbb78f526e 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -4262,22 +4262,29 @@ class Article { /** * Get parser options suitable for rendering the primary article wikitext - * @return mixed ParserOptions object or boolean false + * @return ParserOptions object */ public function getParserOptions() { global $wgUser; - if ( !$this->mParserOptions ) { - $this->mParserOptions = new ParserOptions( $wgUser ); - $this->mParserOptions->setTidy( true ); - $this->mParserOptions->enableLimitReport(); + $this->mParserOptions = $this->makeParserOptions( $wgUser ); } - - // Clone to allow modifications of the return value without affecting - // the cache + // Clone to allow modifications of the return value without affecting cache return clone $this->mParserOptions; } + /** + * Get parser options suitable for rendering the primary article wikitext + * @param User $user + * @return ParserOptions + */ + public function makeParserOptions( User $user ) { + $options = ParserOptions::newFromUser( $user ); + $options->enableLimitReport(); // show inclusion/loop reports + $options->setTidy( true ); // fix bad HTML + return $options; + } + /** * Updates cascading protections * -- 2.20.1