Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL query mediawiki pages, order by creation date

Tags:

mediawiki

I've been staring at the mediawiki database for my site. I want to create a linear list of pages ordered by the original creation date of the page.

I can't find a timestamp anywhere that indicates the first creation date of the page.

I can find revision timestamps with no problem, in the revision table...but no original creation timestamp. Furthermore, "page_touched" won't work since all these pages were xml imported recently, so they were all touched.

Any ideas?

like image 811
C C Avatar asked Mar 14 '26 21:03

C C


1 Answers

Based on the layout of the revision table. I did not test it, nor have seriously considered possible corner cases.

SELECT rev_page, rev_timestamp
FROM revision
WHERE rev_parent_id = 0
ORDER BY rev_timestamp

The first revision of a page has rev_parent_id = 0, so we take its timestamp as the creation timestamp.

like image 110
duplode Avatar answered Mar 17 '26 10:03

duplode



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!