On 08/12/05, HumanCell .org <humancell(a)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]