From: Brion Vibber Date: Fri, 22 Jan 2010 21:58:20 +0000 (-0800) Subject: Consolidate PuSH publishing ping into a single POST for all feeds, and fix server... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=71b3b9ee2be6973c3f55a59811ae103321c5abcc;p=quix0rs-gnu-social.git 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. --- diff --git a/plugins/PubSubHubBub/PubSubHubBubPlugin.php b/plugins/PubSubHubBub/PubSubHubBubPlugin.php index 8286cd5489..ce6086df94 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;