? push_hub_bug.patch
Index: plugins/FeedsHTTPFetcher.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsHTTPFetcher.inc,v
retrieving revision 1.25
diff -u -p -r1.25 FeedsHTTPFetcher.inc
--- plugins/FeedsHTTPFetcher.inc	15 Sep 2010 19:40:57 -0000	1.25
+++ plugins/FeedsHTTPFetcher.inc	24 Jan 2011 11:47:44 -0000
@@ -162,7 +162,10 @@ class FeedsHTTPFetcher extends FeedsFetc
    * Override sourceSave() - subscribe to hub.
    */
   public function sourceSave(FeedsSource $source) {
-    if ($this->config['use_pubsubhubbub']) {
+    $config = $source->getConfigFor($this);
+    $source_url = $config['source'];
+    
+    if ($this->config['use_pubsubhubbub'] && !PushSubscription::exists($source_url)) {
       $this->subscribe($source);
     }
   }
@@ -231,6 +234,18 @@ class PuSHSubscription implements PuSHSu
       return new PuSHSubscription($v['domain'], $v['subscriber_id'], $v['hub'], $v['topic'], $v['secret'], $v['status'], $v['post_fields'], $v['timestamp']);
     }
   }
+  
+  /**
+   * Verifies if a subscription to a topic exists
+   */
+  public static function exists($topic) {
+    if ($v = db_fetch_array(db_query("SELECT * FROM {feeds_push_subscriptions} WHERE topic = '%s'", $topic))) {
+      return TRUE;
+    }
+    else {
+      return FALSE;
+    }
+  }
 
   /**
    * Create a subscription.
