(SQL) Recuperar el text d'una pàgina a partir del títol de la pàgina

De Wikijoan
Dreceres ràpides: navegació, cerca

The page table can be considered the "core of the wiki". Each page in a MediaWiki installation has an entry here which identifies it by title and contains some essential metadata. It was first introduced in r6710, in MediaWiki 1.5.

mysql> select page_title,page_latest from page where page_title like '%ASIX-M10-UF2._MySQL_II%';
page_latest = 252396

The text of the page itself is stored in the text table. To retrieve the text of an article, MediaWiki first searches for page_title in the page table. Then, page_latest is used to search the revision table for rev_id, and rev_text_id is obtained in the process. The value obtained for rev_text_id is used to search for old_id in the text table to retrieve the text. When a page is deleted, the revisions are moved to the archive table.

select * from revision where rev_id=252396;

rev_text_id = 252358
select old_text from text where old_id=252358;
mysql -u root -p wikidb -e 'select old_text from text where old_id=252358' > entrada.txt

creat per Joan Quintana Compte, novembre 2016

Eines de l'usuari
Espais de noms
IES Jaume Balmes
Màquines recreatives
Informàtica musical
joanillo.org Planet