r71758 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71757‎ | r71758 | r71759 >
Date:22:31, 26 August 2010
Author:reedy
Status:reverted (Comments)
Tags:
Comment:
Drop $options from insertOrUpdate - r71662
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMysql.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseMysql.php
@@ -364,21 +364,18 @@
365365 * @param $table String: table name (prefix auto-added)
366366 * @param $a Array: Array of rows to insert
367367 * @param $fname String: Calling function name (use __METHOD__) for logs/profiling
368 - * @param $options Mixed: Associative array of options
369368 * @param $onDupeUpdate Array: Associative array of fields to update on duplicate
370369 *
371370 * @return bool
372371 */
373 - function insertOrUpdate( $table, $a, $fname = 'DatabaseBase::insertOrUpdate', $options = array(), $onDupeUpdate = array() ) {
 372+ function insertOrUpdate( $table, $a, $fname = 'DatabaseBase::insertOrUpdate', $onDupeUpdate = array() ) {
374373 # No rows to insert, easy just return now
375374 if ( !count( $a ) ) {
376375 return true;
377376 }
378377
379378 $table = $this->tableName( $table );
380 - if ( !is_array( $options ) ) {
381 - $options = array( $options );
382 - }
 379+
383380 if ( isset( $a[0] ) && is_array( $a[0] ) ) {
384381 $multi = true;
385382 $keys = array_keys( $a[0] );
@@ -387,8 +384,7 @@
388385 $keys = array_keys( $a );
389386 }
390387
391 - $sql = 'INSERT ' . implode( ' ', $options ) .
392 - " INTO $table (" . implode( ',', $keys ) . ') VALUES ';
 388+ $sql = "INSERT INTO $table (" . implode( ',', $keys ) . ') VALUES ';
393389
394390 if ( $multi ) {
395391 $first = true;
Index: trunk/phase3/includes/db/Database.php
@@ -1164,12 +1164,11 @@
11651165 * @param $table String: table name (prefix auto-added)
11661166 * @param $a Array: Array of rows to insert
11671167 * @param $fname String: Calling function name (use __METHOD__) for logs/profiling
1168 - * @param $options Mixed: Associative array of options (ignored in this implementation)
11691168 * @param $onDupeUpdate Array: Associative array of fields to update on duplicate
11701169 *
11711170 * @return bool
11721171 */
1173 - function insertOrUpdate( $table, $a, $fname = 'DatabaseBase::insertOrUpdate', $options = array(), $onDupeUpdate = array() ) {
 1172+ function insertOrUpdate( $table, $a, $fname = 'DatabaseBase::insertOrUpdate', $onDupeUpdate = array() ) {
11741173
11751174 if ( isset( $a[0] ) && is_array( $a[0] ) ) {
11761175 $keys = array_keys( $a[0] );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r71662Fill out insertOrUpdate in DatabaseBase, rather than blank stub. Followup to ...reedy21:46, 25 August 2010

Comments

#Comment by Platonides (talk | contribs)   22:33, 26 August 2010

Then you should also remove the parameter on the call from ArticleAssessmentPilot extensions.

#Comment by Platonides (talk | contribs)   22:45, 26 August 2010

Fixed in r71760

Status & tagging log