]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Bookmark/deliciousbookmarkimporter.php
More info for a proper, fancy-url lighttpd setup
[quix0rs-gnu-social.git] / plugins / Bookmark / deliciousbookmarkimporter.php
index 018239f49d6be341edc6cbfd065820c64fcf463a..eca9e96060549d8d807cfdf121cb284c4c68d654 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2010, StatusNet, Inc.
  *
  * Importer class for Delicious.com bookmarks
- * 
+ *
  * PHP version 5
  *
  * This program is free software: you can redistribute it and/or modify
@@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  * @link      http://status.net/
  */
-
 class DeliciousBookmarkImporter extends QueueHandler
 {
     /**
@@ -52,7 +51,6 @@ class DeliciousBookmarkImporter extends QueueHandler
      *
      * @return string 'dlcsbkmk'
      */
-
     function transport()
     {
         return 'dlcsbkmk';
@@ -60,15 +58,14 @@ class DeliciousBookmarkImporter extends QueueHandler
 
     /**
      * Handle the data
-     * 
+     *
      * @param array $data associative array of user & bookmark info from DeliciousBackupImporter::importBookmark()
      *
      * @return boolean success value
      */
-
     function handle($data)
     {
-        $profile = Profile::staticGet('id', $data['profile_id']);
+        $profile = Profile::getKV('id', $data['profile_id']);
 
         try {
             $saved = Bookmark::saveNew($profile,
@@ -78,10 +75,17 @@ class DeliciousBookmarkImporter extends QueueHandler
                                        $data['description'],
                                        array('created' => $data['created'],
                                              'distribute' => false));
-        } catch (ClientException $e) {
+        } catch (ClientException $ce) {
             // Most likely a duplicate -- continue on with the rest!
-            common_log(LOG_ERR, "Error importing delicious bookmark to $data[url]: " . $e->getMessage());
+            common_log(LOG_ERR, "Error importing delicious bookmark to $data[url]: " . $ce->getMessage());
             return true;
+        } catch (Exception $ex) {
+            if (preg_match("/DB Error: already exists/", $ex->getMessage())) {
+                common_log(LOG_ERR, "Error importing delicious bookmark to $data[url]: " . $ce->getMessage());
+                return true;
+            } else {
+                throw $ex;
+            }
         }
 
         return true;