From: Alexandre Emsenhuber Date: Tue, 25 Jun 2013 14:15:45 +0000 (+0200) Subject: (bug 50078) Allow a string other than '*' as condition for DatabaseBase::delete() X-Git-Tag: 1.31.0-rc.0~19359^2 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28?a=commitdiff_plain;h=b18770232c679482e0c7bf775b84eda5f7f3b782;p=lhc%2Fweb%2Fwiklou.git (bug 50078) Allow a string other than '*' as condition for DatabaseBase::delete() Currently, either '*' is given as condition meaning "everything" or an array must be passed since DatabaseBase::makeList() requires an array. Now the parameter is consistent with one of other similar methods, since a string will be handled correctly. Bug: 50078 Change-Id: Id5a8220d21245669f1091a3b5ed1def65b22d375 --- diff --git a/includes/db/Database.php b/includes/db/Database.php index 4b2eae7174..e06d80d9d1 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2712,7 +2712,10 @@ abstract class DatabaseBase implements DatabaseType { $sql = "DELETE FROM $table"; if ( $conds != '*' ) { - $sql .= ' WHERE ' . $this->makeList( $conds, LIST_AND ); + if ( is_array( $conds ) ) { + $conds = $this->makeList( $conds, LIST_AND ); + } + $sql .= ' WHERE ' . $conds; } return $this->query( $sql, $fname );