]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/registeruser.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / scripts / registeruser.php
old mode 100644 (file)
new mode 100755 (executable)
index 5d9c886..b7ee9f3
@@ -34,7 +34,7 @@ registers a user in the database
 
 END_OF_REGISTERUSER_HELP;
 
-require_once INSTALLDIR.'/scripts/commandline.inc';
+require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
 $nickname = get_option_value('n', 'nickname');
 $password = get_option_value('w', 'password');
@@ -49,7 +49,7 @@ if (empty($nickname) || empty($password)) {
 
 try {
 
-    $user = User::staticGet('nickname', $nickname);
+    $user = User::getKV('nickname', $nickname);
 
     if (!empty($user)) {
         throw new Exception("A user named '$nickname' already exists.");
@@ -69,10 +69,8 @@ try {
 
         $user->email = $email;
 
-        if (!$user->updateKeys($orig)) {
-            print "Failed!\n";
-            throw new Exception("Can't update email address.");
-        }
+        // Throws exception on failure.
+        $user->updateWithKeys($orig);
     }
 
 } catch (Exception $e) {