From: Evan Prodromou Date: Thu, 15 Sep 2011 21:06:05 +0000 (-0400) Subject: Upgrade 0.9.x bookmarks to 1.0.x X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6e480d2458bf4039ee0446187893203cd533dc40;p=quix0rs-gnu-social.git Upgrade 0.9.x bookmarks to 1.0.x --- diff --git a/plugins/Bookmark/BookmarkPlugin.php b/plugins/Bookmark/BookmarkPlugin.php index 77b8a8483c..ff68917bcc 100644 --- a/plugins/Bookmark/BookmarkPlugin.php +++ b/plugins/Bookmark/BookmarkPlugin.php @@ -551,4 +551,25 @@ class BookmarkPlugin extends MicroAppPlugin // TRANS: Application title. return _m('TITLE','Bookmark'); } + + function onEndUpgrade() + { + // 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->find(); + + while ($notice->fetch()) { + $original = clone($notice); + $notice->verb = ActivityVerb::POST; + $notice->object_type = ActivityObject::BOOKMARK; + $notice->update($original); + } + } }