]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Bookmark/BookmarkPlugin.php
Properly parse incoming bookmarks
[quix0rs-gnu-social.git] / plugins / Bookmark / BookmarkPlugin.php
index 904c7ee9c9e1817ebef74997ebd2a224c0a336a2..e6afa0b6daf466e295b786b5aca997a1479aa457 100644 (file)
@@ -347,14 +347,16 @@ class BookmarkPlugin extends MicroAppPlugin
 
     function onEndUpgrade()
     {
+        printfnq('Making sure Bookmark notices have correct verb and object_type...');
+
         // Version 0.9.x of the plugin didn't stamp notices
         // with verb and object-type (for obvious reasons). Update
         // those notices here.
 
         $notice = new Notice();
         
-        $notice->whereAdd('exists (select uri from bookmark where bookmark.uri = notice.uri)');
-        $notice->whereAdd('((object_type is null) or (object_type = "' .ActivityObject::NOTE.'"))');
+        $notice->joinAdd(array('uri', 'bookmark:uri'));
+        $notice->whereAdd('object_type IS NULL OR object_type = '.$notice->_quote(ActivityObject::NOTE));
 
         $notice->find();
 
@@ -364,6 +366,8 @@ class BookmarkPlugin extends MicroAppPlugin
             $notice->object_type = ActivityObject::BOOKMARK;
             $notice->update($original);
         }
+
+        printfnq("DONE.\n");
     }
 
     public function activityObjectOutputJson(ActivityObject $obj, array &$out)