aboutsummaryrefslogtreecommitdiff
path: root/bin/subscribe.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2016-11-25 07:54:49 +0100
committerChristian Weiske <cweiske@cweiske.de>2016-11-25 07:56:16 +0100
commitacf02a1269b9c191a66a7ea476f11d53d4ad0c08 (patch)
tree94332bd05859677747c4ffaad857b79f0c4351e2 /bin/subscribe.php
parentdd3e0698a71ca2746166f006135aeace83dfeb20 (diff)
downloadphinde-0.2.0.tar.gz
phinde-0.2.0.zip
script to renew websub subscriptionsv0.2.0
Diffstat (limited to 'bin/subscribe.php')
-rwxr-xr-xbin/subscribe.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/bin/subscribe.php b/bin/subscribe.php
index 768ee10..411fa86 100755
--- a/bin/subscribe.php
+++ b/bin/subscribe.php
@@ -43,12 +43,16 @@ if ($topic != $url) {
}
$sub = $subDb->get($topic);
-if ($sub !== false) {
- Log::error('Topic exists already in subscription table');
- Log::info('Current status: ' . $sub->sub_status);
- exit(3);
+if ($sub === false) {
+ $subDb->create($topic);
+} else {
+ Log::info(
+ 'Topic exists already in subscription table with status '
+ . $sub->sub_status
+ );
+ Log::info('Renewing subscription...');
+ $subDb->renew($sub->sub_id);
}
-$subDb->create($topic);
$sub = $subDb->get($topic);
$callbackUrl = $GLOBALS['phinde']['baseurl'] . 'push-subscription.php'