X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=plugins%2FOStatus%2Fscripts%2Fresub-feed.php;h=efad67dbb5005f1894b2289341992c1708134a60;hb=d6b28c64830f632bb2f4b6f3c9369b9e56ad217a;hp=121d12109a1f1fb380d2085e257f2440180a2633;hpb=004e42e3e0606f0f9e5c8b6cd4512e5d870cd56e;p=quix0rs-gnu-social.git diff --git a/plugins/OStatus/scripts/resub-feed.php b/plugins/OStatus/scripts/resub-feed.php old mode 100644 new mode 100755 index 121d12109a..efad67dbb5 --- a/plugins/OStatus/scripts/resub-feed.php +++ b/plugins/OStatus/scripts/resub-feed.php @@ -20,17 +20,25 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); +$longoptions = array('unsub'); +$shortoptions = 'u'; + $helptext = <<uri($args[0])) { print "$helptext"; exit(1); } @@ -38,7 +46,7 @@ if (empty($args[0]) || !Validate::uri($args[0])) { $feedurl = $args[0]; -$sub = FeedSub::staticGet('topic', $feedurl); +$sub = FeedSub::getKV('uri', $feedurl); if (!$sub) { print "Feed $feedurl is not subscribed.\n"; exit(1); @@ -47,17 +55,21 @@ if (!$sub) { print "Old state:\n"; showSub($sub); -print "\n"; -print "Pinging hub $sub->huburi with new subscription for $sub->uri\n"; -$ok = $sub->subscribe(); - -if ($ok) { - print "ok\n"; -} else { - print "Could not confirm.\n"; +try { + echo "\n"; + if (have_option('u') || have_option('--unsub')) { + echo "Pinging hub {$sub->huburi} with unsubscription for {$sub->uri}\n"; + $sub->unsubscribe(); + } else { + echo "Pinging hub {$sub->huburi} with new subscription for {$sub->uri}\n"; + $sub->subscribe(); + } + echo "ok\n"; +} catch (Exception $e) { + echo 'Could not confirm. '.get_class($e).': '.$e->getMessage()."\n"; } -$sub2 = FeedSub::staticGet('topic', $feedurl); +$sub2 = FeedSub::getKV('uri', $feedurl); print "\n"; print "New state:\n";