Manual:archive table

From MediaWiki.org
Jump to: navigation, search

Other languages:
English • ‎日本語
Manual:ContentsManual:Contents MediaWiki database layoutManual:Database layout archive table


The archive table is the place where MediaWiki stores information on deleted pages. The pages may be restored, or undeleted, by a MediaWiki Administrator using the Special:Undelete special page. Beginning in MediaWiki 1.5, the content of the pages remains in the textManual:text table table; the deletion time is logged in the loggingManual:logging table table.

When a page is deleted, all its old revisions move from the revisionManual:revision table table to the archive table. When a page is then restored, its revisions are removed from the archive table, and recreated in the revision table.

The archive table is broadly related to the oldManual:old table table and revisionManual:revision table table in layout; since Gerrit change 51675 it has a primary key: ar_id.

Previous to MediaWiki 1.5, content from the text table was moved here, so individual revisions had non-empty ar_text contents. That text could have been compressed, and in those cases, it was marked by gzip on the revision's ar_flags field. There is also not presently a record of when deletion occurred, making it hard to separate multiple delete cycles or distinguish old deletions from recent deletions of pages that haven't been edited in a long time. (Proposals to store this data in log_search or logging.log_params were rejected.)

MediaWiki version: 1.22
mysql> DESCRIBE archive;
+-------------------+---------------------+------+-----+----------------+----------------+
| Field             | Type                | Null | Key | Default        | Extra          |
+-------------------+---------------------+------+-----+----------------+----------------+
| ar_id             | int(10) unsigned    | NO   | PRI | NULL           | auto_increment |
| ar_namespace      | int(11)             | NO   | MUL | 0              |                |
| ar_title          | varbinary(255)      | NO   |     |                |                |
| ar_text           | mediumblob          | NO   |     | NULL           |                |
| ar_comment        | tinyblob            | NO   |     | NULL           |                |
| ar_user           | int(10) unsigned    | NO   |     | 0              |                |
| ar_user_text      | varbinary(255)      | NO   | MUL | NULL           |                |
| ar_timestamp      | binary(14)          | NO   |     |                |                |
| ar_minor_edit     | tinyint(4)          | NO   |     | 0              |                |
| ar_flags          | tinyblob            | NO   |     | NULL           |                |
| ar_rev_id         | int(10) unsigned    | YES  | MUL | NULL           |                |
| ar_text_id        | int(10) unsigned    | YES  |     | NULL           |                |
| ar_deleted        | tinyint(3) unsigned | NO   |     | 0              |                |
| ar_len            | int(10) unsigned    | YES  |     | NULL           |                |
| ar_page_id        | int(10) unsigned    | YES  |     | NULL           |                |
| ar_parent_id      | int(10) unsigned    | YES  |     | NULL           |                |
| ar_sha1           | varbinary(32)       | NO   |     |                |                |
| ar_content_model  | varbinary(32)       | YES  |     | NULL           |                |
| ar_content_format | varbinary(64)       | YES  |     | NULL           |                |
+-------------------+---------------------+------+-----+----------------+----------------+
19 rows in set (0.00 sec)

Fields[edit]

ar_id[edit]

MediaWiki version: 1.22
Gerrit change 51675

Primary key.

ar_namespace[edit]

Basic page information: contains the namespace of the deleted revision. These contain the value in page_namespaceManual:Page table#page_namespace.

ar_title[edit]

Basic page information: contains the page title of the deleted page, which is the same as page_titleManual:Page table#page_title.

ar_text[edit]

MediaWiki version: 1.4

Before MediaWiki 1.5, old archived pages saved their text here. Old archived pages have ar_text_id set to NULL; they do not point to an entry in the text table. Instead, this field is the place where the text resides. Restoring content from an old archived page restores the text from this field.

MediaWiki version: 1.5

Still used! In newly deleted pages (MediaWiki 1.5 and later), the revision text remains in the textManual:text table table. Such newly deleted pages will not store text in the archive table, but will rather reference the separately existing text rows. However, for text from pages, which have been archived in MediaWiki 1.4 and before, the ar_text field will still be used!

This field remains for backward compatibility.

