]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Consolidate PuSH publishing ping into a single POST for all feeds, and fix server...
authorBrion Vibber <brion@pobox.com>
Fri, 22 Jan 2010 21:58:20 +0000 (13:58 -0800)
committerBrion Vibber <brion@pobox.com>
Fri, 22 Jan 2010 22:03:24 +0000 (14:03 -0800)
plugins/PubSubHubBub/PubSubHubBubPlugin.php

index 8286cd548969648e43f552ea5af1463ffe86f7b6..ce6086df9443933b6c51e8075f243809afbaedb3 100644 (file)
@@ -211,13 +211,20 @@ class PubSubHubBubPlugin extends Plugin
                                                   'format' => 'atom'));
             }
         }
-
-        foreach (array_unique($feeds) as $feed) {
-            if (!$publisher->publish_update($feed)) {
-                common_log_line(LOG_WARNING,
-                                $feed.' was not published to hub at '.
-                                $this->hub.':'.$publisher->last_response());
-            }
+        $feeds = array_unique($feeds);
+
+        ob_start();
+        $ok = $publisher->publish_update($feeds);
+        $push_last_response = ob_get_clean();
+
+        if (!$ok) {
+            common_log(LOG_WARNING,
+                       'Failure publishing ' . count($feeds) . ' feeds to hub at '.
+                       $this->hub.': '.$push_last_response);
+        } else {
+            common_log(LOG_INFO,
+                       'Published ' . count($feeds) . ' feeds to hub at '.
+                       $this->hub.': '.$push_last_response);
         }
 
         return true;