aboutsummaryrefslogtreecommitdiff
path: root/p/api/pshb.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2015-05-17 22:06:33 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2015-05-17 22:06:33 +0200
commit83ab5612423b2448c2bb69b6ffae5be0cb1590cd (patch)
treee38f9c1b055ea7ddf544750836b9c034b2464f25 /p/api/pshb.php
parenta3df8418c56cec5d97fc905078238a00cf9827f3 (diff)
parent001c713f030d51b74a860e20014153c6b4d9661f (diff)
Merge remote-tracking branch 'origin/PubSubHubbub' into dev
Diffstat (limited to 'p/api/pshb.php')
-rw-r--r--p/api/pshb.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/p/api/pshb.php b/p/api/pshb.php
index 2f7f48cd8..4bb4694b3 100644
--- a/p/api/pshb.php
+++ b/p/api/pshb.php
@@ -60,6 +60,10 @@ if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') {
} else {
unset($hubJson['lease_end']);
}
+ $hubJson['lease_start'] = time();
+ if (!isset($hubJson['error'])) {
+ $hubJson['error'] = true; //Do not assume that PubSubHubbub works until the first successul push
+ }
file_put_contents('./!hub.json', json_encode($hubJson));
exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : '');
}
@@ -120,6 +124,9 @@ if ($nb === 0) {
header('HTTP/1.1 410 Gone');
logMe('Error: Nobody is subscribed to this feed anymore after all!: ' . $self);
die('Nobody is subscribed to this feed anymore after all!');
+} elseif (!empty($hubJson['error'])) {
+ $hubJson['error'] = false;
+ file_put_contents('./!hub.json', json_encode($hubJson));
}
logMe('PubSubHubbub ' . $self . ' done: ' . $nb);