From 4dc7c3188d11a5c2feffe46940e4f9ef955c627f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 26 Jun 2011 23:32:46 +0000 Subject: [PATCH] Restore new_name_timestamp index usage in UNION. Since r51907, there was no reason for doing the UNION. Fixed "is_null( $namespace )" checks, broken probably since FormOptions was used here (NULL value not saved for 'namespace', left to default, which is ''). Added check for 'associated namespaces' option. --- includes/specials/SpecialRecentchanges.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 4743d6eed8..da5d5f0072 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -365,6 +365,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { $limit = $opts['limit']; $namespace = $opts['namespace']; $invert = $opts['invert']; + $associated = $opts['associated']; $fields = array( $dbr->tableName( 'recentchanges' ) . '.*' ); // all rc columns // JOIN on watchlist for users @@ -397,11 +398,11 @@ class SpecialRecentChanges extends IncludableSpecialPage { // Don't use the new_namespace_time timestamp index if: // (a) "All namespaces" selected - // (b) We want all pages NOT in a certain namespaces (inverted) + // (b) We want pages in more than one namespace (inverted/associated) // (c) There is a tag to filter on (use tag index instead) // (d) UNION + sort/limit is not an option for the DBMS - if( is_null( $namespace ) - || ( $invert && !is_null( $namespace ) ) + if( $namespace === '' + || ( $invert || $associated ) || $opts['tagfilter'] != '' || !$dbr->unionSupportsOrderAndLimit() ) { @@ -420,7 +421,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit, - 'USE INDEX' => array( 'recentchanges' => 'rc_timestamp' ) + 'USE INDEX' => array( 'recentchanges' => 'new_name_timestamp' ) ), $join_conds ); @@ -433,7 +434,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit, - 'USE INDEX' => array( 'recentchanges' => 'rc_timestamp' ) + 'USE INDEX' => array( 'recentchanges' => 'new_name_timestamp' ) ), $join_conds ); -- 2.20.1