Note Note: Text may be gzipped or otherwise funky.

ar_comment[edit]

Basic revision information: contains the edit summary of the deleted revision, analogous to rev_commentManual:Revision table.

ar_user[edit]

Basic revision information: contains the user ID of the user who made the deleted revision; it is the same as user_idManual:User table#user_id and rev_userManual:Revision table. The value for this field is 0 for anonymous edits, initializations scripts, and for some mass imports.

ar_user_text[edit]

Basic revision information: This field contains the text of the editor's username, or the IP address of the editor if the deleted revision was done by an unregistered user. Comparable to rev_user_textManual:Revision table#rev_user_text.

ar_timestamp[edit]

This field contains the time at which the revision was originally saved. It is the equivalent of rev_timestampManual:Revision table.

Note Note: This is not the timestamp of article deletion; that is saved in the deletion log entry, in the loggingManual:logging table table's log_timestampManual:logging table.

ar_minor_edit[edit]

Basic revision information: Records whether the user marked the deleted revision as a minor edit. If the value for this field is 1, then the edit is tagged as 'minor'; it is 0 otherwise. This is equivalent to rev_minor_editManual:Revision table.

ar_flags[edit]

This field is similar to old_flagsManual:Text table in the textManual:text table table. It was added in MediaWiki 1.5, but is most likely unused: For revisions archived with older versions, it is not used as it was not there at the time of their deletion; a conversion, which would have added flags for revisions, which already had been archived when the update to MediaWiki 1.5 or newer was being done, was not applied. Texts of revisions archived with MediaWiki 1.5 or later do not use this field; they themselves stay in the text table; together with their flags staying in old_flagsManual:Text table.

ar_rev_id[edit]

MediaWiki version: 1.5

When revisions are deleted, their unique rev_idManual:Revision table is stored here so it can be retained after undeletion. This is necessary to retain permalinks to given revisions after accidental delete cycles or messy operations like history merges.

Note Note: Old entries from 1.4 will be NULL here, and a new rev_id will be created on undeletion for those revisions.

ar_text_id[edit]

MediaWiki version: 1.5

For revisions deleted in MediaWiki 1.5 and later, this is a key to old_idManual:Text table within the textManual:text table table; that is, it is the key to the stored text in the storage backend. To avoid breaking the block-compression scheme and otherwise making storage changes harder, the actual text is *not* deleted from the text table; rather, the text is merely hidden by removal of the page and revision entries. Comparable to rev_text_idRevision_table#rev_text_id.

Note Note: Old entries deleted under MediaWiki 1.2-1.4 will have NULL values in this field, and their ar_text and ar_flags fields will be used to create a new text row upon undeletion.

ar_deleted[edit]

MediaWiki version: 1.10

This field is reserved for the RevDelete/Suppression (Oversight) system. Equivalent to rev_deletedManual:Revision table.

ar_len[edit]

MediaWiki version: 1.10

This field contains the length of the deleted revision, in bytes. Analogous to rev_lenManual:Revision table.

ar_page_id[edit]

MediaWiki version: 1.11

Reference to page_idManual:Page_table#page_id. Useful for sysadmin fixing of large pages merged together in the archives, or for cleanly restoring a page at its original ID number if possible. Comparable to rev_pageRevision_table#rev_page. Will be NULL for pages deleted prior to 1.11.

ar_parent_id[edit]

MediaWiki version: 1.13

The revision id of the previous revision to the page. Populated from rev_parent_idRevision_table#rev_parent_id. Will be null for revisions deleted prior to 1.13. First edits to newly created articles (and therefore the creation of the article) can be identified by the value of this field being 0.

ar_sha1[edit]

MediaWiki version: 1.19

The SHA-1 text content hash in base-36. Populated from rev_sha1Revision_table#rev_sha1.

ar_content_format[edit]

MediaWiki version: 1.21

Content format for the archived revision, which is NULL by default and only stored if it differs from the page's default.

ar_content_model[edit]

MediaWiki version: 1.21

Content model for the archived revision, which is NULL by default and only stored if it differs from the page's default, as determined by ContentHandler::getDefaultModelFor( $title ).

