Manual:Revision table/fr

La table revision contient les métadonnées de chaque modification apportée aux pages du wiki. Chacune des modifications de page crée une ligne de version, qui contient des informations telles que l'utilisateur ayant modifié, l'heure à laquelle la modification a été faite, et une référence vers le nouveau texte wiki de la table.

Notez qu'une ligne concerne partiellement l'opération de modification et le résultat de cette opération, c'est à dire le nouveau texte wiki. Elle ne donne pas de référence directe à l'ancien texte wiki.

Importer la dernière version d'une page d'un autre wiki génère deux entrées dans la table revision, l'une avec la date et le texte wiki de la version importée, et l'autre avec la date de l'import. Le texte wiki de cette dernière (qui devient celui de la page actuelle) est - lorsqu'une page avec le même nom existe déjà - celui de la page la plus récente des deux.

La table revision est très similaire à la table. La table revision est utilisée pour les pages du listing de l'historique et celui des. La table est utilisée pour les, les , les , et, dans le cas de création de page, pour la.

Différences :


 * la table recentchanges enregistre aussi les événements du journal tels que les déplacements de pages et les suppressions.
 * les éléments de la table recentchanges sont purgés périodiquement; ceux de la table revision restent en permanence, sauf si la page est supprimée ou que le propriétaire du site exécute le script de maintenance.
 * comme dit précédemment, l'import de la révision d'une page n'ajoute pas simplement une entrée à la table revision avec la date de l'import, mais aussi une autre avec la date d'origine.

Les versions supprimées sont déplacées vers la table.

La table des versions et la table de texte ont été introduites dans pour remplacer la table.

rev_id
Ce champ comporte la clé primaire de chaque révision. est une clé étrangère pour ce champ. Les rev_id nombre sont protégés contre la supression/restauration depuis les débuts de la table dans MediaWiki 1.5, lorsque rev_id et text_id ont remplacé l'ancien cur_id.

rev_page
Ce champ comporte une référence vers la à laquelle cette révision appartient. Le numéro dans ce champ est égal au champ de la page nommée. Ceci ne doit jamais être non valide; si c'est le cas, cette révision n'apparaîtra pas dans la page de l'historique. Si pointe sur une revision avec un rev_page non valide, cela provoquera l'erreur "La révision numéro 0 de la page nommée 'Foo' n'existe pas".

rev_text_id
Ceci est une clé étrangère pour dans la table. (la table de texte est l'endroit où est stocké l'ensemble du texte actuel). Il est possible que des révisions aient le même texte. C'est le cas des révisions pour lesquelles seulement les métadonnées ont été modifiées, ou celles pour lesquelles un a été effectué sur une précédente version.

S'il existe des rangées dans la table avec  = rev_id, ce champ doit être ignoré (et peut être à 0) en faveur des données correspondantes des positions et des tables de contenu.

rev_comment
This field holds an editor's edit summary (editor's comment on revision). This text is shown in the history and contributions. (The table contains a copy used for, ,  , and, in the case of page creation, for the .) It is rendered in a sanitized subset of wiki markup.

of the revision_comment_temp table and the table should be used instead!

rev_comment_id
This field holds a reference to the row containing the editor's comment.

rev_user
This is equal to the of the user who made this edit. The value for this field is 0 for anonymous edits, initializations scripts, and for some mass imports.

Note, there are bugs: T112384.

rev_user_text
This field holds the text of the editor's, or the IP address of the editor if the revision was done by an unregistered user.

In anonymous revisions imported from UseModWiki or early incarnations of the Phase II software, this field may contain an IP address with the final octet obscured (i.e.  such as 24.150.61.xxx; see bug 3631). Some edits imported from UseModWiki may contain a Reverse DNS lookup hostname like  or.

rev_timestamp
Holds the of the edit.

rev_minor_edit
Records whether the user marked the 'minor edit' checkbox. If the value for this field is 1, then the edit was declared as 'minor'; it is 0 otherwise. Many automated edits are marked as minor.

rev_deleted
This field is reserved for system. It's a bitfield in which the values are DELETED_TEXT = 1; DELETED_COMMENT = 2; DELETED_USER = 4; and DELETED_RESTRICTED = 8. So, for example, if nothing has been deleted from that revision, then the value is 0; if both the comment and user have been deleted, then the value is 6.

