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