Previous versions[edit]

MediaWiki version: 1.21

DESCRIBE archive

+-------------------+---------------------+------+-----+----------------+-------+
| Field             | Type                | Null | Key | Default        | Extra |
+-------------------+---------------------+------+-----+----------------+-------+
| ar_namespace      | int(11)             | NO   | MUL | 0              |       |
| ar_title          | varbinary(255)      | NO   |     |                |       |
| ar_text           | mediumblob          | NO   |     | NULL           |       |
| ar_comment        | tinyblob            | NO   |     | NULL           |       |
| ar_user           | int(10) unsigned    | NO   |     | 0              |       |
| ar_user_text      | varbinary(255)      | NO   | MUL | NULL           |       |
| ar_timestamp      | binary(14)          | NO   |     |                |       |
| ar_minor_edit     | tinyint(4)          | NO   |     | 0              |       |
| ar_flags          | tinyblob            | NO   |     | NULL           |       |
| ar_rev_id         | int(10) unsigned    | YES  | MUL | NULL           |       |
| ar_text_id        | int(10) unsigned    | YES  |     | NULL           |       |
| ar_deleted        | tinyint(3) unsigned | NO   |     | 0              |       |
| ar_len            | int(10) unsigned    | YES  |     | NULL           |       |
| ar_page_id        | int(10) unsigned    | YES  |     | NULL           |       |
| ar_parent_id      | int(10) unsigned    | YES  |     | NULL           |       |
| ar_sha1           | varbinary(32)       | NO   |     |                |       |
| ar_content_format | varbinary(64)       | YES  |     | NULL           |       |
| ar_content_model  | varbinary(32)       | YES  |     | NULL           |       |
+-------------------+---------------------+------+-----+----------------+-------+


MediaWiki versions: 1.19 – 1.20

DESCRIBE archive

+---------------+---------------------+------+-----+----------------+-------+
| Field         | Type                | Null | Key | Default        | Extra |
+---------------+---------------------+------+-----+----------------+-------+
| ar_namespace  | int(11)             | NO   | MUL | 0              |       |
| ar_title      | varbinary(255)      | NO   |     |                |       |
| ar_text       | mediumblob          | NO   |     | NULL           |       |
| ar_comment    | tinyblob            | NO   |     | NULL           |       |
| ar_user       | int(10) unsigned    | NO   |     | 0              |       |
| ar_user_text  | varbinary(255)      | NO   | MUL | NULL           |       |
| ar_timestamp  | binary(14)          | NO   |     |                |       |
| ar_minor_edit | tinyint(4)          | NO   |     | 0              |       |
| ar_flags      | tinyblob            | NO   |     | NULL           |       |
| ar_rev_id     | int(10) unsigned    | YES  | MUL | NULL           |       |
| ar_text_id    | int(10) unsigned    | YES  |     | NULL           |       |
| ar_deleted    | tinyint(3) unsigned | NO   |     | 0              |       |
| ar_len        | int(10) unsigned    | YES  |     | NULL           |       |
| ar_page_id    | int(10) unsigned    | YES  |     | NULL           |       |
| ar_parent_id  | int(10) unsigned    | YES  |     | NULL           |       |
| ar_sha1       | varbinary(32)       | NO   |     |                |       |
+---------------+---------------------+------+-----+----------------+-------+


MediaWiki version: 1.14

DESCRIBE archive

+---------------+---------------------+------+-----+----------------+-------+
| Field         | Type                | Null | Key | Default        | Extra |
+---------------+---------------------+------+-----+----------------+-------+
| ar_namespace  | int(11)             | NO   | MUL | 0              |       |
| ar_title      | varbinary(255)      | NO   |     |                |       |
| ar_text       | mediumblob          | NO   |     | NULL           |       |
| ar_comment    | tinyblob            | NO   |     | NULL           |       |
| ar_user       | int(10) unsigned    | NO   |     | 0              |       |
| ar_user_text  | varbinary(255)      | NO   | MUL | NULL           |       |
| ar_timestamp  | binary(14)          | NO   |     |                |       |
| ar_minor_edit | tinyint(4)          | NO   |     | 0              |       |
| ar_flags      | tinyblob            | NO   |     | NULL           |       |
| ar_rev_id     | int(10) unsigned    | YES  |     | NULL           |       |
| ar_text_id    | int(10) unsigned    | YES  |     | NULL           |       |
| ar_deleted    | tinyint(3) unsigned | NO   |     | 0              |       |
| ar_len        | int(10) unsigned    | YES  |     | NULL           |       |
| ar_page_id    | int(10) unsigned    | YES  |     | NULL           |       |
| ar_parent_id  | int(10) unsigned    | YES  |     | NULL           |       |
+---------------+---------------------+------+-----+----------------+-------+


