In the past few months, I've needed to test gadgets that are used on WMF
sites, but didn't have an easy way to copy them from, say, Commons to
Beta in Labs.
I hacked something together and then forgot about it until Chris McMahon
(the WMF's new QA guy) wanted something similar for one of his test
wikis a couple of weeks ago. I couldn't find it, so last night I
rewrote the script from scratch.
The script is pretty ugly and, normally, I might commit it to SVN and
work on it there, but we're in the process of moving to Git, so I've
gone ahead and created a gitorious repository:
Lots of hard-coding that could be cleaned up, and it could use the API
to copy from one wiki to another, but its a start. I'm sharing it here
so that other people can begin to use it.
It just blats the import-able file out on standard output for now, and
it only copies from Commons, so it should be used in the following way:
$ php dupe-gadgets.php > import-this-file.xml
[ Go to Special:Import on your wiki and import. ]
I hope that it helps someone!
Mark A. Hershberger