]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into 0.9.x
authorBrion Vibber <brion@pobox.com>
Wed, 2 Mar 2011 21:52:22 +0000 (13:52 -0800)
committerBrion Vibber <brion@pobox.com>
Wed, 2 Mar 2011 21:52:22 +0000 (13:52 -0800)
plugins/OStatus/scripts/resub-feed.php

index 8803c0118b89ff20d12d27aac6af9b6203dfb8d3..a08d837993df35e3746c60cd670bc86213d0bc5c 100644 (file)
 
 define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
 
+$longoptions = array('unsub');
+$shortoptions = 'u';
+
 $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
 things restarted if we and the hub have gotten our states out of sync.
 
+Options:
+
+   -u --unsub  Unsubscribe instead of subscribing.
 
 END_OF_HELP;
 
@@ -48,8 +54,14 @@ print "Old state:\n";
 showSub($sub);
 
 print "\n";
-print "Pinging hub $sub->huburi with new subscription for $sub->uri\n";
-$ok = $sub->subscribe();
+
+if (have_option('u') || have_option('--unsub')) {
+    print "Pinging hub $sub->huburi with unsubscription for $sub->uri\n";
+    $ok = $sub->unsubscribe();
+} else {
+    print "Pinging hub $sub->huburi with new subscription for $sub->uri\n";
+    $ok = $sub->subscribe();
+}
 
 if ($ok) {
     print "ok\n";