MediaWiki version: 1.12


+---------------+---------------------+------+-----+---------+-------+
| Field         | Type                | Null | Key | Default | Extra |
+---------------+---------------------+------+-----+---------+-------+
| ar_namespace  | int(11)             | NO   | MUL | 0       |       |
| ar_title      | varchar(255)        | NO   |     | NULL    |       |
| ar_text       | mediumblob          | NO   |     | NULL    |       |
| ar_comment    | tinyblob            | NO   |     | NULL    |       |
| ar_user       | int(5) unsigned     | NO   |     | 0       |       |
| ar_user_text  | varchar(255)        | NO   | MUL | NULL    |       |
| ar_timestamp  | char(14)            | NO   |     | NULL    |       |
| ar_minor_edit | tinyint(1)          | NO   |     | 0       |       |
| ar_flags      | tinyblob            | NO   |     | NULL    |       |
| ar_rev_id     | int(8) unsigned     | YES  |     | NULL    |       |
| ar_text_id    | int(8) unsigned     | YES  |     | NULL    |       |
| ar_deleted    | tinyint(1) unsigned | NO   |     | 0       |       |
| ar_len        | int(8) unsigned     | YES  |     | NULL    |       |
| ar_page_id    | int(10) unsigned    | YES  |     | NULL    |       |
+---------------+---------------------+------+-----+---------+-------+


MediaWiki version: 1.11


+---------------+---------------------+------+-----+---------+-------+
| Field         | Type                | Null | Key | Default | Extra |
+---------------+---------------------+------+-----+---------+-------+
| ar_namespace  | int(11)             | NO   | MUL | 0       |       |
| ar_title      | varchar(255)        | NO   |     | NULL    |       |
| ar_text       | mediumblob          | NO   |     | NULL    |       |
| ar_comment    | tinyblob            | NO   |     | NULL    |       |
| ar_user       | int(10) unsigned    | NO   |     | 0       |       |
| ar_user_text  | varchar(255)        | NO   | MUL | NULL    |       |
| ar_timestamp  | binary(14)          | NO   |     | NULL    |       |
| ar_minor_edit | tinyint(4)          | NO   |     | 0       |       |
| ar_flags      | tinyblob            | NO   |     | NULL    |       |
| ar_rev_id     | int(10) unsigned    | YES  |     | NULL    |       |
| ar_text_id    | int(10) unsigned    | YES  |     | NULL    |       |
| ar_deleted    | tinyint(3) unsigned | NO   |     | 0       |       |
| ar_len        | int(10) unsigned    | YES  |     | NULL    |       |
| ar_page_id    | int(10) unsigned    | YES  |     | NULL    |       |
+---------------+---------------------+------+-----+---------+-------+


MediaWiki version: 1.10


+---------------+---------------------+------+-----+---------+-------+
| Field         | Type                | Null | Key | Default | Extra |
+---------------+---------------------+------+-----+---------+-------+
| ar_namespace  | int(11)             | NO   | MUL | 0       |       |
| ar_title      | varchar(255)        | NO   |     | NULL    |       |
| ar_text       | mediumblob          | NO   |     | NULL    |       |
| ar_comment    | tinyblob            | NO   |     | NULL    |       |
| ar_user       | int(5) unsigned     | NO   |     | 0       |       |
| ar_user_text  | varchar(255)        | NO   |     | NULL    |       |
| ar_timestamp  | char(14)            | NO   |     | NULL    |       |
| ar_minor_edit | tinyint(1)          | NO   |     | 0       |       |
| ar_flags      | tinyblob            | NO   |     | NULL    |       |
| ar_rev_id     | int(8) unsigned     | YES  |     | NULL    |       |
| ar_text_id    | int(8) unsigned     | YES  |     | NULL    |       |
| ar_deleted    | tinyint(1) unsigned | NO   |     | 0       |       |
| ar_len        | int(8) unsigned     | YES  |     | NULL    |       |
+---------------+---------------------+------+-----+---------+-------+


