Difference between revisions of "MediaWiki/tables"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(should work)
 
(some keys)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
==page_props==
 
==page_props==
Stores "page properties". I'm not quite sure how this is ''supposed'' to be used, as it always seems to be empty until I start mucking around with it.
+
Stores "page properties". I'm not quite sure how this is ''supposed'' to be used, but I've noticed some keys that are often present:
 +
* <code>notoc</code> presumably flags that the <nowiki>__NOTOC__</nowiki> indicator is present in the page's content
 +
* <code>noeditsection</code> presumably flags that the <nowiki>__NOEDITSECTION</nowiki> indicator is present in the page's content
 +
* <code>smw-semanticdata-status</code> presumably flags that there are [[Semantic MediaWiki]] tags in the page's content
  
 
Names and values are kept in binary blobs, though (even though they are strings), so you have to do a modified query to see what's going on:
 
Names and values are kept in binary blobs, though (even though they are strings), so you have to do a modified query to see what's going on:
 
<syntaxhighlight lang=mysql>SELECT pp_page, CAST(pp_propname AS CHAR) AS Name, CAST(pp_value AS CHAR) AS Value, pp_sortkey FROM page_props;</syntaxhighlight>
 
<syntaxhighlight lang=mysql>SELECT pp_page, CAST(pp_propname AS CHAR) AS Name, CAST(pp_value AS CHAR) AS Value, pp_sortkey FROM page_props;</syntaxhighlight>
 +
A slightly more complex query to show the names of the pages (instead of just IDs):
 +
<syntaxhighlight lang=mysql>SELECT
 +
    pp_page,
 +
    page_namespace,
 +
    page_title,
 +
    CAST(pp_propname AS CHAR) AS Name,
 +
    CAST(pp_value AS CHAR) AS Value,
 +
    pp_sortkey
 +
FROM
 +
    page_props
 +
        LEFT JOIN
 +
    page ON pp_page = page_id
 +
</syntaxhighlight>

Latest revision as of 15:49, 22 February 2018

page_props

Stores "page properties". I'm not quite sure how this is supposed to be used, but I've noticed some keys that are often present:

  • notoc presumably flags that the __NOTOC__ indicator is present in the page's content
  • noeditsection presumably flags that the __NOEDITSECTION indicator is present in the page's content
  • smw-semanticdata-status presumably flags that there are Semantic MediaWiki tags in the page's content

Names and values are kept in binary blobs, though (even though they are strings), so you have to do a modified query to see what's going on:

SELECT pp_page, CAST(pp_propname AS CHAR) AS Name, CAST(pp_value AS CHAR) AS Value, pp_sortkey FROM page_props;

A slightly more complex query to show the names of the pages (instead of just IDs):

SELECT 
    pp_page,
    page_namespace,
    page_title,
    CAST(pp_propname AS CHAR) AS Name,
    CAST(pp_value AS CHAR) AS Value,
    pp_sortkey
FROM
    page_props
        LEFT JOIN
    page ON pp_page = page_id