]> git.mxchange.org Git - friendica.git/blobdiff - src/Database/Database.php
Merge pull request #8272 from MrPetovan/bug/8254-regex-url-img
[friendica.git] / src / Database / Database.php
index 8a893ab9350c0aac19e6bc78c492d5790e99e789..ff25e8b199d76cc9acb03abb0f2f15442d23e6ec 100644 (file)
@@ -1,4 +1,23 @@
 <?php
+/**
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Database;
 
@@ -16,8 +35,6 @@ use PDOStatement;
 use Psr\Log\LoggerInterface;
 
 /**
- * @class MySQL database class
- *
  * This class is for the low level database stuff that does driver specific things.
  */
 class Database
@@ -1342,19 +1359,13 @@ class Database
                        }
                }
 
-               $do_update = (count($old_fields) == 0);
-
                foreach ($old_fields AS $fieldname => $content) {
-                       if (isset($fields[$fieldname])) {
-                               if (($fields[$fieldname] == $content) && !is_null($content)) {
-                                       unset($fields[$fieldname]);
-                               } else {
-                                       $do_update = true;
-                               }
+                       if (isset($fields[$fieldname]) && !is_null($content) && ($fields[$fieldname] == $content)) {
+                               unset($fields[$fieldname]);
                        }
                }
 
-               if (!$do_update || (count($fields) == 0)) {
+               if (count($fields) == 0) {
                        return true;
                }