MediaWiki version: 1.5
MediaWiki version: 1.6
MediaWiki version: 1.7
MediaWiki version: 1.8
MediaWiki version: 1.9


+---------------+-----------------+------+-----+---------+-------+
| Field         | Type            | Null | Key | Default | Extra |
+---------------+-----------------+------+-----+---------+-------+
| ar_namespace  | int(11)         | NO   | MUL | 0       |       |
| ar_title      | varchar(255)    | NO   |     | NULL    |       |
| ar_text       | mediumblob      | NO   |     | NULL    |       |
| ar_comment    | tinyblob        | NO   |     | NULL    |       |
| ar_user       | int(5) unsigned | NO   |     | 0       |       |
| ar_user_text  | varchar(255)    | NO   |     | NULL    |       |
| ar_timestamp  | char(14)        | NO   |     | NULL    |       |
| ar_minor_edit | tinyint(1)      | NO   |     | 0       |       |
| ar_flags      | tinyblob        | NO   |     | NULL    |       |
| ar_rev_id     | int(8) unsigned | YES  |     | NULL    |       |
| ar_text_id    | int(8) unsigned | YES  |     | NULL    |       |
+---------------+-----------------+------+-----+---------+-------+


MediaWiki version: 1.4


+---------------+---------------------+------+-----+---------+-------+
| Field         | Type                | Null | Key | Default | Extra |
+---------------+---------------------+------+-----+---------+-------+
| ar_namespace  | tinyint(2) unsigned |      |     | 0       |       |
| ar_title      | varchar(255) binary |      |     |         |       |
| ar_text       | mediumtext          |      |     |         |       |
| ar_comment    | tinyblob            |      |     |         |       |
| ar_user       | int(5) unsigned     |      |     | 0       |       |
| ar_user_text  | varchar(255) binary |      |     |         |       |
| ar_timestamp  | varchar(14) binary  |      |     |         |       |
| ar_minor_edit | tinyint(1)          |      |     | 0       |       |
| ar_flags      | tinyblob            |      |     |         |       |
+---------------+---------------------+------+-----+---------+-------+
DatabasesManual:Database layout Engines: MySQL/MariaDBManual:MySQLOracleManual:OraclePostgreSQLManual:PostgreSQLSQLiteManual:SQLite
Technical documentation: SchemaManual:Database layout (tablesCategory:MediaWiki database tables) – API property associationsAPI:Database field and API property associationsField prefixesDatabase field prefixesPrimary key storage in other fieldsManual:Primary key storage in other fieldsWikimedia extension tablesCategory:Wikimedia extension database tables
Configuration: SettingsManual:Configuration_settings#Database_settingsSharingManual:Shared database
Development: AccessManual:Database accessOptimizationDatabase optimizationPolicyDevelopment policy#Database_patchesUpdaterManual:DatabaseUpdater.phpExtension schema updatesManual:Hooks/LoadExtensionSchemaUpdatesPatch fileManual:SQL patch file
Core tables: archivecategorycategorylinkschange_tagconfigexternallinksfilearchivehitcounterimageimagelinksinterwikiiwlinksipblocksjobl10n_cachelanglinkslogginglog_searchmsg_resourcemsg_resource_linksmodule_depsobjectcacheoldimagepagepagelinkspage_propspage_restrictionsprotected_titlesquerycachequerycachetwoquerycache_inforecentchangesredirectrevisionsearchindexsitessite_identifiers - site_statstag_summarytemplatelinkstexttranscacheupdateloguploadstashuseruser_former_groupsuser_groupsuser_newtalkuser_propertiestag_summaryvalid_tagwatchlist