MarkAHershberger has submitted this change and it was merged.

Change subject: (bug 50078) Allow a string other than '*' as condition for 
DatabaseBase::delete()
......................................................................


(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
(cherry picked from commit b18770232c679482e0c7bf775b84eda5f7f3b782)
---
M includes/db/Database.php
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  MarkAHershberger: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/db/Database.php b/includes/db/Database.php
index f3e8467..0c11e0e 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -2514,7 +2514,10 @@
                $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 );

-- 
To view, visit https://gerrit.wikimedia.org/r/80157
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id5a8220d21245669f1091a3b5ed1def65b22d375
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_19
Gerrit-Owner: MarkAHershberger <[email protected]>
Gerrit-Reviewer: IAlex <[email protected]>
Gerrit-Reviewer: MarkAHershberger <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to