diff options
| author | 2017-08-05 18:27:47 +0200 | |
|---|---|---|
| committer | 2017-08-05 18:27:47 +0200 | |
| commit | 673b6e48b0af5f2f6f92c501f82fe10281dbf20f (patch) | |
| tree | f8d0a3f0ae270cb496d25bb7237b5ad57b2cd321 /cli/create-user.php | |
| parent | 03a99c2408ce5439c3a1402cf308eec557bfdaaf (diff) | |
Mutualise create-user and update-user
Diffstat (limited to 'cli/create-user.php')
| -rwxr-xr-x | cli/create-user.php | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/cli/create-user.php b/cli/create-user.php index f710e8d66..add9c1b13 100755 --- a/cli/create-user.php +++ b/cli/create-user.php @@ -1,21 +1,8 @@ #!/usr/bin/php <?php -require('_cli.php'); - -$options = getopt('', array( - 'user:', - 'password:', - 'api-password:', - 'language:', - 'email:', - 'token:', - 'no-default-feeds', - )); - -if (empty($options['user'])) { - fail('Usage: ' . basename(__FILE__) . " --user username ( --password 'password' --api-password 'api_password'" . - " --language en --email user@example.net --token 'longRandomString' --no-default-feeds )"); -} +$isUpdate = false; +require('_update-or-create-user.php'); + $username = $options['user']; if (!FreshRSS_user_Controller::checkUsername($username)) { fail('FreshRSS error: invalid username “' . $username . '”! Must be matching ' . FreshRSS_user_Controller::USERNAME_PATTERN); @@ -30,12 +17,8 @@ echo 'FreshRSS creating user “', $username, "”…\n"; $ok = FreshRSS_user_Controller::createUser($username, empty($options['password']) ? '' : $options['password'], - empty($options['api-password']) ? '' : $options['api-password'], - array( - 'language' => empty($options['language']) ? '' : $options['language'], - 'mail_login' => empty($options['email']) ? '' : $options['email'], - 'token' => empty($options['token']) ? '' : $options['token'], - ), + empty($options['api_password']) ? '' : $options['api_password'], + $values, !isset($options['no-default-feeds'])); if (!$ok) { |
