From: Aaron Schulz Date: Fri, 15 Apr 2011 18:40:25 +0000 (+0000) Subject: * Pass around parser options instead of users and made some parser options consistenc... X-Git-Tag: 1.31.0-rc.0~30818 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=11fbc49e36cec085086cd7b57f6e46249153de92;p=lhc%2Fweb%2Fwiklou.git * 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 --- 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 *