Put expensive info action count behind $wgMiserMode
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 27 Jan 2014 19:38:21 +0000 (11:38 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 27 Jan 2014 19:38:21 +0000 (11:38 -0800)
Change-Id: Ie0507b9ed62556f8caaaaf9499a4a40b3342b5af

includes/actions/InfoAction.php

index a424b9d..918fc9e 100644 (file)
@@ -619,7 +619,7 @@ class InfoAction extends FormlessAction {
         * @return array
         */
        protected static function pageCounts( Title $title ) {
-               global $wgRCMaxAge, $wgDisableCounters;
+               global $wgRCMaxAge, $wgDisableCounters, $wgMiserMode;
 
                wfProfileIn( __METHOD__ );
                $id = $title->getArticleID();
@@ -723,15 +723,19 @@ class InfoAction extends FormlessAction {
                }
 
                // Counts for the number of transclusion links (to/from)
-               $result['transclusion']['to'] = (int)$dbr->selectField(
-                       'templatelinks',
-                       'COUNT(tl_from)',
-                       array(
-                               'tl_namespace' => $title->getNamespace(),
-                               'tl_title' => $title->getDBkey()
-                       ),
-                       __METHOD__
-               );
+               if ( $wgMiserMode ) {
+                       $result['transclusion']['to'] = 0;
+               } else {
+                       $result['transclusion']['to'] = (int)$dbr->selectField(
+                               'templatelinks',
+                               'COUNT(tl_from)',
+                               array(
+                                       'tl_namespace' => $title->getNamespace(),
+                                       'tl_title' => $title->getDBkey()
+                               ),
+                               __METHOD__
+                       );
+               }
 
                $result['transclusion']['from'] = (int)$dbr->selectField(
                        'templatelinks',