手册:category表

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:Category table and the translation is 29% complete.
Other languages:
English • ‎français • ‎polski • ‎čeština • ‎中文 • ‎日本語
手冊:索引 MediaWiki数据库布局 category table


MediaWiki版本: 1.13

category工作表追踪所有现有分类。这些分类符合以下情况:

  1. 它在categorylinks內有一條紀錄,或
  2. 它曾經有(任务T28411)。

Categories might not have corresponding pages, so they need to be tracked separately. cat_pages, cat_subcats, and cat_files are signed to make underflow more obvious.

The pages and sub-categories are stored in the categorylinks table.
Information regarding which categories are hidden is stored in the page_props table.
The number fields are signed to make underflow more obvious. We make the first number include the second two for better sorting: subtracting for display is easy, adding for ordering is not.
If the information in this table is incorrect, run the maintenance scripts populateCategory.php and/or cleanupEmptyCategories.php , if necessary with the --force option.

字段

cat_id

Primary key

cat_title

Name of the category, in the same form as page.page_title (with underscores). If there is a category page corresponding to this category, by definition, it has this name (in the Category namespace).

cat_pages

Number of pages in the category. This number includes the number of subcategories and the number of files.

cat_subcats

Number of sub-categories in the category.

cat_files

Number of files (i.e. Image: namespace members) in the category.

cat_hidden

MediaWiki版本: 1.19

Was reserved for future use; apparently no one found a use for it because it was removed in v1.20. Instead, the status of hidden categories is stored in the page props table as the property "hiddencat" in pp_propname.

Schema summary

MediaWiki版本: 1.20

DESCRIBE category;

+-------------+------------------+------+-----+---------+----------------+
| Field       | Type             | Null | Key | Default | Extra          |
+-------------+------------------+------+-----+---------+----------------+
| cat_id      | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| cat_title   | varbinary(255)   | NO   | UNI | NULL    |                |
| cat_pages   | int(11)          | NO   | MUL | 0       |                |
| cat_subcats | int(11)          | NO   |     | 0       |                |
| cat_files   | int(11)          | NO   |     | 0       |                |
+-------------+------------------+------+-----+---------+----------------+
MediaWiki版本: 1.13 – 1.19

DESCRIBE category;

+-------------+---------------------+------+-----+---------+----------------+
| Field       | Type                | Null | Key | Default | Extra          |
+-------------+---------------------+------+-----+---------+----------------+
| cat_id      | int(10) unsigned    | NO   | PRI | NULL    | auto_increment |
| cat_title   | varbinary(255)      | NO   | UNI | NULL    |                |
| cat_pages   | int(11)             | NO   | MUL | 0       |                |
| cat_subcats | int(11)             | NO   |     | 0       |                |
| cat_files   | int(11)             | NO   |     | 0       |                |
| cat_hidden  | tinyint(3) unsigned | NO   |     | 0       |                |
+-------------+---------------------+------+-----+---------+----------------+