Index: trunk/phase3/includes/WatchlistEditor.php |
— | — | @@ -207,15 +207,15 @@ |
208 | 208 | private function getWatchlistInfo( $user ) { |
209 | 209 | $titles = array(); |
210 | 210 | $dbr = wfGetDB( DB_MASTER ); |
211 | | - $uid = intval( $user->getId() ); |
212 | | - list( $watchlist, $page ) = $dbr->tableNamesN( 'watchlist', 'page' ); |
213 | | - $sql = "SELECT wl_namespace, wl_title, page_id, page_len, page_is_redirect, page_latest |
214 | | - FROM {$watchlist} LEFT JOIN {$page} ON ( wl_namespace = page_namespace |
215 | | - AND wl_title = page_title ) WHERE wl_user = {$uid}"; |
216 | | - if ( ! $dbr->implicitOrderby() ) { |
217 | | - $sql .= " ORDER BY wl_title"; |
218 | | - } |
219 | | - $res = $dbr->query( $sql, __METHOD__ ); |
| 211 | + |
| 212 | + $res = $dbr->select( array( 'watchlist', 'page' ), |
| 213 | + array( 'wl_namespace', 'wl_title', 'page_id', 'page_len', 'page_is_redirect', 'page_latest' ), |
| 214 | + array( 'wl_user' => $user->getId() ), |
| 215 | + __METHOD__, |
| 216 | + $dbr->implicitOrderby() ? array( ) : array( 'ORDER BY' => 'wl_title' ), |
| 217 | + array( 'page' => array( 'LEFT JOIN', 'wl_namespace = page_namespace AND wl_title = page_title' ) ) |
| 218 | + ); |
| 219 | + |
220 | 220 | if( $res && $dbr->numRows( $res ) > 0 ) { |
221 | 221 | $cache = LinkCache::singleton(); |
222 | 222 | foreach ( $res as $row ) { |