Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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).

share|improve this question
    
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 9 '10 at 10:16
add comment

1 Answer

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.

share|improve this answer
2  
“Beware of bugs in the above code; I have only proved it correct, not tried it.” - Donald Knuth –  Matt Simmons Jan 8 '10 at 15:56
    
Matt, thank you for that quote. It fits perfectly! :) –  Dave Drager Jan 8 '10 at 16:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.