How to export text from all pages of a MediaWiki?

后端 未结 6 1496
醉酒成梦
醉酒成梦 2020-12-31 08:22

I have a MediaWiki running which represents a dictionary of German terms and their translation to a local dialect. Each page holds one term, its translation and a number of

6条回答
  •  攒了一身酷
    2020-12-31 08:55

    You can export the page content directly from the database. It will be the raw wiki markup, as when using Special:Export. But it will be easier to script the export, and you don't need to make sure all your pages are in some special category.

    Here is an example:

    SELECT page_title, page_touched, old_text
    FROM revision,page,text
    WHERE revision.rev_id=page.page_latest
    AND text.old_id=revision.rev_text_id;
    

    If your wiki uses Postgresql, the table "text" is named "pagecontent", and you may need to specify the schema. In that case, the same query would be:

    SET search_path TO mediawiki,public;
    
    SELECT page_title, page_touched, old_text 
    FROM revision,page,pagecontent
    WHERE revision.rev_id=page.page_latest
    AND pagecontent.old_id=revision.rev_text_id;
    

提交回复
热议问题