Manual:text table
↑ Manual:Contents | <translate> MediaWiki database layout</translate> | <translate> <tvar name=1>text</tvar> table</translate> |
MediaWiki version: | <translate> ≥</translate> 1.5 |
The text table holds the wikitext of individual page revisions. If using Postgres or Oracle, this table is named pagecontent. Extensions may also store data here.
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). These columns in the text table will not be used anymore. All fields in the text table except old_id, old_text and old_flags are not needed anymore and can be safely deleted.
Text content can be compressed or stored externally, and thus difficult to get from this table.
The fetchText.php maintenance script can be used to retrieve the text of a given old_id
.
Extensions can add other custom flags.
This table can also hold metadata of files if the metadata is too big to store in img_metadata, oi_metadata or fa_metadata.
Fields
old_id
Unique integer used to identify each text. It's referenced by the content.content_address in content table. 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
Comma-separated list of flags. Contains the following possible values:
gzip
Text is compressed with PHP's gzdeflate()
function.
If the$wgCompressRevisions
option is on, new rows (=current revisions) will be gzipped transparently at save time. Previous revisions can also be compressed by using the script compressOld.phputf-8
Text was stored as UTF-8.
If the$wgLegacyEncoding
option is on, rows without this flag will be converted to UTF-8 transparently at load time.object
Text field contained a serialized PHP object. The object either contains multiple versions compressed together to achieve a better compression ratio, or it refers to another row where the text can be found.external
Text was stored in an external location specified by 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. See also$wgDefaultExternalStore
.
Schema summary
MediaWiki version: | <translate> ≥</translate> 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 | | +-----------+------------------+------+-----+---------+----------------+<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.9</tvar> is unsupported version</translate>">
<translate> MediaWiki versions:</translate> |
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 version: | <translate> ≥</translate> 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 | | | +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+