MediaWiki / Database

From WhyNotWiki
Jump to: navigation, search

Contents

Official docs

http://www.mediawiki.org/wiki/Page_table

http://www.mediawiki.org/wiki/Revision_table

http://www.mediawiki.org/wiki/Text_table

Schema diagram

http://www.ipbwiki.com/Media_Wiki:MediaWiki_Database_Schema


How to delete an article completely

http://wheninnrome.multiply.com/journal/item/23. Retrieved on 2007-05-11 11:18.

When you delete an article you must delete it from the following tables in the ff order:

  • archive
  • recentchanges
  • text
  • revision
  • logging
  • page


http://www.open-fcoe.org/openfc/wiki/maintenance/postgres/tables.sql. Retrieved on 2007-05-11 11:18.

-- SQL to create the initial tables for the MediaWiki database. -- This is read and executed by the install script; you should -- not have to run it by itself unless doing a manual install. -- This is the PostgreSQL version. ...


The "oldid" used in a permalink URL is not the same oldid as is in the text table!

http://whynotwiki.com/index.php?title=How_I_installed_vim_7.0_on_CentOS_4&oldid=14606

What is the oldid referring to??

oldid appears to be a column in only one table: text

When I look it up as follows, it refers to an article called "Shell", not "How_I_installed_vim_7.0_on_CentOS_4"!

mysql> select p.page_title, p.page_id, r.rev_page, r.rev_text_id, t.old_id   from page p, revision r, text t  where p.page_id = r.rev_page    and r.rev_text_id = t.old_id    and  t.old_id = 14606;
+------------+---------+----------+-------------+--------+
| page_title | page_id | rev_page | rev_text_id | old_id |
+------------+---------+----------+-------------+--------+
| Shell      |    4101 |     4101 |       14606 |  14606 | 
+------------+---------+----------+-------------+--------+

The correct old_id is actually 14366...

+-------------------------------------+---------+----------+-------------+--------+
| page_title                          | page_id | rev_page | rev_text_id | old_id |
+-------------------------------------+---------+----------+-------------+--------+
| How_I_installed_vim_7.0_on_CentOS_4 |    4057 |     4057 |       14366 |  14366 | 
+-------------------------------------+---------+----------+-------------+--------+


So where did this 14606 come from??


How to do a full-text search (or when MediaWiki's built-in search fails you)

Sometimes I search my MediaWiki wiki for a keyword or phrase or bit of source code that I know is in there, but it gives me no results.

Perhaps I was searching for a keyword that isn't indexed (perhaps because it contains special punctuation?)...

Anyway, in cases like that, I have to break down and do the search directly from MySQL...

mysql> select p.page_title, p.page_id, r.rev_page, r.rev_text_id, t.old_id   from page p, revision r, text t  where p.page_id = r.rev_page    and r.rev_text_id = t.old_id    and  t.old_text like '%-m32%';
+-------------------------------------+---------+----------+-------------+--------+
| page_title                          | page_id | rev_page | rev_text_id | old_id |
+-------------------------------------+---------+----------+-------------+--------+
| How_I_installed_vim_7.0_on_CentOS_4 |    4057 |     4057 |       14366 |  14366 | 
+-------------------------------------+---------+----------+-------------+--------+
Ads
Personal tools