r79707 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79706‎ | r79707 | r79708 >
Date:02:51, 6 January 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Fixup raw sql building
Modified paths:
  • /trunk/phase3/includes/WatchlistEditor.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WatchlistEditor.php
@@ -207,15 +207,15 @@
208208 private function getWatchlistInfo( $user ) {
209209 $titles = array();
210210 $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+
220220 if( $res && $dbr->numRows( $res ) > 0 ) {
221221 $cache = LinkCache::singleton();
222222 foreach ( $res as $row ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r79723Followup r79707, nicer whitespace. Beyond this, I'm beyond caring...reedy15:25, 6 January 2011

Comments

#Comment by Nikerabbit (talk | contribs)   08:38, 6 January 2011

Nice indentation pal ;)

Status & tagging log