]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/deleteuser.php
Misses this file to merge. I like the comments.
[quix0rs-gnu-social.git] / scripts / deleteuser.php
old mode 100644 (file)
new mode 100755 (executable)
index 67aea79..e815ea2
@@ -21,7 +21,7 @@
 define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
 
 $shortoptions = 'i::n::y';
-$longoptions = array('id::nickname::yes');
+$longoptions = array('id=', 'nickname=', 'yes');
 
 $helptext = <<<END_OF_DELETEUSER_HELP
 deleteuser.php [options]
@@ -33,18 +33,18 @@ deletes a user from the database
 
 END_OF_DELETEUSER_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 if (have_option('i', 'id')) {
     $id = get_option_value('i', 'id');
-    $user = User::staticGet('id', $id);
+    $user = User::getKV('id', $id);
     if (empty($user)) {
         print "Can't find user with ID $id\n";
         exit(1);
     }
 } else if (have_option('n', 'nickname')) {
     $nickname = get_option_value('n', 'nickname');
-    $user = User::staticGet('nickname', $nickname);
+    $user = User::getKV('nickname', $nickname);
     if (empty($user)) {
         print "Can't find user with nickname '$nickname'\n";
         exit(1);
@@ -57,7 +57,7 @@ if (have_option('i', 'id')) {
 if (!have_option('y', 'yes')) {
     print "About to PERMANENTLY delete user '{$user->nickname}' ({$user->id}). Are you sure? [y/N] ";
     $response = fgets(STDIN);
-    if (strtolower($response) != 'y') {
+    if (strtolower(trim($response)) != 'y') {
         print "Aborting.\n";
         exit(0);
     }