* Pass around parser options instead of users and made some parser options consistenc...
authorAaron Schulz <aaron@users.mediawiki.org>
Fri, 15 Apr 2011 18:40:25 +0000 (18:40 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Fri, 15 Apr 2011 18:40:25 +0000 (18:40 +0000)
* Moved makeParserOptions to Article.php
* Renamed currentIncludeVersions -> getRevIncludes
* Renamed updatePageCache -> setPageCache
* Moved FlaggedRevs::getCacheKey up

includes/Article.php

index 67c8f91..dbb78f5 100644 (file)
@@ -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
         *