From f14156510421089c9e309df105704ca9209778b9 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 4 Feb 2015 16:48:12 +0100 Subject: [PATCH] Allow delete-inactive for gcfeeds Garbage collecting should also allow to clean up leftover database entries. --- plugins/OStatus/scripts/gcfeeds.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/OStatus/scripts/gcfeeds.php b/plugins/OStatus/scripts/gcfeeds.php index a4f71ab77f..a95cd54dbc 100644 --- a/plugins/OStatus/scripts/gcfeeds.php +++ b/plugins/OStatus/scripts/gcfeeds.php @@ -20,20 +20,33 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); +$longoptions = array('delete-inactive'); +$shortoptions = 'd'; + $helptext = <<find(); while ($feedsub->fetch()) { try { echo $feedsub->getUri() . " ({$feedsub->sub_state})"; if ($feedsub->garbageCollect()) { + if ($delete_inactive) { + $delcount++; + $feedsub->delete(); + echo " DELETED"; + } echo " INACTIVE\n"; } else { echo " ACTIVE\n"; @@ -51,3 +64,5 @@ while ($feedsub->fetch()) { echo " ERROR: {$e->getMessage()}\n"; } } + +if ($delete_inactive) echo "\nDeleted $delcount inactive feeds.\n"; -- 2.39.5