]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Conversation.php
Add support for legacy $lang config in App->loadConfig
[friendica.git] / src / Model / Conversation.php
index cd51a537ed247839bdeebf181e6f9796ac9b5bf0..69bbc3bb6dd4b4718d03ac51ebad98d3b497d8fd 100644 (file)
@@ -52,8 +52,8 @@ class Conversation
                                $conversation['source'] = $arr['source'];
                        }
 
-                       $old_conv = dba::fetch_first("SELECT `item-uri`, `reply-to-uri`, `conversation-uri`, `conversation-href`, `protocol`, `source`
-                                       FROM `conversation` WHERE `item-uri` = ?", $conversation['item-uri']);
+                       $fields = ['item-uri', 'reply-to-uri', 'conversation-uri', 'conversation-href', 'protocol', 'source'];
+                       $old_conv = dba::selectFirst('conversation', $fields, ['item-uri' => $conversation['item-uri']]);
                        if (DBM::is_result($old_conv)) {
                                // Don't update when only the source has changed.
                                // Only do this when there had been no source before.
@@ -61,7 +61,7 @@ class Conversation
                                        unset($old_conv['source']);
                                }
                                // Update structure data all the time but the source only when its from a better protocol.
-                               if (($old_conv['protocol'] < $conversation['protocol']) && ($old_conv['protocol'] != 0)) {
+                               if (isset($conversation['protocol']) && isset($conversation['source']) && ($old_conv['protocol'] < $conversation['protocol']) && ($old_conv['protocol'] != 0)) {
                                        unset($conversation['protocol']);
                                        unset($conversation['source']);
                                }