From: Mikael Nordfeldth Date: Tue, 21 Apr 2015 21:47:55 +0000 (+0200) Subject: deleteuser script changed to deleteprofile X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=529b2f6613007d2fce427cc2fef63af9bbcd7b36;p=quix0rs-gnu-social.git deleteuser script changed to deleteprofile Delete remote profiles by providing their ID if known, or you can provide their profile URI with --uri=https://... Useful for cleaning up old, long gone and no longer desired profiles and their notices. --- diff --git a/scripts/deleteprofile.php b/scripts/deleteprofile.php new file mode 100755 index 0000000000..8eed6ff97b --- /dev/null +++ b/scripts/deleteprofile.php @@ -0,0 +1,78 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'i::n::u::y'; +$longoptions = array('id=', 'nickname=', 'uri=', 'yes'); + +$helptext = <<getProfile(); +} else if (have_option('u', 'uri')) { + $uri = get_option_value('u', 'uri'); + $oprofile = Ostatus_profile::getKV('uri', $uri); + if (!$oprofile instanceof Ostatus_profile) { + print "Can't find profile with URI '$uri'\n"; + exit(1); + } + $profile = $oprofile->localProfile(); +} else { + print "You must provide either an ID, a URI or a nickname.\n"; + exit(1); +} + +if (!have_option('y', 'yes')) { + print "About to PERMANENTLY delete profile '".$profile->getNickname()."' ({$profile->id}). Are you sure? [y/N] "; + $response = fgets(STDIN); + if (strtolower(trim($response)) != 'y') { + print "Aborting.\n"; + exit(0); + } +} + +print "Deleting..."; +$profile->delete(); +print "DONE.\n"; diff --git a/scripts/deleteuser.php b/scripts/deleteuser.php deleted file mode 100755 index 25af1c5ce2..0000000000 --- a/scripts/deleteuser.php +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env php -. - */ - -define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); - -$shortoptions = 'i::n::y'; -$longoptions = array('id=', 'nickname=', 'yes'); - -$helptext = <<nickname}' ({$user->id}). Are you sure? [y/N] "; - $response = fgets(STDIN); - if (strtolower(trim($response)) != 'y') { - print "Aborting.\n"; - exit(0); - } -} - -print "Deleting..."; -$user->delete(); -print "DONE.\n";