手册:text表

From mediawiki.org
This page is a translated version of the page Manual:Text table and the translation is 71% complete.
手册:索引 MediaWiki数据库布局 text表
MediaWiki版本:
1.5

text表存放每个页面版本的维基文本。 如果使用了Postgres或Oracle,这个表被命名为pagecontent扩展 也可以在此存储数据。

Field names are a holdover from the old revisions table in MediaWiki 1.4 and earlier.

If you updated your wiki from MediaWiki 1.4 or older to a newer version, and if you have then run update.php at least once, you will still have old columns in the text table, whose contents have been migrated to the page table and the revision table (content is copied, not cut). text表中的这些列不会再被使用。 所有在text表中除了 old_id, old_text 和 old_flags以外的字段都不再需要因此可以安全删除

文本内容可以压缩或在外部存储,因此难以从这个表中得到。 fetchText.php 维护脚本可以用来获取指定old_id的文本。

扩展也可以添加其它自定义标志。

This table can also hold metadata of files if the metadata is too big to store in img_metadata, oi_metadata or fa_metadata.

字段

old_id

标识每段文本的唯一整数。 在content 表中由content.content_address 引用。 Before Multi-Content Revisions implementation, revision.rev_text_id in revision table and ar_text_id in archive table were keys to this column.

Also img_metadata, oi_metadata or fa_metadata can refer to this column when being used to store file metadata.

old_text

The wikitext of the page, or a pointer to external storage of the form of DB://cluster/id.

old_flags

逗号分隔的标志列表。 包括如下可能的值:

gzip 文本已通过PHP的gzdeflate()函数压缩。
如果$wgCompressRevisions 选项已打开,新行(=当前版本)会在保存页面时自动使用gzip压缩。 旧版本也可以用compressOld.php 脚本压缩。
utf-8 文本以UTF-8存储。
If the $wgLegacyEncoding option is on, rows without this flag will be converted to UTF-8 transparently at load time.
object text字段包括一个已序列化的PHP对象。
这个对象可能包括压缩在一起的多个版本以获得更高压缩比,也可能引用了另一行,在那里可以找到文本。
external 文本存储在由old_text说明的一个外部位置
Any additional flags apply to the data stored at that URL, not the URL itself. The 'object' flag is not set for URLs of the form 'DB://cluster/id/itemid', because the external storage system itself decompresses these. 参见$wgDefaultExternalStore

架构摘要

MediaWiki版本:
1.10

DESCRIBE text;

+-----------+------------------+------+-----+---------+----------------+
| Field     | Type             | Null | Key | Default | Extra          |
+-----------+------------------+------+-----+---------+----------------+
| old_id    | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| old_text  | mediumblob       | NO   |     | NULL    |                |
| old_flags | tinyblob         | NO   |     | NULL    |                |
+-----------+------------------+------+-----+---------+----------------+
MediaWiki版本:
1.5 – 1.9

DESCRIBE text;

+-----------+-----------------+------+-----+---------+----------------+
| Field     | Type            | Null | Key | Default | Extra          |
+-----------+-----------------+------+-----+---------+----------------+
| old_id    | int(8) unsigned | NO   | PRI | NULL    | AUTO_INCREMENT |
| old_text  | mediumblob      | NO   |     | NULL    |                |
| old_flags | tinyblob        | NO   |     | NULL    |                |
+-----------+-----------------+------+-----+---------+----------------+

Indexes

MediaWiki版本:
1.5

SHOW INDEX IN text;

+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| text  |          0 | PRIMARY  |            1 | old_id      | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

参见