Avoid expensive backlink counts for info action in miser mode
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 16 Jan 2014 20:39:33 +0000 (12:39 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 16 Jan 2014 20:39:33 +0000 (12:39 -0800)
Change-Id: I13b64db1b23afd995cd0a2f5872fcedadd86c8ea

includes/actions/InfoAction.php

index 811e35d..a424b9d 100644 (file)
@@ -193,7 +193,7 @@ class InfoAction extends FormlessAction {
         * @return array
         */
        protected function pageInfo() {
-               global $wgContLang, $wgRCMaxAge, $wgMemc,
+               global $wgContLang, $wgRCMaxAge, $wgMemc, $wgMiserMode,
                        $wgUnwatchedPageThreshold, $wgPageInfoTransclusionLimit;
 
                $user = $this->getUser();
@@ -540,7 +540,11 @@ class InfoAction extends FormlessAction {
                ) {
                        $options = array( 'LIMIT' => $wgPageInfoTransclusionLimit );
                        $transcludedTemplates = $title->getTemplateLinksFrom( $options );
-                       $transcludedTargets = $title->getTemplateLinksTo( $options );
+                       if ( $wgMiserMode ) {
+                               $transcludedTargets = array();
+                       } else {
+                               $transcludedTargets = $title->getTemplateLinksTo( $options );
+                       }
 
                        // Page properties
                        $pageInfo['header-properties'] = array();
@@ -581,7 +585,7 @@ class InfoAction extends FormlessAction {
                                );
                        }
 
-                       if ( $pageCounts['transclusion']['to'] > 0 ) {
+                       if ( !$wgMiserMode && $pageCounts['transclusion']['to'] > 0 ) {
                                if ( $pageCounts['transclusion']['to'] > count( $transcludedTargets ) ) {
                                        $more = Linker::link(
                                                $whatLinksHere,