]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Item.php
in "getidforurl" "no update" is now "update"
[friendica.git] / src / Model / Item.php
index 1f339120ee0487ba6b9ad54c5b1fd84fd389a6ce..332c734fa5b8db976fe97c92b7a6239af285b4d6 100644 (file)
@@ -787,12 +787,12 @@ class Item
                        $joins .= " LEFT JOIN `permissionset` ON `permissionset`.`id` = `item`.`psid`";
                }
 
-               if ((strpos($sql_commands, "`parent-item`.") !== false) || (strpos($sql_commands, "`parent-author`.") !== false)) {
+               if ((strpos($sql_commands, "`parent-item`.") !== false) || (strpos($sql_commands, "`parent-item-author`.") !== false)) {
                        $joins .= " STRAIGHT_JOIN `item` AS `parent-item` ON `parent-item`.`id` = `item`.`parent`";
-               }
 
-               if (strpos($sql_commands, "`parent-item-author`.") !== false) {
-                       $joins .= " STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`";
+                       if (strpos($sql_commands, "`parent-item-author`.") !== false) {
+                               $joins .= " STRAIGHT_JOIN `contact` AS `parent-item-author` ON `parent-item-author`.`id` = `parent-item`.`author-id`";
+                       }
                }
 
                return $joins;
@@ -1680,11 +1680,11 @@ class Item
 
                $default = ['url' => $item['author-link'], 'name' => $item['author-name'],
                        'photo' => $item['author-avatar'], 'network' => $item['network']];
-               $item['author-id'] = ($item['author-id'] ?? 0) ?: Contact::getIdForURL($item['author-link'], 0, false, $default);
+               $item['author-id'] = ($item['author-id'] ?? 0) ?: Contact::getIdForURL($item['author-link'], 0, null, $default);
 
                $default = ['url' => $item['owner-link'], 'name' => $item['owner-name'],
                        'photo' => $item['owner-avatar'], 'network' => $item['network']];
-               $item['owner-id'] = ($item['owner-id'] ?? 0) ?: Contact::getIdForURL($item['owner-link'], 0, false, $default);
+               $item['owner-id'] = ($item['owner-id'] ?? 0) ?: Contact::getIdForURL($item['owner-link'], 0, null, $default);
 
                // The contact-id should be set before "self::insert" was called - but there seems to be issues sometimes
                $item["contact-id"] = self::contactId($item);
@@ -1838,7 +1838,7 @@ class Item
                if (!Tag::existsForPost($item['uri-id'])) {
                        Tag::storeFromBody($item['uri-id'], $body);
                }
-               
+
                $ret = DBA::insert('item', $item);
 
                // When the item was successfully stored we fetch the ID of the item.
@@ -2022,9 +2022,7 @@ class Item
                }
 
                if (empty($fields)) {
-                       // when there are no fields at all, just use the condition
-                       // This is to ensure that we always store content.
-                       $fields = $condition;
+                       return;
                }
 
                DBA::update('item-content', $fields, $condition, true);
@@ -2978,7 +2976,7 @@ class Item
                if (local_user() == $uid) {
                        $item_contact_id = $owner_self_contact['id'];
                } else {
-                       $item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, true);
+                       $item_contact_id = Contact::getIdForURL($author_contact['url'], $uid, false);
                        $item_contact = DBA::selectFirst('contact', [], ['id' => $item_contact_id]);
                        if (!DBA::isResult($item_contact)) {
                                Logger::log('like: unknown item contact ' . $item_contact_id);