Page MenuHomePhabricator

Command-line tool for adding users
Closed, ResolvedPublic


Author: jpatokal

Patch for creating maintenance/createUser.php script

MediaWiki currently has no command-line tool for adding non-admin users, so I wrote one. This should prove quite handy for automated deployment, testing etc, in fact I was rather surprised this didn't exist already.

Usage: php createUser.php username password [groups ...] [--help]

		--help      show this message

Sample: "php maintenance/createUser.php SampleBot botsekret Bot" creates a user called 'SampleBot' with password 'botsekret' and adds him to group 'Bot'.

Note: This overlaps partly with the existing createAndPromote.php for creating admins, but this is more flexible and should probably replace that?

Version: 1.16.x
Severity: enhancement




Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:00 PM
bzimport set Reference to bz23495.

Thanks for the patch.

Though, for inclusion, it would be better if you were subclassing the Maintenance class (see CreateAndPremote.php as an example), and following the pattern of the current maintenance script

Also, some validation of the group names?


jpatokal wrote:

Newer version of the above patch, with group checking


overlordq wrote:

Why not just rename createAndPromote and change the promotion part to a parameter instead of creating yet another file that does the exact same thing

Perhaps just replace createandpromote with this, since it does the same and wouldn't need much changing (just tell the users that they need to give the admin group name) compared to changing how the promoting works in the existing file.

Made changes in r87480 to createAndPromote.php to allow it to create a non-sysop user.