Merge "Remove math specific code from ParserOptions"
[lhc/web/wiklou.git] / includes / parser / ParserCache.php
index 7053f13..9eaa3e2 100644 (file)
@@ -27,8 +27,6 @@
  */
 class ParserCache {
        private $mMemc;
-       const try116cache = false; /* Only useful $wgParserCacheExpireTime after updating to 1.17 */
-
        /**
         * Get an instance of this object
         *
@@ -146,7 +144,7 @@ class ParserCache {
                        $usedOptions = $optionsKey->mUsedOptions;
                        wfDebug( "Parser cache options found.\n" );
                } else {
-                       if ( !$useOutdated && !self::try116cache ) {
+                       if ( !$useOutdated ) {
                                return false;
                        }
                        $usedOptions = ParserOptions::legacyOptions();
@@ -186,12 +184,6 @@ class ParserCache {
                }
 
                $value = $this->mMemc->get( $parserOutputKey );
-               if ( self::try116cache && !$value && strpos( $value, '*' ) !== -1 ) {
-                       wfDebug( "New format parser cache miss.\n" );
-                       $parserOutputKey = $this->getParserOutputKey( $article,
-                               $popts->optionsHash( ParserOptions::legacyOptions(), $article->getTitle() ) );
-                       $value = $this->mMemc->get( $parserOutputKey );
-               }
                if ( !$value ) {
                        wfDebug( "ParserOutput cache miss.\n" );
                        wfIncrStats( "pcache_miss_absent" );
@@ -220,12 +212,12 @@ class ParserCache {
        }
 
        /**
-        * @param $parserOutput ParserOutput
-        * @param $article Article
-        * @param $popts ParserOptions
-        * @param $cacheTime Time when the cache was generated
+        * @param ParserOutput $parserOutput
+        * @param WikiPage $page
+        * @param ParserOptions $popts
+        * @param string $cacheTime Time when the cache was generated
         */
-       public function save( $parserOutput, $article, $popts, $cacheTime = null ) {
+       public function save( $parserOutput, $page, $popts, $cacheTime = null ) {
                $expire = $parserOutput->getCacheExpiry();
                if ( $expire > 0 ) {
                        $cacheTime = $cacheTime ?: wfTimestampNow();
@@ -239,11 +231,11 @@ class ParserCache {
 
                        $optionsKey->setContainsOldMagic( $parserOutput->containsOldMagic() );
 
-                       $parserOutputKey = $this->getParserOutputKey( $article,
-                               $popts->optionsHash( $optionsKey->mUsedOptions, $article->getTitle() ) );
+                       $parserOutputKey = $this->getParserOutputKey( $page,
+                               $popts->optionsHash( $optionsKey->mUsedOptions, $page->getTitle() ) );
 
                        // Save the timestamp so that we don't have to load the revision row on view
-                       $parserOutput->setTimestamp( $article->getTimestamp() );
+                       $parserOutput->setTimestamp( $page->getTimestamp() );
 
                        $parserOutput->mText .= "\n<!-- Saved in parser cache with key $parserOutputKey and timestamp $cacheTime\n -->\n";
                        wfDebug( "Saved in parser cache with key $parserOutputKey and timestamp $cacheTime\n" );
@@ -252,7 +244,7 @@ class ParserCache {
                        $this->mMemc->set( $parserOutputKey, $parserOutput, $expire );
 
                        // ...and its pointer
-                       $this->mMemc->set( $this->getOptionsKey( $article ), $optionsKey, $expire );
+                       $this->mMemc->set( $this->getOptionsKey( $page ), $optionsKey, $expire );
                } else {
                        wfDebug( "Parser output was marked as uncacheable and has not been saved.\n" );
                }