Extension:MirrorTools/Core fields

Here are some explanations of how core fields (including some added by MirrorTools) are used by LocalWiki.

Principles
New core fields are added for:
 * Push timestamps, which serve to indicate whether it's a mirrored change
 * "Remotely live" indicators, which show whether the page, revision, etc. are still under Wikipedia's purview (i.e. they haven't been deleted)
 * Remote user IDs, since the usual fields for storing that data will be zeroed out on Inclupedia

log_mt_push_timestamp
Timestamp the log entry was mirrorpushed.

log_mt_user
Remote wiki user_id.

page_mt_remotely_live
0 if the page has no remotely live revisions; otherwise 1. If the value is 1, then the page is treated as essentially protected locally; you can view the source, but to edit, move, etc. the page, you'll need to go to Wikipedia.

page_mt_former
page_id from before mirrored revisions were merged into the page history of the mirrored page. A page can get a page_mt_former value, or have its existing page_mt_former value changed, by (1) having a mirrored page moved onto the page, or (2) having mirrored revisions added to the page by mirrored edits (remote new page creation) or mirrored restorations. rev_page and page_id will be restored to the rev_mt_former_page value if the mirrored revisions are mirrormoved elsewhere. See Extension:MirrorTools/Move_and_mirrormove.

Example:
 * Page A (page_id G) is created locally with revision X.
 * Page B (page id H) is created remotely with revision Y.
 * Page B is then moved remotely to page A.
 * Page A's page_id becomes H.
 * Revision X's rev_page becomes H.
 * Revision X's rev_mt_former_page is set to G.


 * Page A is then moved to page C (keeping the same page_id, H, of course).
 * Revision X's rev_page becomes G, its rev_mt_former_page.

The point of this is so that two principles are adhered to:
 * Wikipedians can't, by moving a page around sequentially to a bunch of page titles occupied by Inclupedia pages, "scoop up" all those Inclupedia revisions in a way that would have to be manually de-merged.
 * A Wikipedia page that's moved to an Inclupedia page will, at least temporarily, merge its history with that page's history. If the Wikipedia page is later moved, then it's assumed that in all likelihood, the move was a mistake, so the history merge is reversed.

rc_old_len
In mirrored changes, this is set to whatever it was on the remote wiki. This is arguably a feature, not a glitch, because it ensures RecentChanges shows the change as it was made on the remote wiki, and how dramatic (or undramatic), in terms of characters added or removed, that change was when it was made.

rc_mt_push_timestamp
Timestamp the recent change was mirrorpushed.

rc_mt_user
Remote wiki user_id.

rev_mt_ar_page_id
The rev_page could end up being different from if, say, a page is deleted on RemoteWiki and then another page is mirrormoved onto that page title and page namespace. This stores that ar_page_id.

rev_mt_push_timestamp
Timestamp the revision was mirrorpushed.

rev_mt_user
Remote wiki user_id.

logging
mysql> describe logging; +---+-+--+-+++ +---+-+--+-+++ +---+-+--+-+++ 14 rows in set (0.00 sec)
 * Field                | Type                | Null | Key | Default        | Extra          |
 * log_id               | bigint(20) unsigned | NO   | PRI | NULL           | auto_increment |
 * log_type             | varbinary(32)       | NO   | MUL |                |                |
 * log_action           | varbinary(32)       | NO   |     |                |                |
 * log_timestamp        | binary(14)          | NO   | MUL | 19700101000000 |                |
 * log_user             | bigint(20) unsigned | YES  | MUL | NULL           |                |
 * log_user_text        | varbinary(255)      | NO   | MUL |                |                |
 * log_namespace        | int(11)             | NO   | MUL | 0              |                |
 * log_title            | varbinary(255)      | NO   |     |                |                |
 * log_page             | bigint(20) unsigned | YES  | MUL | NULL           |                |
 * log_comment          | varbinary(255)      | NO   |     |                |                |
 * log_params           | blob                | NO   |     | NULL           |                |
 * log_deleted          | tinyint(3) unsigned | NO   |     | 0              |                |
 * log_mt_push_timestamp | binary(14)         | NO   |     |                |                |
 * log_mt_user          | bigint(20) unsigned | YES  |     | NULL           |                |

