From 573f98c5bc387b64bbce7020c15d63efef2b1d7a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 18 Nov 2010 14:40:05 -0800 Subject: [PATCH] scripts/deletegroup.php -- basic CLI script to delete a group by id or local nickname. Like deleteuser.php, this can be used in batch runs by providing the -y override. --- scripts/deletegroup.php | 71 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 scripts/deletegroup.php diff --git a/scripts/deletegroup.php b/scripts/deletegroup.php new file mode 100755 index 0000000000..5a1ac109fd --- /dev/null +++ b/scripts/deletegroup.php @@ -0,0 +1,71 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'i::n::y'; +$longoptions = array('id=', 'nickname=', 'yes'); + +$helptext = <<group_id); +} else { + print "You must provide either an ID or a nickname.\n"; + print "\n"; + print $helptext; + exit(1); +} + +if (!have_option('y', 'yes')) { + print "About to PERMANENTLY delete group '{$group->nickname}' ({$group->id}). Are you sure? [y/N] "; + $response = fgets(STDIN); + if (strtolower(trim($response)) != 'y') { + print "Aborting.\n"; + exit(0); + } +} + +print "Deleting..."; +$group->delete(); +print "DONE.\n"; -- 2.39.5