Question

I need a way to insert new articles straight into my MediaWiki database without damaging the wiki installation.

I'm guessing if I knew what tables/attributes MediaWiki inserts to when creating a new article then I could fill them in myself.

Does anyone know a better way or have any suggestions?

Was it helpful?

Solution

Out of many bots and APIs available for MediaWiki, a simple place to begin is the MediaWiki Bulk Page creator.

It is a simple PHP script, relying on the Snoopy class library, that can create several pages from a simple text format.

Before getting started, make sure you read Creating a Bot first. it contains critical details on how to set up bot access to your wiki.

OTHER TIPS

I am the author of the Bulk Page Creator, nice to see it is still being used!!!

My latest MediaWiki Import tool creates pages from a CSV data file and page template. It generates Mediawiki XML Import files as suggested by Adrian.

Check it out

Mediawiki CSV Import

Definitely you don't want to write to the database directly. You may want to create an extension that takes selected items from RSS as input and creates one wiki article per item, using Article::doEdit().

You should do this with a bot. Bots can be run standalone, but if you're integrating with other code, you might want to pick based on the language. For PHP, there is the MediaWiki Bulk Page Creator. For Python, pymediawiki comes with Pagefromfile.

There is also an extension by Yaron Koren called External Data which solves a related task. It lets you incorporate data from external sources into your wiki pages. You can pull specific elements from CSV, XML or JSON -- retrieved from URLs, local files, or database.

Why do you need to do this?

  • If you are trying to migrate data from a previous wiki installation, there exist import and export tools already.
  • If you want to automate the addition of a large set of pre-formatted pages automatedly, the MediaWiki API provides a safer route than mucking with the database directly.

Export pages with Special:Export

Import pages using Special:Import. Note that you have to have the 'import' user right to be able to import.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top