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";