X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Fclear_jabber.php;h=c6756a5cd623865ab798e59d984c937fa76a408c;hb=22b9031ebeed923bf758199153b5cef6fce9661f;hp=5ec53caf0e8fc38f0f0d8aa0311ea99fc624a0f5;hpb=8884a5255fb90fda67b63fa0d4252d77176337e5;p=quix0rs-gnu-social.git diff --git a/scripts/clear_jabber.php b/scripts/clear_jabber.php index 5ec53caf0e..c6756a5cd6 100755 --- a/scripts/clear_jabber.php +++ b/scripts/clear_jabber.php @@ -34,18 +34,18 @@ Deletes a user's confirmed Jabber/XMPP address 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); @@ -67,7 +67,7 @@ if (have_option('i', 'id')) { function clear_jabber($id) { - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if ($user && $user->jabber) { echo "clearing user $id's user.jabber, was: $user->jabber"; if (have_option('dry-run')) { @@ -75,7 +75,11 @@ function clear_jabber($id) } else { $original = clone($user); $user->jabber = null; - $result = $user->updateKeys($original); + try { + $user->updateWithKeys($original); + } catch (Exception $e) { + echo "WARNING: user update failed (setting jabber to null): ".$e->getMessage()."\n"; + } } echo "\n"; } else if (!$user) {