[Mediawiki-l] Creating pages progmatically

Rowan Collins rowan.collins at gmail.com
Sun Feb 6 18:54:01 UTC 2005


On Sun, 06 Feb 2005 03:59:32 -0600, =James Birkholz=
<j.birchwood at verizon.net> wrote:
> I will soon need to create thousands of pages with a standard bit of text
> on each. Is there any reason that I can't just use php and add records to
> the "cur" table, putting values in the "cur_title" and "cur_text" fields?
> Do I need to set values in any of the other fields of the "cur" table, or
> any other tables?

Well, I'm no expert on the database structure, but I'd imagine you'll
have to put *something* valid (in the sense of vaguely similar to what
MediaWiki would have put there) in *every* field of the cur table,
else MediaWiki'll get mighty confused when it tries to do something
like display the page history . Importantly, get cur_namespace right -
don't be fooled into thinking there are articles called things like
"User:Foo", when they're actually called "Foo" with cur_namespace=2
(you may know this already, but I think it's a reasonably common
"gotcha", so worth pointing out). Also, I'd create a "fake" user to
assign the edits to, and call it "Content seeding script" or something
appropriate to show up in the page histories.

As for other tables, there are various scripts in the 'maintenance'
directory for rebuilding various things, such as recentchanges, the
links table, etc. It might be worth running at least some of those to
make things consistent after your mass changes.

-- 
Rowan Collins BSc
[IMSoP]



More information about the MediaWiki-l mailing list