Merge "Simplify and cleanup maxIncludeCacheTime() code"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 15 Jun 2016 22:39:50 +0000 (22:39 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 15 Jun 2016 22:39:50 +0000 (22:39 +0000)
includes/specialpage/SpecialPage.php
includes/specials/SpecialNewpages.php
includes/specials/SpecialRecentchanges.php

index 6624414..f478203 100644 (file)
@@ -186,12 +186,14 @@ class SpecialPage {
         *  false to use the parent page's cache settings
         */
        public function maxIncludeCacheTime() {
-               global $wgMiserMode;
-               if ( !$wgMiserMode ) {
-                       return 0;
-               } else {
-                       return 60*60;
-               }
+               return $this->getConfig()->get( 'MiserMode' ) ? $this->getCacheTTL() : 0;
+       }
+
+       /**
+        * @return int Seconds that this page can be cached
+        */
+       protected function getCacheTTL() {
+               return 60 * 60;
        }
 
        /**
index ff9a899..41890f2 100644 (file)
@@ -479,17 +479,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                return 'changes';
        }
 
-       /**
-        * How long to cache page when it is being included.
-        *
-        * @return int Time in seconds, 0 to disable caching altogether
-        */
-       public function maxIncludeCacheTime() {
-               global $wgMiserMode;
-               if ( !$wgMiserMode ) {
-                       return 0;
-               } else {
-                       return 60*5;
-               }
+       protected function getCacheTTL() {
+               return 60 * 5;
        }
 }
index 36ccd4a..00e07bd 100644 (file)
@@ -795,18 +795,8 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
                return true;
        }
 
-       /**
-        * How long to cache page when it is being included.
-        *
-        * @return int|bool Time in seconds, 0 to disable caching altogether
-        */
-       public function maxIncludeCacheTime() {
-               global $wgMiserMode;
-               if ( !$wgMiserMode ) {
-                       return 0;
-               } else {
-                       return 60*5;
-               }
+       protected function getCacheTTL() {
+               return 60 * 50;
        }
 
 }