From 529b2f6613007d2fce427cc2fef63af9bbcd7b36 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 21 Apr 2015 23:47:55 +0200 Subject: [PATCH] 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. --- scripts/{deleteuser.php => deleteprofile.php} | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) rename scripts/{deleteuser.php => deleteprofile.php} (60%) diff --git a/scripts/deleteuser.php b/scripts/deleteprofile.php similarity index 60% rename from scripts/deleteuser.php rename to scripts/deleteprofile.php index 25af1c5ce2..8eed6ff97b 100755 --- a/scripts/deleteuser.php +++ b/scripts/deleteprofile.php @@ -20,15 +20,16 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); -$shortoptions = 'i::n::y'; -$longoptions = array('id=', 'nickname=', 'yes'); +$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 or a nickname.\n"; + 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 user '{$user->nickname}' ({$user->id}). Are you sure? [y/N] "; + 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"; @@ -64,5 +74,5 @@ if (!have_option('y', 'yes')) { } print "Deleting..."; -$user->delete(); +$profile->delete(); print "DONE.\n";