*
* This will handle just about all events where an activity
* object gets saved, whether it is via AtomPub, OStatus
- * (PuSH and Salmon transports), or ActivityStreams-based
+ * (WebSub and Salmon transports), or ActivityStreams-based
* backup/restore of account data.
*
* You should be able to accept as input the output from an
*
* This will be how your specialized notice gets output in
* Atom feeds and JSON-based ActivityStreams output, including
- * account backup/restore and OStatus (PuSH and Salmon transports).
+ * account backup/restore and OStatus (WebSub and Salmon transports).
*
* You should be able to round-trip data from this format back
* through $this->saveNoticeFromActivity(). Where applicable, try
}
/**
- * Handle a posted object from PuSH
+ * Handle a posted object from WebSub
*
* @param Activity $activity activity to handle
* @param Profile $actor Profile for the feed
<?php
/**
- * GNU social feed polling plugin, to avoid using external PuSH hubs
+ * GNU social feed polling plugin, to avoid using external WebSub hubs
*
* @category Feed
* @package GNUsocial
public function onFeedSubscribe(FeedSub $feedsub)
{
- if (!$feedsub->isPuSH()) {
+ if (!$feedsub->isWebSub()) {
FeedPoll::setupFeedSub($feedsub, $this->interval*60);
return false; // We're polling this feed, so stop processing FeedSubscribe
}
public function onFeedUnsubscribe(FeedSub $feedsub)
{
- if (!$feedsub->isPuSH()) {
+ if (!$feedsub->isWebSub()) {
// removes sub_state setting and such
$feedsub->confirmUnsubscribe();
return false;
-The FeedPoller plugin allows users to subscribe to non-PuSH-enabled feeds
+The FeedPoller plugin allows users to subscribe to non-WebSub-enabled feeds
by regularly polling the source for new content.
Installation
return true;
}
if (!$feedsub->sub_state == 'nohub') {
- // We're not supposed to poll this (either it's PuSH or it's unsubscribed)
+ // We're not supposed to poll this (either it's WebSub or it's unsubscribed)
return true;
}
}
if ($feedsub->sub_state != 'nohub') {
- echo "Feed is a PuSH feed, so we will not poll it.\n";
+ echo "Feed is a WebSub feed, so we will not poll it.\n";
exit(1);
}
$m->connect('main/ostatuspeopletag',
array('action' => 'ostatuspeopletag'));
- // PuSH actions
+ // WebSub actions
$m->connect('main/push/hub', array('action' => 'pushhub'));
$m->connect('main/push/callback/:feed',
// Prepare outgoing distributions after notice save.
$qm->connect('ostatus', 'OStatusQueueHandler');
- // Outgoing from our internal PuSH hub
+ // Outgoing from our internal WebSub hub
$qm->connect('hubconf', 'HubConfQueueHandler');
$qm->connect('hubprep', 'HubPrepQueueHandler');
// Outgoing Salmon replies (when we don't need a return value)
$qm->connect('salmon', 'SalmonQueueHandler');
- // Incoming from a foreign PuSH hub
+ // Incoming from a foreign WebSub hub
$qm->connect('pushin', 'PushInQueueHandler');
// Re-subscribe feeds that need renewal
}
/**
- * Set up a PuSH hub link to our internal link for canonical timeline
+ * Set up a WebSub hub link to our internal link for canonical timeline
* Atom feeds for users and groups.
*/
function onStartApiAtom($feed)
if (!empty($id)) {
$hub = common_config('ostatus', 'hub');
if (empty($hub)) {
- // Updates will be handled through our internal PuSH hub.
+ // Updates will be handled through our internal WebSub hub.
$hub = common_local_url('pushhub');
}
$feed->addLink($hub, array('rel' => 'hub'));
}
/**
- * Send incoming PuSH feeds for OStatus endpoints in for processing.
+ * Send incoming WebSub feeds for OStatus endpoints in for processing.
*
* @param FeedSub $feedsub
* @param DOMDocument $feed
/**
* When about to subscribe to a remote user, start a server-to-server
- * PuSH subscription if needed. If we can't establish that, abort.
+ * WebSub subscription if needed. If we can't establish that, abort.
*
* @fixme If something else aborts later, we could end up with a stray
- * PuSH subscription. This is relatively harmless, though.
+ * WebSub subscription. This is relatively harmless, though.
*
* @param Profile $profile subscriber
* @param Profile $other subscribee
return true;
}
- // Drop the PuSH subscription if there are no other subscribers.
+ // Drop the WebSub subscription if there are no other subscribers.
$oprofile->garbageCollect();
$act = new Activity();
return true;
}
- // Drop the PuSH subscription if there are no other subscribers.
+ // Drop the WebSub subscription if there are no other subscribers.
$oprofile->garbageCollect();
$member = $profile;
return true;
}
- // Drop the PuSH subscription if there are no other subscribers.
+ // Drop the WebSub subscription if there are no other subscribers.
$oprofile->garbageCollect();
$sub = Profile::getKV($user->id);
$oprofile->notifyDeferred($act, $tagger);
- // initiate a PuSH subscription for the person being tagged
+ // initiate a WebSub subscription for the person being tagged
$oprofile->subscribe();
return true;
}
$oprofile->notifyDeferred($act, $tagger);
- // unsubscribe to PuSH feed if no more required
+ // unsubscribe to WebSub feed if no more required
$oprofile->garbageCollect();
return true;
// Find foreign accounts I'm subscribed to that support Salmon pings.
//
- // @fixme we could run updates through the PuSH feed too,
+ // @fixme we could run updates through the WebSub feed too,
// in which case we can skip Salmon pings to folks who
// are also subscribed to me.
$sql = "SELECT * FROM ostatus_profile " .
and similar social networking / microblogging / blogging sites, but includes
low-level feed subscription systems which are used by some other plugins.
-Uses PubSubHubbub for push feed updates; currently non-PuSH feeds cannot be
-subscribed unless an external PuSH hub proxy is used.
+Uses WebSub (previously named PubSubHubbub or PuSH) for push feed updates;
+currently non-WebSub feeds cannot be subscribed unless an external
+WebSub hub proxy is used.
Configuration options available:
$config['ostatus']['hub']
(default internal hub)
- Set to URL of an external PuSH hub to use it instead of our internal hub
+ Set to URL of an external WebSub hub to use it instead of our internal hub
for sending outgoing updates in user and group feeds.
$config['ostatus']['hub_retries']
(default 0)
- Number of times to retry a PuSH send to consumers if using internal hub
+ Number of times to retry a WebSub send to consumers if using internal hub
Settings controlling incoming feed subscription:
$config['feedsub']['fallback_hub']
- To subscribe to feeds that don't have a hub, an external PuSH proxy hub
+ To subscribe to feeds that don't have a hub, an external WebSub proxy hub
such as Superfeedr may be used. Any feed without a hub of its own will
be subscribed through the specified hub URL instead. If the external hub
has usage charges, be aware that there is no restriction placed to how
$feedsub = FeedSub::getKV('id', $feedid);
if (!$feedsub instanceof FeedSub) {
// TRANS: Server exception. %s is a feed ID.
- throw new ServerException(sprintf(_m('Unknown PuSH feed id %s'),$feedid), 400);
+ throw new ServerException(sprintf(_m('Unknown WebSub subscription feed id %s'),$feedid), 400);
}
$hmac = '';
*/
/**
- * Integrated PuSH hub; lets us only ping them what need it.
+ * Integrated WebSub hub; lets us only ping them what need it.
* @package Hub
* @maintainer Brion Vibber <brion@status.net>
*/
}
/**
- * Process a request for a new or modified PuSH feed subscription.
+ * Process a request for a new or modified WebSub feed subscription.
* If asynchronous verification is requested, updates won't be saved immediately.
*
* HTTP return codes:
{
$callback = $this->argUrl('hub.callback');
- common_debug('New PuSH hub request ('._ve($mode).') for callback '._ve($callback));
+ common_debug('New WebSub hub request ('._ve($mode).') for callback '._ve($callback));
$topic = $this->argUrl('hub.topic');
if (!$this->recognizedFeed($topic)) {
- common_debug('PuSH hub request had unrecognized feed topic=='._ve($topic));
+ common_debug('WebSub hub request had unrecognized feed topic=='._ve($topic));
// TRANS: Client exception. %s is a topic.
throw new ClientException(sprintf(_m('Unsupported hub.topic %s this hub only serves local user and group Atom feeds.'),$topic));
}
$lease = $this->arg('hub.lease_seconds', null);
if ($mode == 'subscribe' && $lease != '' && !preg_match('/^\d+$/', $lease)) {
- common_debug('PuSH hub request had invalid lease_seconds=='._ve($lease));
+ common_debug('WebSub hub request had invalid lease_seconds=='._ve($lease));
// TRANS: Client exception. %s is the invalid lease value.
throw new ClientException(sprintf(_m('Invalid hub.lease "%s". It must be empty or positive integer.'),$lease));
}
$secret = $this->arg('hub.secret', null);
if ($secret != '' && strlen($secret) >= 200) {
- common_debug('PuSH hub request had invalid secret=='._ve($secret));
+ common_debug('WebSub hub request had invalid secret=='._ve($secret));
// TRANS: Client exception. %s is the invalid hub secret.
throw new ClientException(sprintf(_m('Invalid hub.secret "%s". It must be under 200 bytes.'),$secret));
}
$sub = HubSub::getByHashkey($topic, $callback);
if (!$sub instanceof HubSub) {
// Creating a new one!
- common_debug('PuSH creating new HubSub entry for topic=='._ve($topic).' to remote callback '._ve($callback));
+ common_debug('WebSub creating new HubSub entry for topic=='._ve($topic).' to remote callback '._ve($callback));
$sub = new HubSub();
$sub->topic = $topic;
$sub->callback = $callback;
$sub->setLease(intval($lease));
}
}
- common_debug('PuSH hub request is now:'._ve($sub));
+ common_debug('WebSub hub request is now:'._ve($sub));
$verify = $this->arg('hub.verify'); // TODO: deprecated
$token = $this->arg('hub.verify_token', null); // TODO: deprecated
if ($verify == 'sync') { // pre-0.4 PuSH
$sub->verify($mode, $token);
header('HTTP/1.1 204 No Content');
- } else { // If $verify is not "sync", we might be using PuSH 0.4
- $sub->scheduleVerify($mode, $token); // If we were certain it's PuSH 0.4, token could be removed
+ } else { // If $verify is not "sync", we might be using WebSub or PuSH 0.4
+ $sub->scheduleVerify($mode, $token); // If we were certain it's WebSub or PuSH 0.4, token could be removed
header('HTTP/1.1 202 Accepted');
}
}
*/
/*
-PuSH subscription flow:
+WebSub (previously PubSubHubbub/PuSH) subscription flow:
$profile->subscribe()
sends a sub request to the hub...
*/
/**
- * FeedSub handles low-level PubHubSubbub (PuSH) subscriptions.
+ * FeedSub handles low-level WebSub (PubSubHubbub/PuSH) subscriptions.
* Higher-level behavior building OStatus stuff on top is handled
* under Ostatus_profile.
*/
public $id;
public $uri; // varchar(191) not 255 because utf8mb4 takes more space
- // PuSH subscription data
+ // WebSub subscription data
public $huburi;
public $secret;
public $sub_state; // subscribe, active, unsubscribe, inactive, nohub
}
/**
- * Do we have a hub? Then we are a PuSH feed.
- * https://en.wikipedia.org/wiki/PubSubHubbub
+ * Do we have a hub? Then we are a WebSub feed.
+ * WebSub standard: https://www.w3.org/TR/websub/
+ * old: https://en.wikipedia.org/wiki/PubSubHubbub
*
* If huburi is empty, then doublecheck that we are not using
* a fallback hub. If there is a fallback hub, it is only if the
- * sub_state is "nohub" that we assume it's not a PuSH feed.
+ * sub_state is "nohub" that we assume it's not a WebSub feed.
*/
- public function isPuSH()
+ public function isWebSub()
{
if (empty($this->huburi)
&& (!common_config('feedsub', 'fallback_hub')
/**
* @param string $feeduri
* @return FeedSub
- * @throws FeedSubException if feed is invalid or lacks PuSH setup
+ * @throws FeedSubException if feed is invalid or lacks WebSub setup
*/
public static function ensureFeed($feeduri)
{
public function subscribe()
{
if ($this->sub_state && $this->sub_state != 'inactive') {
- common_log(LOG_WARNING, sprintf('Attempting to (re)start PuSH subscription to %s in unexpected state %s', $this->getUri(), $this->sub_state));
+ common_log(LOG_WARNING, sprintf('Attempting to (re)start WebSub subscription to %s in unexpected state %s', $this->getUri(), $this->sub_state));
}
if (!Event::handle('FeedSubscribe', array($this))) {
return;
} else {
// TRANS: Server exception.
- throw new ServerException(_m('Attempting to start PuSH subscription for feed with no hub.'));
+ throw new ServerException(_m('Attempting to start WebSub subscription for feed with no hub.'));
}
}
}
/**
- * Send a PuSH unsubscription request to the hub for this feed.
+ * Send a WebSub unsubscription request to the hub for this feed.
* The hub will later send us a confirmation POST to /main/push/callback.
* Warning: this will cancel the subscription even if someone else in
* the system is using it. Most callers will want garbageCollect() instead,
*/
public function unsubscribe() {
if ($this->sub_state != 'active') {
- common_log(LOG_WARNING, sprintf('Attempting to (re)end PuSH subscription to %s in unexpected state %s', $this->getUri(), $this->sub_state));
+ common_log(LOG_WARNING, sprintf('Attempting to (re)end WebSub subscription to %s in unexpected state %s', $this->getUri(), $this->sub_state));
}
if (!Event::handle('FeedUnsubscribe', array($this))) {
* A plugin should handle the FeedSub above and set the proper state
* if there is no hub. (instead of 'nohub' it should be 'inactive' if
* the instance has enabled feed polling for feeds that don't publish
- * PuSH/WebSub hubs. FeedPoller is a plugin which enables polling.
+ * WebSub/PuSH hubs. FeedPoller is a plugin which enables polling.
*
* Secondly, if we don't have the setting "nohub" enabled (i.e.)
* we're ready to poll ourselves, there is something odd with the
if (!common_config('feedsub', 'nohub')) {
// TRANS: Server exception.
- throw new ServerException(_m('Attempting to end PuSH subscription for feed with no hub.'));
+ throw new ServerException(_m('Attempting to end WebSub subscription for feed with no hub.'));
}
return;
public function garbageCollect()
{
if ($this->sub_state == '' || $this->sub_state == 'inactive') {
- // No active PuSH subscription, we can just leave it be.
+ // No active WebSub subscription, we can just leave it be.
return true;
}
- // PuSH subscription is either active or in an indeterminate state.
+ // WebSub subscription is either active or in an indeterminate state.
// Check if we're out of subscribers, and if so send an unsubscribe.
$count = 0;
Event::handle('FeedSubSubscriberCount', array($this, &$count));
$client->setAuth($u, $p);
}
} else {
- throw new FeedSubException('Server could not find a usable PuSH hub.');
+ throw new FeedSubException('Server could not find a usable WebSub hub.');
}
}
$response = $client->post($hub, $headers, $post);
$status = $response->getStatus();
- // PuSH specificed response status code
+ // WebSub specificed response status code
if ($status == 202 || $status == 204) {
common_log(LOG_INFO, __METHOD__ . ': sub req ok, awaiting verification callback');
return;
$msg = sprintf(_m("Unexpected HTTP status: %d"), $status);
} else if ($status == 422) {
// Error code regarding something wrong in the data (it seems
- // that we're talking to a PuSH hub at least, so let's check
+ // that we're talking to a WebSub hub at least, so let's check
// our own data to be sure we're not mistaken somehow.
$this->ensureHub(true);
}
/**
- * Save PuSH subscription confirmation.
+ * Save WebSub subscription confirmation.
* Sets approximate lease start and end times and finalizes state.
*
* @param int $lease_seconds provided hub.lease_seconds parameter, if given
}
/**
- * Save PuSH unsubscription confirmation.
- * Wipes active PuSH sub info and resets state.
+ * Save WebSub unsubscription confirmation.
+ * Wipes active WebSub sub info and resets state.
*/
public function confirmUnsubscribe()
{
}
/**
- * Accept updates from a PuSH feed. If validated, this object and the
+ * Accept updates from a WebSub feed. If validated, this object and the
* feed (as a DOMDocument) will be passed to the StartFeedSubHandleFeed
* and EndFeedSubHandleFeed events for processing.
*
common_log(LOG_INFO, sprintf(__METHOD__.': packet for %s with HMAC %s', _ve($this->getUri()), _ve($hmac)));
if (!in_array($this->sub_state, array('active', 'nohub'))) {
- common_log(LOG_ERR, sprintf(__METHOD__.': ignoring PuSH for inactive feed %s (in state %s)', _ve($this->getUri()), _ve($this->sub_state)));
+ common_log(LOG_ERR, sprintf(__METHOD__.': ignoring WebSub for inactive feed %s (in state %s)', _ve($this->getUri()), _ve($this->sub_state)));
return;
}
if (preg_match('/^([0-9a-zA-Z\-\,]{3,16})=([0-9a-fA-F]+)$/', $hmac, $matches)) {
$hash_algo = strtolower($matches[1]);
$their_hmac = strtolower($matches[2]);
- common_debug(sprintf(__METHOD__ . ': PuSH from feed %s uses HMAC algorithm %s with value: %s', _ve($this->getUri()), _ve($hash_algo), _ve($their_hmac)));
+ common_debug(sprintf(__METHOD__ . ': WebSub push from feed %s uses HMAC algorithm %s with value: %s', _ve($this->getUri()), _ve($hash_algo), _ve($their_hmac)));
if (!in_array($hash_algo, hash_algos())) {
// We can't handle this at all, PHP doesn't recognize the algorithm name ('md5', 'sha1', 'sha256' etc: https://secure.php.net/manual/en/function.hash-algos.php)
$our_hmac = hash_hmac($hash_algo, $post, $this->secret);
if ($their_hmac !== $our_hmac) {
- common_log(LOG_ERR, sprintf(__METHOD__.': ignoring PuSH with bad HMAC hash: got %s, expected %s for feed %s from hub %s', _ve($their_hmac), _ve($our_hmac), _ve($this->getUri()), _ve($this->huburi)));
- throw new FeedSubBadPushSignatureException('Incoming PuSH signature did not match expected HMAC hash.');
+ common_log(LOG_ERR, sprintf(__METHOD__.': ignoring WebSub push with bad HMAC hash: got %s, expected %s for feed %s from hub %s', _ve($their_hmac), _ve($our_hmac), _ve($this->getUri()), _ve($this->huburi)));
+ throw new FeedSubBadPushSignatureException('Incoming WebSub push signature did not match expected HMAC hash.');
}
return true;
} else {
- common_log(LOG_ERR, sprintf(__METHOD__.': ignoring PuSH with bogus HMAC==', _ve($hmac)));
+ common_log(LOG_ERR, sprintf(__METHOD__.': ignoring WebSub push with bogus HMAC==', _ve($hmac)));
}
} else {
if (empty($hmac)) {
return true;
} else {
- common_log(LOG_ERR, sprintf(__METHOD__.': ignoring PuSH with unexpected HMAC==%s', _ve($hmac)));
+ common_log(LOG_ERR, sprintf(__METHOD__.': ignoring WebSub push with unexpected HMAC==%s', _ve($hmac)));
}
}
return false;
if (!defined('GNUSOCIAL')) { exit(1); }
/**
- * PuSH feed subscription record
+ * WebSub (previously PuSH) feed subscription record
* @package Hub
* @author Brion Vibber <brion@status.net>
*/
*/
function setLease($length)
{
- common_debug('PuSH hub got requested lease_seconds=='._ve($length));
+ common_debug('WebSub hub got requested lease_seconds=='._ve($length));
assert(is_int($length));
$min = 86400; // 3600*24 (one day)
$length = $max;
}
- common_debug('PuSH hub after sanitation: lease_seconds=='._ve($length));
+ common_debug('WebSub hub after sanitation: lease_seconds=='._ve($length));
$this->sub_start = common_sql_now();
$this->sub_end = common_sql_date(time() + $length);
}
$data = array('sub' => $sub,
'atom' => $atom,
'retries' => $retries);
- common_log(LOG_INFO, "Queuing PuSH: {$this->getTopic()} to {$this->callback}");
+ common_log(LOG_INFO, "Queuing WebSub: {$this->getTopic()} to {$this->callback}");
$qm = QueueManager::get();
$qm->enqueue($data, 'hubout');
}
$data = array('atom' => $atom,
'topic' => $this->getTopic(),
'pushCallbacks' => $pushCallbacks);
- common_log(LOG_INFO, "Queuing PuSH batch: {$this->getTopic()} to ".count($pushCallbacks)." sites");
+ common_log(LOG_INFO, "Queuing WebSub batch: {$this->getTopic()} to ".count($pushCallbacks)." sites");
$qm = QueueManager::get();
$qm->enqueue($data, 'hubprep');
return true;
} catch (Exception $e) {
$response = null;
- common_debug('PuSH callback to '._ve($this->callback).' for '._ve($this->getTopic()).' failed with exception: '._ve($e->getMessage()));
+ common_debug('WebSub callback to '._ve($this->callback).' for '._ve($this->getTopic()).' failed with exception: '._ve($e->getMessage()));
}
// XXX: DO NOT trust a Location header here, _especially_ from 'http' protocols,
// the most common change here is simply switching 'http' to 'https' and we will
// solve 99% of all of these issues for now. There should be a proper mechanism
// if we want to change the callback URLs, preferrably just manual resubscriptions
- // from the remote side, combined with implemented PuSH subscription timeouts.
+ // from the remote side, combined with implemented WebSub subscription timeouts.
- // We failed the PuSH, but it might be that the remote site has changed their configuration to HTTPS
+ // We failed the WebSub, but it might be that the remote site has changed their configuration to HTTPS
if ('http' === parse_url($this->callback, PHP_URL_SCHEME)) {
// Test if the feed callback for this node has migrated to HTTPS
$httpscallback = preg_replace('/^http/', 'https', $this->callback, 1);
throw new AlreadyFulfilledException('The remote side has already established an HTTPS callback, deleting the legacy HTTP entry.');
}
- common_debug('PuSH callback to '._ve($this->callback).' for '._ve($this->getTopic()).' trying HTTPS callback: '._ve($httpscallback));
+ common_debug('WebSub callback to '._ve($this->callback).' for '._ve($this->getTopic()).' trying HTTPS callback: '._ve($httpscallback));
$response = $request->post($httpscallback, $headers);
if ($response->isOk()) {
$orig = clone($this);
/**
* Check if this remote profile has any active local subscriptions, and
- * if not drop the PuSH subscription feed.
+ * if not drop the WebSub subscription feed.
*
* @return boolean true if subscription is removed, false if there are still subscribers to the feed
* @throws Exception of various kinds on failure.
/**
* Check if this remote profile has any active local subscriptions, and
- * if not drop the PuSH subscription feed.
+ * if not drop the WebSub subscription feed.
*
* @return boolean true if subscription is removed, false if there are still subscribers to the feed
* @throws Exception of various kinds on failure.
/**
* Check if this remote profile has any active local subscriptions, so the
- * PuSH subscription layer can decide if it can drop the feed.
+ * WebSub subscription layer can decide if it can drop the feed.
*
* This gets called via the FeedSubSubscriberCount event when running
* FeedSub::garbageCollect().
/**
* Read and post notices for updates from the feed.
* Currently assumes that all items in the feed are new,
- * coming from a PuSH hub.
+ * coming from a WebSub hub.
*
* @param DOMDocument $doc
* @param string $source identifier ("push")
$hints['salmon'] = $salmonuri;
if (!$huburi && !common_config('feedsub', 'fallback_hub') && !common_config('feedsub', 'nohub')) {
- // We can only deal with folks with a PuSH hub
+ // We can only deal with folks with a WebSub hub
// unless we have something similar available locally.
throw new FeedSubNoHubException();
}
}
if (!$huburi && !common_config('feedsub', 'fallback_hub') && !common_config('feedsub', 'nohub')) {
- // We can only deal with folks with a PuSH hub
+ // We can only deal with folks with a WebSub hub
throw new FeedSubNoHubException();
}
}
/**
- * Get the referenced PuSH hub link from an Atom feed.
+ * Get the referenced WebSub hub link from an Atom feed.
*
* @return mixed string or false
*/
}
/**
- * Send a PuSH subscription verification from our internal hub.
+ * Send a WebSub subscription verification from our internal hub.
* @package Hub
* @author Brion Vibber <brion@status.net>
*/
try {
$sub->verify($mode, $token);
} catch (Exception $e) {
- common_log(LOG_ERR, "Failed PuSH $mode verify to $sub->callback for $sub->topic: " .
+ common_log(LOG_ERR, "Failed WebSub $mode verify to $sub->callback for $sub->topic: " .
$e->getMessage());
// @fixme schedule retry?
// @fixme just kill it?
}
/**
- * Send a raw PuSH atom update from our internal hub.
+ * Send a raw WebSub push atom update from our internal hub.
* @package Hub
* @author Brion Vibber <brion@status.net>
*/
try {
$sub->push($atom);
} catch (AlreadyFulfilledException $e) {
- common_log(LOG_INFO, "Failed PuSH to $sub->callback for $sub->topic (".get_class($e)."): " . $e->getMessage());
+ common_log(LOG_INFO, "Failed WebSub push to $sub->callback for $sub->topic (".get_class($e)."): " . $e->getMessage());
} catch (Exception $e) {
$retries--;
- $msg = "Failed PuSH to $sub->callback for $sub->topic (".get_class($e)."): " . $e->getMessage();
+ $msg = "Failed WebSub push to $sub->callback for $sub->topic (".get_class($e)."): " . $e->getMessage();
if ($retries > 0) {
common_log(LOG_INFO, "$msg; scheduling for $retries more tries");
}
/**
- * When we have a large batch of PuSH consumers, we break the data set
+ * When we have a large batch of WebSub consumers, we break the data set
* into smaller chunks. Enqueue final destinations...
*
* @package Hub
$callback = array_shift($pushCallbacks);
$sub = HubSub::getByHashkey($topic, $callback);
if (!$sub) {
- common_log(LOG_ERR, "Skipping PuSH delivery for deleted(?) consumer $callback on $topic");
+ common_log(LOG_ERR, "Skipping WebSub delivery for deleted(?) consumer $callback on $topic");
continue;
}
$sub->distribute($atom);
}
} catch (Exception $e) {
- common_log(LOG_ERR, "Exception during PuSH batch out: " .
+ common_log(LOG_ERR, "Exception during WebSub batch out: " .
$e->getMessage() .
" prepping $topic to $callback");
}
}
/**
- * Prepare PuSH and Salmon distributions for an outgoing message.
+ * Prepare WebSub and Salmon distributions for an outgoing message.
*
* @package OStatusPlugin
* @author Brion Vibber <brion@status.net>
class OStatusQueueHandler extends QueueHandler
{
// If we have more than this many subscribing sites on a single feed,
- // break up the PuSH distribution into smaller batches which will be
+ // break up the WebSub distribution into smaller batches which will be
// rolled into the queue progressively. This reduces disruption to
// other, shorter activities being enqueued while we work.
const MAX_UNBATCHED = 50;
{
if ($this->user) {
common_debug("OSTATUS [{$this->notice->getID()}]: pushing feed for local user {$this->user->getID()}");
- // For local posts, ping the PuSH hub to update their feed.
+ // For local posts, ping the WebSub hub to update their feed.
// http://identi.ca/api/statuses/user_timeline/1.atom
$feed = common_local_url('ApiTimelineUser',
array('id' => $this->user->id,
function pushGroup(User_group $group)
{
common_debug("OSTATUS [{$this->notice->getID()}]: pushing group '{$group->getNickname()}' profile_id={$group->profile_id}");
- // For a local group, ping the PuSH hub to update its feed.
+ // For a local group, ping the WebSub hub to update its feed.
// Updates may come from either a local or a remote user.
$feed = common_local_url('ApiTimelineGroup',
array('id' => $group->getID(),
function pushPeopletag($ptag)
{
common_debug("OSTATUS [{$this->notice->getID()}]: pushing peopletag '{$ptag->id}'");
- // For a local people tag, ping the PuSH hub to update its feed.
+ // For a local people tag, ping the WebSub hub to update its feed.
// Updates may come from either a local or a remote user.
$feed = common_local_url('ApiTimelineList',
array('id' => $ptag->id,
$atom = call_user_func_array($callback, $args);
$this->pushFeedInternal($atom, $sub);
} else {
- common_log(LOG_INFO, "OSTATUS [{$this->notice->getID()}]: No PuSH subscribers for $feed");
+ common_log(LOG_INFO, "OSTATUS [{$this->notice->getID()}]: No WebSub subscribers for $feed");
}
}
* Not guaranteed safe in an environment with database replication.
*
* @param string $feed feed topic URI
- * @param string $hub PuSH hub URI
+ * @param string $hub WebSub hub URI
* @fixme can consolidate pings for user & group posts
*/
function pushFeedExternal($feed, $hub)
'hub.url' => $feed);
$response = $client->post($hub, array(), $data);
if ($response->getStatus() == 204) {
- common_log(LOG_INFO, "PuSH ping to hub $hub for $feed ok");
+ common_log(LOG_INFO, "WebSub ping to hub $hub for $feed ok");
return true;
} else {
- common_log(LOG_ERR, "PuSH ping to hub $hub for $feed failed with HTTP " .
+ common_log(LOG_ERR, "WebSub ping to hub $hub for $feed failed with HTTP " .
$response->getStatus() . ': ' .
$response->getBody());
}
} catch (Exception $e) {
- common_log(LOG_ERR, "PuSH ping to hub $hub for $feed failed: " . $e->getMessage());
+ common_log(LOG_ERR, "WebSub ping to hub $hub for $feed failed: " . $e->getMessage());
return false;
}
}
*/
function pushFeedInternal($atom, $sub)
{
- common_log(LOG_INFO, "Preparing $sub->N PuSH distribution(s) for $sub->topic");
+ common_log(LOG_INFO, "Preparing $sub->N WebSub distribution(s) for $sub->topic");
$n = 0;
$batch = array();
while ($sub->fetch()) {
if (!defined('GNUSOCIAL')) { exit(1); }
/**
- * Process a feed distribution POST from a PuSH hub.
+ * Process a feed distribution POST from a WebSub (previously PuSH) hub.
* @package FeedSub
* @author Brion Vibber <brion@status.net>
*/
} catch(NoResultException $e) {
common_log(LOG_INFO, "Discarding POST to unknown feed subscription id {$feedsub_id}");
} catch(Exception $e) {
- common_log(LOG_ERR, "Exception "._ve(get_class($e))." during PuSH input processing for {$feedsub->getUri()}: " . $e->getMessage());
+ common_log(LOG_ERR, "Exception "._ve(get_class($e))." during WebSub push input processing for {$feedsub->getUri()}: " . $e->getMessage());
}
return true;
}
common_log(LOG_INFO, "Renewing feed subscription\n\tExp.: {$feedsub->sub_end}\n\tFeed: {$feedsub->uri}\n\tHub: {$feedsub->huburi}");
$feedsub->renew();
} catch(Exception $e) {
- common_log(LOG_ERR, "Exception during PuSH renew processing for $feedsub->uri: " . $e->getMessage());
+ common_log(LOG_ERR, "Exception during WebSub renew processing for $feedsub->uri: " . $e->getMessage());
}
} else {
common_log(LOG_ERR, "Discarding renew for unknown feed subscription id $feedsub_id");
$helptext = <<<END_OF_HELP
resub-feed.php [options] http://example.com/atom-feed-url
-Reinitialize the PuSH subscription for the given feed. This may help get
+Reinitialize the WebSub subscription for the given feed. This may help get
things restarted if we and the hub have gotten our states out of sync.
Options:
$helptext = <<<END_OF_HELP
testfeed.php [options] http://example.com/atom-feed-url
-Pull an Atom feed and run items in it as though they were live PuSH updates.
+Pull an Atom feed and run items in it as though they were live WebSub updates.
Mainly intended for testing funky feed formats.
--skip=N Ignore the first N items in the feed.
update-profile.php [options] http://example.com/profile/url
Rerun profile and feed info discovery for the given OStatus remote profile,
-and reinitialize its PuSH subscription for the given feed. This may help get
+and reinitialize its WebSub subscription for the given feed. This may help get
things restarted if the hub or feed URLs have changed for the profile.
$this->assertTrue($this->pub->hasSubscriber($this->sub->getProfileUri()));
$name = $this->sub->username;
- $post = $this->pub->post("Regular post, which $name should get via PuSH");
+ $post = $this->pub->post("Regular post, which $name should get via WebSub");
$this->sub->assertReceived($post);
}
-The SubMirror plugin pull PuSH-enabled feeds into your timeline.
+The SubMirror plugin pull WebSub-enabled feeds into your timeline.
Installation
============