From c8bbde69dffb9afd4bb11118ed9c48f0eab4af04 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 27 Dec 2010 22:57:35 -0800 Subject: [PATCH] import bookmarks from backups --- plugins/Bookmark/BookmarkPlugin.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/plugins/Bookmark/BookmarkPlugin.php b/plugins/Bookmark/BookmarkPlugin.php index fe1563f038..a5ec0f098a 100644 --- a/plugins/Bookmark/BookmarkPlugin.php +++ b/plugins/Bookmark/BookmarkPlugin.php @@ -524,6 +524,30 @@ class BookmarkPlugin extends Plugin return true; } + function onStartImportActivity($user, $author, $activity, $trusted, &$done) { + + if (self::_isPostBookmark($activity)) { + + $bookmark = $activity->objects[0]; + + $this->log(LOG_INFO, 'Importing Bookmark ' . $bookmark->id . ' for user ' . $user->nickname); + + $options = array('uri' => $bookmark->id, + 'url' => $bookmark->link, + 'source' => 'restore'); + + $saved = self::_postBookmark($user->getProfile(), $activity, $options); + + if (!empty($saved)) { + $done = true; + } + + return false; + } + + return true; + } + static private function _postRemoteBookmark(Ostatus_profile $author, Activity $activity) { $bookmark = $activity->objects[0]; -- 2.39.5