[Mediawiki-l] autopopulate mediawiki

Christensen, Courtney ChristensenC at BATTELLE.ORG
Tue Feb 24 13:44:54 UTC 2009


Hi Gaurav,

MediaWiki uses MySQL to store all its data, so yes, it can display from a MySQL database.  You can have a custom table inside (or outside) your MediaWiki installed database and write extensions to show data from that table.  

What we did was actually to import XML data from a reference manager as wiki pages so that there was one wiki page per reference.  

If you write a MediaWiki extension (I'd suggest the Special Page format) to take your source data and format it however you want you can easily import data into MediaWiki from any source I can think of at the moment.

For example, you might have a special page that you just went to, or hit a button, or had a text box to give information about the source.  The special page would load the source and as long as it had MediaWiki page names it could create articles for you.

$comment = "Auto-Imported";
$articleTitle = Title::newFromText($this->getSourceTitle());
If ( !$articleTitle->exists() ) {
	$articleText = $this->getSourceText();
	$article = new Article($articleTitle);
	$article->doEdit( $articleText, $comment, EDIT_NEW);
}

Slap most of that in a loop, make sure I got my syntax right and you have yourself an importer.

Will that work for you?

Good luck!
-Courtney

PS I CC'd the list because this is a common question and it might be nice for you to get more feedback.
  


-----Original Message-----
From: Gaurav Singal [mailto:gsingal at gmail.com] 
Sent: Tuesday, February 24, 2009 12:06 AM
To: Christensen, Courtney
Subject: autopopulate mediawiki

Hi Courtney,

I found your posts on http://www.gossamer-threads.com/lists/wiki/mediawiki/157577?page=last.

I am creating a mediawiki that I would like to autopopulate from a database. I noticed that you were able to do this -- how did you go about it? Alternatively, do you know if mediawiki can display information from a MySQL database?

Thank you for your help,
Gaurav




More information about the MediaWiki-l mailing list