RCFilters: Don't call ChangeTags::tagUsageStatistics() for now
authorRoan Kattouw <roan.kattouw@gmail.com>
Wed, 12 Jul 2017 01:01:09 +0000 (18:01 -0700)
committerRoan Kattouw <roan.kattouw@gmail.com>
Wed, 12 Jul 2017 01:12:14 +0000 (18:12 -0700)
We need to fix its performance first, it currently takes >30s on wikidatawiki.
Fake all hit counts to be zero. Instead of sorting by hit count,
sort by display name.

Bug: T169997
Change-Id: I4075ea4d43a8f75e21a87a892211699ba3bc7058

includes/specials/SpecialRecentchanges.php

index 2fe56f9..15bbffd 100644 (file)
@@ -210,12 +210,16 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
        protected function buildChangeTagList() {
                $explicitlyDefinedTags = array_fill_keys( ChangeTags::listExplicitlyDefinedTags(), 0 );
                $softwareActivatedTags = array_fill_keys( ChangeTags::listSoftwareActivatedTags(), 0 );
-               $tagStats = ChangeTags::tagUsageStatistics();
 
+               // Hit counts disabled for perf reasons, see T169997
+               /*
+               $tagStats = ChangeTags::tagUsageStatistics();
                $tagHitCounts = array_merge( $explicitlyDefinedTags, $softwareActivatedTags, $tagStats );
 
                // Sort by hits
                arsort( $tagHitCounts );
+               */
+               $tagHitCounts = array_merge( $explicitlyDefinedTags, $softwareActivatedTags );
 
                // Build the list and data
                $result = [];
@@ -240,6 +244,11 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
                        }
                }
 
+               // Instead of sorting by hit count (disabled, see above), sort by display name
+               usort( $result, function ( $a, $b ) {
+                       return strcasecmp( $a['label'], $b['label'] );
+               } );
+
                return $result;
        }