Jump to content

Manual:page_restrictions table

From mediawiki.org
Manual:Contents MediaWiki database layout page_restrictions table
MediaWiki version:
1.10

The page_restrictions table is used to store page protection levels in MediaWiki 1.10 and later. The most notable feature is the introduction of cascading page protections for high-visibility pages. This table is for restrictions on existing pages only. Protections of non-existent pages are stored in the protected_titles table.

This table was introduced in MediaWiki 1.10 (r19095r19703), and overrides the page_restrictions field in the page table.

The list of protected pages can be found at Special:ProtectedPages.

Fields

[edit]

pr_id

[edit]

This is the primary key for the table, and is used to identify a particular row in the table.

pr_page

[edit]

This field contains a reference to page_id , which works as the foreign key for this table.

pr_type

[edit]

The type of protection (whether it applies to edits, page moves, or similar) is stored in this field.

pr_level

[edit]

This column describes the level of protection for the page; full protection for sysop-only pages, semi-protection for autoconfirmed users, or any other levels.

pr_cascade

[edit]

This field determines whether cascading protection (meaning that all transcluded pages and files on the page will be protected as well).

pr_user

[edit]
MediaWiki version:
1.37

This field was reserved to support a future per-user edit restriction system, but was never used as partial blocks were implemented as blocks.

pr_expiry

[edit]

This field contains the timestamp for pages whose protection has a set expiration date, and has a format similar to the expiry time in the Ipblocks table. Rows that contain a null value in this column are considered to be protected indefinitely.

Schema summary

[edit]
MediaWiki version:
1.38

DESCRIBE page_restrictions;

+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| pr_id      | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| pr_page    | int(10) unsigned | NO   | MUL | NULL    |                |
| pr_type    | varbinary(60)    | NO   | MUL | NULL    |                |
| pr_level   | varbinary(60)    | NO   | MUL | NULL    |                |
| pr_cascade | tinyint(4)       | NO   | MUL | NULL    |                |
| pr_expiry  | varbinary(14)    | YES  |     | NULL    |                |
+------------+------------------+------+-----+---------+----------------+
MediaWiki versions:
1.30 – 1.37

DESCRIBE page_restrictions;

+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| pr_id      | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| pr_page    | int(11)          | NO   | MUL | NULL    |                |
| pr_type    | varbinary(60)    | NO   | MUL | NULL    |                |
| pr_level   | varbinary(60)    | NO   | MUL | NULL    |                |
| pr_cascade | tinyint(4)       | NO   | MUL | NULL    |                |
| pr_user    | int(10) unsigned | YES  |     | NULL    |                |
| pr_expiry  | varbinary(14)    | YES  |     | NULL    |                |
+------------+------------------+------+-----+---------+----------------+
MediaWiki versions:
1.23 – 1.29

DESCRIBE page_restrictions;

+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| pr_id      | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| pr_page    | int(11)          | NO   | MUL | NULL    |                |
| pr_type    | varbinary(60)    | NO   | MUL | NULL    |                |
| pr_level   | varbinary(60)    | NO   | MUL | NULL    |                |
| pr_cascade | tinyint(4)       | NO   | MUL | NULL    |                |
| pr_user    | int(11)          | YES  |     | NULL    |                |
| pr_expiry  | varbinary(14)    | YES  |     | NULL    |                |
+------------+------------------+------+-----+---------+----------------+
MediaWiki versions:
1.15 – 1.22

DESCRIBE page_restrictions;

+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| pr_page    | int(8)           | NO   | MUL | NULL    |                |
| pr_type    | varbinary(60)    | NO   | MUL | NULL    |                |
| pr_level   | varbinary(60)    | NO   | MUL | NULL    |                |
| pr_cascade | tinyint(4)       | NO   | MUL | NULL    |                |
| pr_user    | int(8)           | YES  |     | NULL    |                |
| pr_expiry  | varbinary(14)    | YES  |     | NULL    |                |
| pr_id      | int(10) unsigned | NO   | PRI | NULL    | AUTO_INCREMENT |
+------------+------------------+------+-----+---------+----------------+
MediaWiki versions:
1.10 – 1.14

DESCRIBE page_restrictions;

+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| pr_page    | int(8)           | NO   | PRI | NULL    |                |
| pr_type    | varbinary(60)    | NO   | PRI | NULL    |                |
| pr_level   | varbinary(60)    | NO   | MUL | NULL    |                |
| pr_cascade | tinyint(4)       | NO   | MUL | NULL    |                |
| pr_user    | int(8)           | YES  |     | NULL    |                |
| pr_expiry  | varbinary(14)    | YES  |     | NULL    |                |
| pr_id      | int(10) unsigned | NO   | UNI | NULL    | AUTO_INCREMENT |
+------------+------------------+------+-----+---------+----------------+

Indexes

[edit]
MediaWiki version:
1.15

SHOW INDEX IN page_restrictions;

+-------------------+------------+--------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table             | Non_unique | Key_name     | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------------------+------------+--------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| page_restrictions |          0 | PRIMARY      |            1 | pr_id       | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| page_restrictions |          0 | pr_pagetype  |            1 | pr_page     | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| page_restrictions |          0 | pr_pagetype  |            2 | pr_type     | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| page_restrictions |          1 | pr_typelevel |            1 | pr_type     | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| page_restrictions |          1 | pr_typelevel |            2 | pr_level    | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| page_restrictions |          1 | pr_level     |            1 | pr_level    | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| page_restrictions |          1 | pr_cascade   |            1 | pr_cascade  | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
+-------------------+------------+--------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+