diff options
author | Brion Vibber <brion@pobox.com> | 2010-01-22 13:58:20 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-01-22 14:03:24 -0800 |
commit | 71b3b9ee2be6973c3f55a59811ae103321c5abcc (patch) | |
tree | 610463e36b4d72112e8bcd82145d3c0864075beb /plugins/PubSubHubBub/PubSubHubBubPlugin.php | |
parent | 6d055ce09ea516f115a7c21a59d11f9257ce0d9e (diff) |
Consolidate PuSH publishing ping into a single POST for all feeds, and fix server response (if any on failure) to go to log instead of stdout.
Diffstat (limited to 'plugins/PubSubHubBub/PubSubHubBubPlugin.php')
-rw-r--r-- | plugins/PubSubHubBub/PubSubHubBubPlugin.php | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/plugins/PubSubHubBub/PubSubHubBubPlugin.php b/plugins/PubSubHubBub/PubSubHubBubPlugin.php index 8286cd548..ce6086df9 100644 --- a/plugins/PubSubHubBub/PubSubHubBubPlugin.php +++ b/plugins/PubSubHubBub/PubSubHubBubPlugin.php @@ -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; |