From: Sam Reed Date: Thu, 26 Aug 2010 22:23:03 +0000 (+0000) Subject: Followup r71662 X-Git-Tag: 1.31.0-rc.0~35308 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=fb627b636a025be53abae256da08831e178ae521;p=lhc%2Fweb%2Fwiklou.git Followup r71662 Update fname (same for DatabaseMysql) Add missing spaces, remove superfluous makeList() call --- diff --git a/includes/db/Database.php b/includes/db/Database.php index cceed14716..0154f8b422 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1164,12 +1164,12 @@ abstract class DatabaseBase { * @param $table String: table name (prefix auto-added) * @param $a Array: Array of rows to insert * @param $fname String: Calling function name (use __METHOD__) for logs/profiling - * @param $options Mixed: Associative array of options (ignored) + * @param $options Mixed: Associative array of options (ignored in this implementation) * @param $onDupeUpdate Array: Associative array of fields to update on duplicate * * @return bool */ - function insertOrUpdate( $table, $a, $fname = 'DatabaseBase::insertOnDupeUpdate', $options = array(), $onDupeUpdate = array() ) { + function insertOrUpdate( $table, $a, $fname = 'DatabaseBase::insertOrUpdate', $options = array(), $onDupeUpdate = array() ) { if ( isset( $a[0] ) && is_array( $a[0] ) ) { $keys = array_keys( $a[0] ); @@ -1183,21 +1183,21 @@ abstract class DatabaseBase { $res = $this->select( $table, $keys, - $this->makeList( $where, LIST_AND ), + $where, __METHOD__ ); if ( $res ) { - //Where there is a different value to set if this is being "updated", use the $onDupeUpdate value for that to - //replace the original option (if it was an insert), and replace the column name with the value read from - //the existing row - foreach( $where as $k => $v ){ - if ( isset( $onDupeUpdate[$k] ) ){ + // Where there is a different value to set if this is being "updated", use the $onDupeUpdate value for that to + // replace the original option (if it was an insert), and replace the column name with the value read from + // the existing row + foreach( $where as $k => $v ) { + if ( isset( $onDupeUpdate[$k] ) ) { $options[$k] = str_replace( $k, $res[0]->{$k}, $onDupeUpdate[$k] ); } } } else { - //No results, it's just an insert + // No results, it's just an insert $update = $where; } diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index c95a16316f..9154c203ae 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -369,7 +369,7 @@ class DatabaseMysql extends DatabaseBase { * * @return bool */ - function insertOrUpdate( $table, $a, $fname = 'DatabaseBase::insertOnDupeUpdate', $options = array(), $onDupeUpdate = array() ) { + function insertOrUpdate( $table, $a, $fname = 'DatabaseBase::insertOrUpdate', $options = array(), $onDupeUpdate = array() ) { # No rows to insert, easy just return now if ( !count( $a ) ) { return true;