X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FConversation.php;h=a485ac2d93e6b4ece8da8a613cb0877df7d1e2b1;hb=2e05dac7dae0a3d028b442a2d5afbd4176a32e99;hp=1dcb6b0c2d7cc8476d1a0038eb613579d092a487;hpb=44eebde9cbc25723e66d5ec7f216c80f2889e3f5;p=friendica.git diff --git a/src/Model/Conversation.php b/src/Model/Conversation.php index 1dcb6b0c2d..a485ac2d93 100644 --- a/src/Model/Conversation.php +++ b/src/Model/Conversation.php @@ -1,6 +1,6 @@ $conversation['item-uri']]); - if (DBA::isResult($old_conv)) { - // Don't update when only the source has changed. - // Only do this when there had been no source before. - if ($old_conv['source'] != '') { - unset($old_conv['source']); - } - // Update structure data all the time but the source only when its from a better protocol. - if ( - empty($conversation['source']) - || ( - !empty($old_conv['source']) - && ($old_conv['protocol'] < (($conversation['protocol'] ?? '') ?: self::PARCEL_UNKNOWN)) - ) - ) { - unset($conversation['protocol']); - unset($conversation['source']); - } - if (!DBA::update('conversation', $conversation, ['item-uri' => $conversation['item-uri']], $old_conv)) { - Logger::log('Conversation: update for ' . $conversation['item-uri'] . ' from ' . $old_conv['protocol'] . ' to ' . $conversation['protocol'] . ' failed', - Logger::DEBUG); - } - } else { - if (!DBA::insert('conversation', $conversation, true)) { - Logger::log('Conversation: insert for ' . $conversation['item-uri'] . ' (protocol ' . $conversation['protocol'] . ') failed', - Logger::DEBUG); - } + if (!DBA::exists('conversation', ['item-uri' => $conversation['item-uri']])) { + DBA::insert('conversation', $conversation, Database::INSERT_IGNORE); } } unset($arr['conversation-uri']); unset($arr['conversation-href']); - unset($arr['protocol']); unset($arr['source']); - unset($arr['direction']); return $arr; }