3

Is there a command line tool that would allow me to script creation of accounts on a MediaWiki instance?

The UI for creating an account is painful, and very time consuming when tasked with creating 10+ accounts at a time.

Unfortunately I can't get ImportUsers to work due to the very old version of MediaWiki we use (and upgrading is unfortunately not possible at this time).

Magnus
  • 141
  • 5
  • What version are you currently running so we can find a solution for you (This can be found out on the [[Special:Version]] page)?. – p858snake Jan 09 '10 at 10:16
  • Proof of concept for an MW cli: https://github.com/guaka/mewsh - still a long way from what's possible with `drush` or `wp-cli`. – the Oct 31 '14 at 23:45

1 Answers1

1

I think you found your answer (upgrade MediaWiki :)). That is the best solution and the ImportUsers script has already been written to support the functionality you requested.

However admittedly there are always reasons, both good and bad, for keeping a version back.

In this case, you should be able to use perl or bash and curl to create a script to pass the variables via command line, for MediaWiki or any other website.

First have it sign in and store the login cookie:

curl -c ./cookie.txt -F wpName1=username -F password=yourpass "http://yoursite.com/mediawiki/index.php?title=Special:UserLogin&action=submitlogin&type=login"

Then go to the sign in page and pass your signup variables:

curl -b ./cookie.txt -F wpName2=newusername -F wpPassword2=newpassword -F wpRetype=newpassword -F wpEmail=emailaddr "http://yoursite.com/mediawiki/index.php?title=Special:UserLogin&action=submitlogin&type=signuptitle=Special:UserLogin&type=signup"

Please note I do not use MediaWiki and have not tested this solution, but in theory this should work from the variables and post pages I have observed on other MediaWiki installs. It will login and save the cookie, then read the cookie to authenticate and post the data to create a new user. You could also output the resulting code to ensure that the 'post' actually created the new user. Roll those curl functions into a script to cycle through an delimited file and you have yourself a user import script.

I know this isn't a full solution but should get you on your way to creating something that will work for you in a pinch.

Dave Drager
  • 8,315
  • 28
  • 45