Make transcluded special pages not disable cache in miser mode.
[lhc/web/wiklou.git] / includes / parser / Parser.php
index b563613..6c84623 100644 (file)
@@ -3125,6 +3125,7 @@ class Parser {
                                        && $this->mOptions->getAllowSpecialInclusion()
                                        && $this->ot['html']
                                ) {
+                                       $specialPage = SpecialPageFactory::getPage( $title->getDBkey() );
                                        // Pass the template arguments as URL parameters.
                                        // "uselang" will have no effect since the Language object
                                        // is forced to the one defined in ParserOptions.
@@ -3143,7 +3144,12 @@ class Parser {
                                        $context = new RequestContext;
                                        $context->setTitle( $title );
                                        $context->setRequest( new FauxRequest( $pageArgs ) );
-                                       $context->setUser( $this->getUser() );
+                                       if ( $specialPage && $specialPage->maxIncludeCacheTime() === 0 ) {
+                                               $context->setUser( $this->getUser() );
+                                       } else {
+                                               // If this page is cached, then we better not be per user.
+                                               $context->setUser( User::newFromName( '127.0.0.1', false ) );
+                                       }
                                        $context->setLanguage( $this->mOptions->getUserLangObj() );
                                        $ret = SpecialPageFactory::capturePath( $title, $context );
                                        if ( $ret ) {
@@ -3151,8 +3157,9 @@ class Parser {
                                                $this->mOutput->addOutputPageMetadata( $context->getOutput() );
                                                $found = true;
                                                $isHTML = true;
-                                               // Severely reduce cache time to keep content dynamic
-                                               $this->mOutput->updateCacheExpiry( 30 );
+                                               if ( $specialPage && $specialPage->maxIncludeCacheTime() !== false ) {
+                                                       $this->mOutput->updateCacheExpiry( $specialPage->maxIncludeCacheTime() );
+                                               }
                                        }
                                } elseif ( MWNamespace::isNonincludable( $title->getNamespace() ) ) {
                                        $found = false; # access denied