r78784 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78783‎ | r78784 | r78785 >
Date:12:58, 22 December 2010
Author:catrope
Status:ok
Tags:
Comment:
Fix @ usage in QueryPage::reallyDoQuery(). Also had an unused $options variable
Modified paths:
  • /branches/querypage-work2/phase3/includes/QueryPage.php (modified) (history)

Diff [purge]

Index: branches/querypage-work2/phase3/includes/QueryPage.php
@@ -352,24 +352,24 @@
353353 }
354354 }
355355 if ( is_array( $query ) ) {
356 - if ( !is_array( @$query['options'] ) ) {
357 - $options = array ();
358 - }
 356+ $tables = isset( $query['tables'] ) ? (array)$query['tables'] : array();
 357+ $fields = isset( $query['fields'] ) ? (array)$query['fields'] : array();
 358+ $conds = isset( $query['conds'] ) ? (array)$query['conds'] : array();
 359+ $options = isset( $query['options'] ) ? (array)$query['options'] : array();
 360+ $join_conds = isset( $query['join_conds'] ) ? (array)$query['join_conds'] : array();
359361 if ( count( $order ) ) {
360 - $query['options']['ORDER BY'] = implode( ', ', $order );
 362+ $options['ORDER BY'] = implode( ', ', $order );
361363 }
362364 if ( $limit !== false ) {
363 - $query['options']['LIMIT'] = intval( $limit );
 365+ $options['LIMIT'] = intval( $limit );
364366 }
365367 if ( $offset !== false ) {
366 - $query['options']['OFFSET'] = intval( $offset );
 368+ $options['OFFSET'] = intval( $offset );
367369 }
368370
369371 $dbr = wfGetDB( DB_SLAVE );
370 - $res = $dbr->select( (array)@$query['tables'],
371 - (array)@$query['fields'],
372 - (array)@$query['conds'], $fname,
373 - $query['options'], (array)@$query['join_conds']
 372+ $res = $dbr->select( $tables, $fields, $conds, $fname,
 373+ $options, $join_conds
374374 );
375375 } else {
376376 // Old-fashioned raw SQL style, deprecated

Status & tagging log