From 0a57b337eb3aa33c1ccfb99a2b43349d44267ee3 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Wed, 28 Jan 2009 15:14:38 +0000 Subject: [PATCH] Remove useless left join in watchlist By request of Domas. Extensions that were relying on the left join to page being present must add it if it's not; LQT was the only one I found in trunk, and I updated it so it should still work. --- includes/specials/SpecialWatchlist.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 6e7fb6ea2c..4313f87c8f 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -159,10 +159,12 @@ function wfSpecialWatchlist( $par ) { if( $wgUser->getOption( 'extendwatchlist' )) { $andLatest=''; $limitWatchlist = intval( $wgUser->getOption( 'wllimit' ) ); + $usePage = false; } else { # Top log Ids for a page are not stored $andLatest = 'rc_this_oldid=page_latest OR rc_type=' . RC_LOG; $limitWatchlist = 0; + $usePage = true; } # Show a message about slave lag, if applicable @@ -189,12 +191,11 @@ function wfSpecialWatchlist( $par ) { } $form .= '
'; - $tables = array( 'recentchanges', 'watchlist', 'page' ); + $tables = array( 'recentchanges', 'watchlist' ); $fields = array( "{$recentchanges}.*" ); $conds = array(); $join_conds = array( 'watchlist' => array('INNER JOIN',"wl_user='{$uid}' AND wl_namespace=rc_namespace AND wl_title=rc_title"), - 'page' => array('LEFT JOIN','rc_cur_id=page_id') ); $options = array( 'ORDER BY' => 'rc_timestamp DESC' ); if( $wgShowUpdatedMarker ) { @@ -212,6 +213,11 @@ function wfSpecialWatchlist( $par ) { if( $andHideAnons ) $conds[] = $andHideAnons; if( $andHidePatrolled ) $conds[] = $andHidePatrolled; if( $nameSpaceClause ) $conds[] = $nameSpaceClause; + + if ( $usePage ) { + $tables[] = 'page'; + $join_conds['page'] = array('LEFT JOIN','rc_cur_id=page_id'); + } wfRunHooks('SpecialWatchlistQuery', array(&$conds,&$tables,&$join_conds,&$fields) ); -- 2.20.1