recentchanges
mysql> describe recentchanges; +--+-+--+-+++ +--+-+--+-+++ +--+-+--+-+++ 26 rows in set (0.00 sec)
 * Field               | Type                | Null | Key | Default        | Extra          |
 * rc_id               | bigint(20) unsigned | NO   | PRI | NULL           | auto_increment |
 * rc_timestamp        | varbinary(14)       | NO   | MUL |                |                |
 * rc_user             | bigint(20) unsigned | YES  |     | NULL           |                |
 * rc_user_text        | varbinary(255)      | NO   | MUL | NULL           |                |
 * rc_namespace        | int(11)             | NO   | MUL | 0              |                |
 * rc_title            | varbinary(255)      | NO   |     |                |                |
 * rc_comment          | varbinary(255)      | NO   |     |                |                |
 * rc_minor            | tinyint(3) unsigned | NO   |     | 0              |                |
 * rc_bot              | tinyint(3) unsigned | NO   |     | 0              |                |
 * rc_new              | tinyint(3) unsigned | NO   | MUL | 0              |                |
 * rc_cur_id           | bigint(20) unsigned | YES  | MUL | NULL           |                |
 * rc_this_oldid       | bigint(20) unsigned | YES  |     | NULL           |                |
 * rc_last_oldid       | bigint(20) unsigned | YES  |     | NULL           |                |
 * rc_type             | tinyint(3) unsigned | NO   |     | 0              |                |
 * rc_source           | varbinary(16)       | NO   |     |                |                |
 * rc_patrolled        | tinyint(3) unsigned | NO   |     | 0              |                |
 * rc_ip               | varbinary(40)       | NO   | MUL |                |                |
 * rc_old_len          | int(11)             | YES  |     | NULL           |                |
 * rc_new_len          | int(11)             | YES  |     | NULL           |                |
 * rc_deleted          | tinyint(3) unsigned | NO   |     | 0              |                |
 * rc_logid            | bigint(20) unsigned | YES  |     | NULL           |                |
 * rc_log_type         | varbinary(255)      | YES  |     | NULL           |                |
 * rc_log_action       | varbinary(255)      | YES  |     | NULL           |                |
 * rc_params           | blob                | YES  |     | NULL           |                |
 * rc_mt_push_timestamp | binary(14)         | NO   |     |                |                |
 * rc_mt_user          | bigint(20) unsigned | YES  |     | NULL           |                |

revision
mysql> describe revision; +---+-+--+-+++ +---+-+--+-+++ +---+-+--+-+++ 19 rows in set (0.00 sec)
 * Field                | Type                | Null | Key | Default        | Extra          |
 * rev_id               | bigint(20) unsigned | NO   | PRI | NULL           | auto_increment |
 * rev_page             | bigint(20) unsigned | YES  | MUL | NULL           |                |
 * rev_text_id          | int(10) unsigned    | NO   |     | NULL           |                |
 * rev_comment          | tinyblob            | NO   |     | NULL           |                |
 * rev_user             | bigint(20) unsigned | YES  | MUL | NULL           |                |
 * 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        | bigint(20) unsigned | YES  |     | NULL           |                |
 * rev_sha1             | varbinary(32)       | NO   |     |                |                |
 * rev_content_model    | varbinary(32)       | YES  |     | NULL           |                |
 * rev_content_format   | varbinary(64)       | YES  |     | NULL           |                |
 * rev_mt_page          | bigint(20) unsigned | YES  |     | NULL           |                |
 * rev_mt_user          | bigint(20) unsigned | YES  |     | NULL           |                |
 * rev_mt_push_timestamp | binary(14)         | NO   |     |                |                |
 * rev_mt_former_page   | bigint(20) unsigned | YES  |     | NULL           |                |
 * rev_mt_remotely_live | tinyint(3) unsigned | NO   |     | 0              |                |