From: Zach Copley Date: Tue, 12 Apr 2011 09:29:02 +0000 (-0700) Subject: Script to delete bad OStatus hub URIs (until we have better error handling for broken... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=43f542c3a2a714c7dc935c69fc100809e64eead2;p=quix0rs-gnu-social.git Script to delete bad OStatus hub URIs (until we have better error handling for broken hubs) --- diff --git a/plugins/OStatus/scripts/rm_bad_feedsubs.php b/plugins/OStatus/scripts/rm_bad_feedsubs.php new file mode 100644 index 0000000000..ce1698a60c --- /dev/null +++ b/plugins/OStatus/scripts/rm_bad_feedsubs.php @@ -0,0 +1,83 @@ +#!/usr/bin/env php +. + */ + +/* + * Run this from INSTALLDIR/plugins/OStatus/scripts + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); + + +$shortoptions = 'd'; +$longoptions = array('dry-run'); + +$helptext = <<sub_state = 'subscribe'; +$feedsub->whereAdd('created < DATE_SUB(NOW(), INTERVAL 1 HOUR)'); +$feedsub->find(); +$cnt = 0; + +while ($feedsub->fetch()) { + echo "----------------------------------------------------------------------------------------\n"; + echo ' feed: ' + . $feedsub->uri . "\n" + . ' hub uri: ' + . $feedsub->huburi ."\n" + . ' subscribe date: ' + . date('r', strtotime($feedsub->created)) . "\n"; + + if (!$dry) { + $feedsub->delete(); + echo " (DELETED)\n"; + } else { + echo " (WOULD BE DELETED)\n"; + } + echo "----------------------------------------------------------------------------------------\n"; + $cnt++; +} +if ($cnt == 0) { + echo "None found.\n"; +} else { + echo "Deleted $cnt bogus hub URIs.\n"; +} +echo "Done.\n";