]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/TwitterBridge/TwitterBridgePlugin.php
Merge branch 'nightly' of git.gnu.io:gnu/gnu-social into nightly
[quix0rs-gnu-social.git] / plugins / TwitterBridge / TwitterBridgePlugin.php
index 0a887168539bfac69cf671bc6e47c71aad1c2293..5bf63a394674ac8a18114bfbd7adb9d349d5b46c 100644 (file)
@@ -570,4 +570,28 @@ class TwitterBridgePlugin extends Plugin
 
         return true;
     }
+    
+    /**
+     * Set the object_type field of previously imported Twitter notices to
+     * ActivityObject::NOTE if they are unset. Null object_type caused a notice
+     * not to show on the timeline.
+     */
+    public function onEndUpgrade()
+    {
+       printfnq("Ensuring all Twitter notices have an object_type...");
+       
+       $notice = new Notice();
+       $notice->whereAdd("source='twitter'");
+       $notice->whereAdd('object_type IS NULL');
+       
+       if ($notice->find()) {
+               while ($notice->fetch()) {
+                       $orig = Notice::getKV('id', $notice->id);
+                       $notice->object_type = ActivityObject::NOTE;
+                       $notice->update($orig);
+               }
+       }
+       
+       printfnq("DONE.\n");
+    }
 }