]> git.mxchange.org Git - friendica.git/blobdiff - src/Database/DBA.php
Merge branch 'bug/phpinfo-accessible-hotfix' into 2020.09-rc
[friendica.git] / src / Database / DBA.php
index 9debdf02a53cfb8512c1964f30d849197e0defb6..babc4500eb0c24a568a50c1823523879002b6d02 100644 (file)
@@ -293,7 +293,8 @@ class DBA
        }
 
        /**
-        * Replace a row of a table
+        * Inserts a row with the provided data in the provided table.
+        * If the data corresponds to an existing row through a UNIQUE or PRIMARY index constraints, it updates the row instead.
         *
         * @param string|array $table Table name or array [schema => table]
         * @param array        $param parameter array
@@ -668,10 +669,18 @@ class DBA
         */
        public static function mergeConditions(array ...$conditions)
        {
+               if (count($conditions) == 1) {
+                       return current($conditions);
+               }
+
                $conditionStrings = [];
                $result = [];
 
                foreach ($conditions as $key => $condition) {
+                       if (!$condition) {
+                               continue;
+                       }
+
                        $condition = self::collapseCondition($condition);
 
                        $conditionStrings[] = array_shift($condition);