]> git.mxchange.org Git - friendica.git/commitdiff
Add conversation storage for Twitter
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 5 Aug 2018 10:34:33 +0000 (12:34 +0200)
committerHypolite Petovan <mrpetovan@gmail.com>
Sun, 5 Aug 2018 10:34:33 +0000 (12:34 +0200)
src/Model/Conversation.php

index d6e222a81b91bc88cc8a73395d7a320ebe16a1a4..cde81090e4195e34c512b7c252701f90e42c19c1 100644 (file)
@@ -2,6 +2,7 @@
 /**
  * @file src/Model/Conversation
  */
+
 namespace Friendica\Model;
 
 use Friendica\Database\DBA;
@@ -29,8 +30,10 @@ class Conversation
         * @param array $arr Item array with conversation data
         * @return array Item array with removed conversation data
         */
-       public static function insert($arr) {
-               if (in_array(defaults($arr, 'network', NETWORK_PHANTOM), [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]) && !empty($arr['uri'])) {
+       public static function insert(array $arr)
+       {
+               if (in_array(defaults($arr, 'network', NETWORK_PHANTOM),
+                               [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_TWITTER]) && !empty($arr['uri'])) {
                        $conversation = ['item-uri' => $arr['uri'], 'received' => DateTimeFormat::utcNow()];
 
                        if (isset($arr['parent-uri']) && ($arr['parent-uri'] != $arr['uri'])) {
@@ -70,11 +73,13 @@ class Conversation
                                        unset($conversation['source']);
                                }
                                if (!DBA::update('conversation', $conversation, ['item-uri' => $conversation['item-uri']], $old_conv)) {
-                                       logger('Conversation: update for '.$conversation['item-uri'].' from '.$old_conv['protocol'].' to '.$conversation['protocol'].' failed', LOGGER_DEBUG);
+                                       logger('Conversation: update for ' . $conversation['item-uri'] . ' from ' . $old_conv['protocol'] . ' to ' . $conversation['protocol'] . ' failed',
+                                               LOGGER_DEBUG);
                                }
                        } else {
                                if (!DBA::insert('conversation', $conversation, true)) {
-                                       logger('Conversation: insert for '.$conversation['item-uri'].' (protocol '.$conversation['protocol'].') failed', LOGGER_DEBUG);
+                                       logger('Conversation: insert for ' . $conversation['item-uri'] . ' (protocol ' . $conversation['protocol'] . ') failed',
+                                               LOGGER_DEBUG);
                                }
                        }
                }