]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Save attached URLs when importing a Twitter status: this lets our thumbnail detection...
authorBrion Vibber <brion@status.net>
Sat, 13 Nov 2010 01:40:34 +0000 (17:40 -0800)
committerBrion Vibber <brion@status.net>
Sat, 13 Nov 2010 01:40:34 +0000 (17:40 -0800)
plugins/TwitterBridge/twitterimport.php

index 07a9cf95f66c9f63f49dccf380ce1a9590bf0fab..498e9b1fc5938caa0457df521a3ed1ec1256d629 100644 (file)
@@ -189,6 +189,7 @@ class TwitterImport
         Notice_to_status::saveNew($notice->id, $status->id);
 
         $this->saveStatusMentions($notice, $status);
+        $this->saveStatusAttachments($notice, $status);
 
         $notice->blowOnInsert();
 
@@ -648,4 +649,20 @@ class TwitterImport
             }
         }
     }
+
+    /**
+     * Record URL links from the notice. Needed to get thumbnail records
+     * for referenced photo and video posts, etc.
+     *
+     * @param Notice $notice
+     * @param object $status
+     */
+    function saveStatusAttachments($notice, $status)
+    {
+        if (!empty($status->entities) && !empty($status->entities->urls)) {
+            foreach ($status->entities->urls as $url) {
+                File::processNew($url->url, $notice->id);
+            }
+        }
+    }
 }
\ No newline at end of file