rev_len
This field contains the length of the article after the revision, in bytes. Used in history pages. Corresponds to.

rev_parent_id
The rev_id of the previous revision to the page. Corresponds to.

For edits which are new page creations, rev_parent_id = 0.

Utilisation
This field is used to add support for a tree structure. This field is e.g. used to calculate the size difference of a certain revision with the previous revision in the page history view. If a parent ID points to a revision that's associated with a different page, MediaWiki will still use that parent revision as a basis of comparison for purposes of calculating size difference. If a revision is deleted from the database, and another revision's parent ID still points to it, then MediaWiki will behave the same as if there were no parent revision; i.e. it will assume the previous size was 0.

Versions transférées
When revisions are imported from another wiki, the imported revisions' parent ID tree structure from the source wiki is retained (this is implemented by each revision's, other than the tail revision, having a XML element that is used to populate rev_parent_id), and the destination wiki's revisions' parent IDs are not updated. Likewise, when page histories are merged, the parent IDs of the revisions from the source and destination pages are not updated. can be used to populate rev_parent_id based on revision timestamps and revision IDs. In the case of an edit conflict, the revision ID of the edit that is saved first (causing the conflict) will be used as the parent ID of the edit that is saved second (after resolving the conflict).

rev_sha1
This field is used to add the SHA-1 text content hash in base-36 (generated by .)

rev_content_model
Content model, see CONTENT_MODEL_XXX constants in. These IDs will be exposed in the API and XML dumps. Extensions that define their own content model IDs should take care to avoid conflicts. Using the extension name as a prefix is recommended, for example 'myextension-somecontent'. Possible values are, e.g.: 'wikitext', 'javascript', 'css', 'text', and 'json'

If rows in the slots table with slot_revision_id = rev_id this field should be ignored (and may be NULL) in favor of the corresponding data from the slots and content tables.

rev_content_format
Content format, see CONTENT_FORMAT_XXX constants in. These should be MIME types, and will be exposed in the API and XML dumps. Extensions are free to use the below formats, or define their own. It is recommended to stick with the conventions for MIME types. Possible values are, e.g.: 'text/x-wiki', 'text/javascript', 'text/css', 'text/plain', 'text/html', 'application/vnd.php.serialized', 'application/json', 'application/xml'

If rows in the slots table with slot_revision_id = rev_id exist, this field should be ignored (and may be NULL).

Résumé du schéma
DESCRIBE revision; ++-+--+-+++ ++-+--+-+++ ++-+--+-+++
 * Field             | Type                | Null | Key | Default        | Extra          |
 * rev_id            | int(10) unsigned    | NO   | PRI | NULL           | auto_increment |
 * rev_page          | int(10) unsigned    | NO   | MUL | NULL           |                |
 * rev_text_id       | int(10) unsigned    | NO   |     | 0              |                |
 * rev_comment       | varbinary(767)      | NO   |     |                |                |
 * rev_user          | int(10) unsigned    | NO   | MUL | 0              |                |
 * rev_user_text     | varbinary(255)      | NO   | MUL |                |                |
 * rev_timestamp     | binary(14)          | NO   | MUL |                |                |
 * rev_minor_edit    | tinyint(3) unsigned | NO   |     | 0              |                |
 * rev_deleted       | tinyint(3) unsigned | NO   |     | 0              |                |
 * rev_len           | int(10) unsigned    | YES  |     | NULL           |                |
 * rev_parent_id     | int(10) unsigned    | YES  |     | NULL           |                |
 * rev_sha1          | varbinary(32)       | NO   |     |                |                |
 * rev_content_model | varbinary(32)       | YES  |     | NULL           |                |
 * rev_content_format | varbinary(64)      | YES  |     | NULL           |                |

