]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
import bookmarks from backups
authorEvan Prodromou <evan@status.net>
Tue, 28 Dec 2010 06:57:35 +0000 (22:57 -0800)
committerEvan Prodromou <evan@status.net>
Tue, 28 Dec 2010 06:57:35 +0000 (22:57 -0800)
plugins/Bookmark/BookmarkPlugin.php

index fe1563f038fe44e2201a87b631ba1bd80a6a93cc..a5ec0f098a5e4b5d6db128b9594a8ea4df2bc34c 100644 (file)
@@ -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];