]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/scripts/update-profile.php
Renamed commandline.inc -> commandline.inc.php to avoid confusion.
[quix0rs-gnu-social.git] / plugins / OStatus / scripts / update-profile.php
index ff6a149c604c4afee29af0cba7a573b293ed9229..5b0c8b92e6af62a5f215019a3b8dba3aaee2e9b4 100644 (file)
@@ -30,7 +30,7 @@ things restarted if the hub or feed URLs have changed for the profile.
 
 END_OF_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (empty($args[0]) || !Validate::uri($args[0])) {
     print "$helptext";
@@ -56,7 +56,8 @@ print "Re-running feed discovery for profile URL $oprofile->uri\n";
 $discover = new FeedDiscovery();
 $feedurl = $discover->discoverFromURL($oprofile->uri);
 $huburi = $discover->getHubLink();
-$salmonuri = $discover->getAtomLink(Salmon::NS_REPLIES);
+$salmonuri = $discover->getAtomLink(Salmon::REL_SALMON)
+                ?: $discover->getAtomLink(Salmon::NS_REPLIES);
 
 print "  Feed URL: $feedurl\n";
 print "  Hub URL: $huburi\n";
@@ -104,14 +105,13 @@ if ($huburi != $sub->huburi) {
     print "Feed record ok, not changing.\n\n";
 }
 
-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";
+echo "\n";
+echo "Pinging hub {$sub->huburi} with new subscription for {$sub->uri}\n";
+try {
+    $sub->subscribe();
+    echo "ok\n";
+} catch (Exception $e) {
+    echo 'Could not confirm. '.get_class($e).': '.$e->getMessage()."\n";
 }
 
 $o2 = Ostatus_profile::getKV('uri', $uri);