Merge "Move up devunt's name to Developers"
[lhc/web/wiklou.git] / includes / parser / ParserCache.php
index 21486ff..9e96540 100644 (file)
@@ -72,12 +72,19 @@ class ParserCache {
        }
 
        /**
-        * @param WikiPage $article
+        * @param WikiPage $page
         * @return mixed|string
         */
-       protected function getOptionsKey( $article ) {
-               $pageid = $article->getId();
-               return wfMemcKey( 'pcache', 'idoptions', "{$pageid}" );
+       protected function getOptionsKey( $page ) {
+               return wfMemcKey( 'pcache', 'idoptions', $page->getId() );
+       }
+
+       /**
+        * @param WikiPage $page
+        * @since 1.28
+        */
+       public function deleteOptionsKey( $page ) {
+               $this->mMemc->delete( $this->getOptionsKey( $page ) );
        }
 
        /**
@@ -262,7 +269,7 @@ class ParserCache {
         */
        public function save( $parserOutput, $page, $popts, $cacheTime = null, $revId = null ) {
                $expire = $parserOutput->getCacheExpiry();
-               if ( $expire > 0 ) {
+               if ( $expire > 0 && !$this->mMemc instanceof EmptyBagOStuff ) {
                        $cacheTime = $cacheTime ?: wfTimestampNow();
                        if ( !$revId ) {
                                $revision = $page->getRevision();
@@ -302,7 +309,7 @@ class ParserCache {
                                'ParserCacheSaveComplete',
                                [ $this, $parserOutput, $page->getTitle(), $popts, $revId ]
                        );
-               } else {
+               } elseif ( $expire <= 0 ) {
                        wfDebug( "Parser output was marked as uncacheable and has not been saved.\n" );
                }
        }