DESCRIBE revision; ++-+--+-+++ ++-+--+-+++ ++-+--+-+++
 * Field             | Type                | Null | Key | Default        | Extra          |
 * rev_id            | int(10) unsigned    | NO   | PRI | NULL           | auto_increment |
 * rev_page          | int(10) unsigned    | NO   | MUL | NULL           |                |
 * rev_text_id       | int(10) unsigned    | NO   |     | NULL           |                |
 * rev_comment       | varbinary(767)      | NO   |     |                |                |
 * rev_user          | int(10) unsigned    | NO   | MUL | 0              |                |
 * rev_user_text     | varbinary(255)      | NO   | MUL |                |                |
 * rev_timestamp     | binary(14)          | NO   | MUL |                |                |
 * rev_minor_edit    | tinyint(3) unsigned | NO   |     | 0              |                |
 * rev_deleted       | tinyint(3) unsigned | NO   |     | 0              |                |
 * rev_len           | int(10) unsigned    | YES  |     | NULL           |                |
 * rev_parent_id     | int(10) unsigned    | YES  |     | NULL           |                |
 * rev_sha1          | varbinary(32)       | NO   |     |                |                |
 * rev_content_model | varbinary(32)       | YES  |     | NULL           |                |
 * rev_content_format | varbinary(64)      | YES  |     | NULL           |                |

DESCRIBE revision; ++-+--+-+++ ++-+--+-+++ ++-+--+-+++
 * Field             | Type                | Null | Key | Default        | Extra          |
 * rev_id            | int(10) unsigned    | NO   | PRI | NULL           | auto_increment |
 * rev_page          | int(10) unsigned    | NO   | MUL | NULL           |                |
 * rev_text_id       | int(10) unsigned    | NO   |     | NULL           |                |
 * rev_comment       | varbinary(767)      | NO   |     | NULL           |                |
 * rev_user          | int(10) unsigned    | NO   | MUL | 0              |                |
 * rev_user_text     | varbinary(255)      | NO   | MUL |                |                |
 * rev_timestamp     | binary(14)          | NO   | MUL |                |                |
 * rev_minor_edit    | tinyint(3) unsigned | NO   |     | 0              |                |
 * rev_deleted       | tinyint(3) unsigned | NO   |     | 0              |                |
 * rev_len           | int(10) unsigned    | YES  |     | NULL           |                |
 * rev_parent_id     | int(10) unsigned    | YES  |     | NULL           |                |
 * rev_sha1          | varbinary(32)       | NO   |     |                |                |
 * rev_content_model | varbinary(32)       | YES  |     | NULL           |                |
 * rev_content_format | varbinary(64)      | YES  |     | NULL           |                |

DESCRIBE revision; ++-+--+-+-++ ++-+--+-+-++ ++-+--+-+-++
 * Field             | Type                | Null | Key | Default | Extra          |
 * rev_id            | int(10) unsigned    | NO   | PRI | NULL    | AUTO_INCREMENT |
 * rev_page          | int(10) unsigned    | NO   | PRI | NULL    |                |
 * rev_text_id       | int(10) unsigned    | NO   |     | NULL    |                |
 * rev_comment       | tinyblob            | NO   |     | NULL    |                |
 * rev_user          | int(10) unsigned    | NO   | MUL | 0       |                |
 * rev_user_text     | varchar(255) binary | NO   | MUL | NULL    |                |
 * rev_timestamp     | binary(14)          | NO   | MUL | NULL    |                |
 * rev_minor_edit    | tinyint(3) unsigned | NO   |     | 0       |                |
 * rev_deleted       | tinyint(3) unsigned | NO   |     | 0       |                |
 * rev_len           | int(10) unsigned    | YES  |     | NULL    |                |
 * rev_parent_id     | int(10) unsigned    | YES  |     | NULL    |                |
 * rev_sha1          | varbinary(32)       | NO   |     | NULL    |                |
 * rev_content_model | varbinary(32)       | YES  |     | NULL    |                |
 * rev_content_format | varbinary(64)      | YES  |     | NULL    |                |

