[Mediawiki-l] importing public databases into mediawiki

Rob Church robchur at gmail.com
Fri Dec 9 07:44:41 UTC 2005


If you happen to pick Python, you could grab the Python robot
framework from http://pywikipediabot.sourceforge.net, tweak it, and
then run touch.py -file:file, where the file contains a list of the
imported article names - this too could be generated by your script.

There's also a bot for Perl, but you may just want to take the lazier
option; run the maintenance script for rebuilding link tables.


Rob Church

On 09/12/05, Rowan Collins <rowan.collins at gmail.com> wrote:
> On 08/12/05, HumanCell .org <humancell at gmail.com> wrote:
> > I'd like to import a public database into my mediawiki, where each
> > *row* of the database corresponds to a new article.
> >
> > Here's a simple example to clarify:
> >
> > ID          Name    Height   Weight
> > Row1      fred       150        100
> > Row2      bill         210         55
>
> Well, since I just mentionned the XML import format in another posting
> (there's a schema and example in the 'docs/' directory of the source),
> here's a proposal using that:
>
> 1) write a script in your language of choice that queries the
> database, and formats each row into something along the lines of:
> <page><title>$name</title><revision><text>{{my
> infobox|height=$height|weight=$weight}}</text></revision></page>
> [this isn't actually valid, e.g. you need a timestamp and user etc in
> the revision; these could be constants in your program though]
>
> 2) create the page [[Template:My infobox]] (or whatever you actually
> want to call it) with appropriate stuff
>
> 3) go to Special:Import while logged in as a sysop, and import your
> new XML file. Ta-da! A whole lotta new articles!
>
> Alternatively, of course, you could write something that read from one
> database and wrote to the other, but this way has the advantage that
> most of the leg-work is done by existing MediaWiki code, and you don't
> have to work out how. Except, unfortunately, it won't update the
> tables used by "whatlinkshere" and co - see
> http://bugzilla.wikimedia.org/show_bug.cgi?id=2483 (they'll be updated
> as soon as you edit each page, probably even if you do a "null edit"
> that doesn't actually save any changes)
>
> --
> Rowan Collins BSc
> [IMSoP]
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>



More information about the MediaWiki-l mailing list