diff --git a/scripts/registeruser.php b/scripts/registeruser.php new file mode 100644 index 0000000000..9857f5aeea --- /dev/null +++ b/scripts/registeruser.php @@ -0,0 +1,81 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'n:w:f:e:'; +$longoptions = array('nickname=', 'password=', 'fullname=', 'email='); + +$helptext = << $nickname, + 'password' => $password, + 'fullname' => $fullname)); + + if (empty($user)) { + throw new Exception("Can't register user '$nickname' with password '$password' and fullname '$fullname'."); + } + + if (!empty($email)) { + + $orig = clone($user); + + $user->email = $email; + + if (!$user->updateKeys($orig)) { + print "Failed!\n"; + throw new Exception("Can't update email address."); + } + } + +} catch (Exception $e) { + print $e->getMessage() . "\n"; + exit(1); +}