DESCRIBE revision; ++-+--+-+-++ ++-+--+-+-++ ++-+--+-+-++
 * Field         | Type                | Null | Key | Default | Extra          |
 * rev_id        | int(10) unsigned    | NO   | PRI | NULL    | AUTO_INCREMENT |
 * rev_page      | int(10) unsigned    | NO   | PRI | NULL    |                |
 * rev_text_id   | int(10) unsigned    | NO   |     | NULL    |                |
 * rev_comment   | tinyblob            | NO   |     | NULL    |                |
 * rev_user      | int(10) unsigned    | NO   | MUL | 0       |                |
 * rev_user_text | varchar(255) binary | NO   | MUL | NULL    |                |
 * rev_timestamp | binary(14)          | NO   | MUL | NULL    |                |
 * rev_minor_edit | tinyint(3) unsigned | NO  |     | 0       |                |
 * rev_deleted   | tinyint(3) unsigned | NO   |     | 0       |                |
 * rev_len       | int(10) unsigned    | YES  |     | NULL    |                |
 * rev_parent_id | int(10) unsigned    | YES  |     | NULL    |                |
 * rev_sha1      | varbinary(32)       | NO   |     | NULL    |                |

DESCRIBE revision; ++-+--+-+-++ ++-+--+-+-++ ++-+--+-+-++
 * Field         | Type                | Null | Key | Default | Extra          |
 * rev_id        | int(10) unsigned    | NO   | PRI | NULL    | AUTO_INCREMENT |
 * rev_page      | int(10) unsigned    | NO   | PRI | NULL    |                |
 * rev_text_id   | int(10) unsigned    | NO   |     | NULL    |                |
 * rev_comment   | tinyblob            | NO   |     | NULL    |                |
 * rev_user      | int(10) unsigned    | NO   | MUL | 0       |                |
 * rev_user_text | varchar(255) binary | NO   | MUL | NULL    |                |
 * rev_timestamp | binary(14)          | NO   | MUL | NULL    |                |
 * rev_minor_edit | tinyint(3) unsigned | NO  |     | 0       |                |
 * rev_deleted   | tinyint(3) unsigned | NO   |     | 0       |                |
 * rev_len       | int(10) unsigned    | YES  |     | NULL    |                |
 * rev_parent_id | int(10) unsigned    | YES  |     | NULL    |                |

DESCRIBE revision; ++-+--+-+-++ ++-+--+-+-++ ++-+--+-+-++
 * Field         | Type                | Null | Key | Default | Extra          |
 * rev_id        | int(8) unsigned     | NO   | PRI | NULL    | AUTO_INCREMENT |
 * rev_page      | int(8) unsigned     | NO   | PRI | NULL    |                |
 * rev_text_id   | int(8) unsigned     | NO   |     | NULL    |                |
 * rev_comment   | tinyblob            | NO   |     | NULL    |                |
 * rev_user      | int(5) unsigned     | NO   | MUL | 0       |                |
 * rev_user_text | varchar(255) binary | NO   | MUL | NULL    |                |
 * rev_timestamp | char(14) binary     | NO   | MUL | NULL    |                |
 * rev_minor_edit | tinyint(1) unsigned | NO  |     | 0       |                |
 * rev_deleted   | tinyint(1) unsigned | NO   |     | 0       |                |

Les index
SHOW INDEX IN revision; <pre style="width: 170%"> +--++-+--+---+---+-+--++--++-+---+ +--++-+--+---+---+-+--++--++-+---+ +--++-+--+---+---+-+--++--++-+---+
 * Table   | Non_unique | Key_name            | Seq_in_index | Column_name   | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
 * revision |         0 | PRIMARY             |            1 | rev_id        | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
 * revision |         0 | rev_page_id         |            1 | rev_page      | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
 * revision |         0 | rev_page_id         |            2 | rev_id        | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
 * revision |         1 | rev_timestamp       |            1 | rev_timestamp | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
 * revision |         1 | page_timestamp      |            1 | rev_page      | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
 * revision |         1 | page_timestamp      |            2 | rev_timestamp | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
 * revision |         1 | user_timestamp      |            1 | rev_user      | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
 * revision |         1 | user_timestamp      |            2 | rev_timestamp | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
 * revision |         1 | usertext_timestamp  |            1 | rev_user_text | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
 * revision |         1 | usertext_timestamp  |            2 | rev_timestamp | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
 * revision |         1 | page_user_timestamp |            1 | rev_page      | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
 * revision |         1 | page_user_timestamp |            2 | rev_user      | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
 * revision |         1 | page_user_timestamp |            3 | rev_timestamp | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |