From bdd24eab43ed8606eac2c86607327cb5667840c6 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Fri, 7 Sep 2007 01:52:12 +0000 Subject: [PATCH] Reinstate 25267 now that 1.11 is branched, and add the relatively long-requested rev_bot (with no index) while I'm at it. By the way, the current index-updating format in updaters.inc makes baby Jesus cry. --- includes/Article.php | 4 ++-- maintenance/tables.sql | 6 +++++- maintenance/updaters.inc | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 7ba55c548b..0e51faf78b 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2463,8 +2463,8 @@ class Article { * * @param Revision $rev * - * @todo This is a shitty interface function. Kill it and replace the - * other shitty functions like editUpdates and such so it's not needed + * @todo This is a lousy interface function. Kill it and replace the + * other cruddy functions like editUpdates and such so it's not needed * anymore. */ function createUpdates( $rev ) { diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 72a779a912..440921ceb9 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -270,6 +270,9 @@ CREATE TABLE /*$wgDBprefix*/revision ( -- Not yet used; reserved for future changes to the deletion system. rev_deleted tinyint unsigned NOT NULL default '0', + -- Was this edit made by a bot (and marked as such)? + rev_bot tinyint unsigned NOT NULL default '0', + -- Length of this revision in bytes rev_len int unsigned, @@ -282,7 +285,8 @@ CREATE TABLE /*$wgDBprefix*/revision ( INDEX rev_timestamp (rev_timestamp), INDEX page_timestamp (rev_page,rev_timestamp), INDEX user_timestamp (rev_user,rev_timestamp), - INDEX usertext_timestamp (rev_user_text,rev_timestamp) + INDEX usertext_timestamp (rev_user_text,rev_timestamp), + INDEX page_user_timestamp (rev_page,rev_user,rev_timestamp) ) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024; -- In case tables are created as MyISAM, use row hints for MySQL <5.0 to avoid 4GB limit diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index beadacfa52..4438c9ad04 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -83,6 +83,7 @@ $wgNewFields = array( array( 'oldimage', 'oi_metadata', 'patch-oi_metadata.sql'), array( 'archive', 'ar_page_id', 'patch-archive-page_id.sql'), array( 'image', 'img_sha1', 'patch-img_sha1.sql' ), + array( 'revision', 'rev_bot', 'patch-rev_bot.sql' ), ); # For extensions only, should be populated via hooks @@ -1031,6 +1032,8 @@ function do_all_updates( $shared = false, $purge = true ) { do_oldimage_user_index(); flush (); + do_revision_page_user_index(); flush (); + echo "Deleting old default messages (this may take a long time!)..."; flush(); deleteDefaultMessages(); echo "Done\n"; flush(); @@ -1129,6 +1132,17 @@ function do_restrictions_update() { } +function do_revision_page_user_index() { + global $wgDatabase; + if( $wgDatabase->indexExists( 'revision', 'page_user_timestamp' ) ) { + echo "...page,user,timestamp key on revision already exists.\n"; + } else { + echo "Adding page,user,timestamp key on revision table... "; + dbsource( archive("patch-revision-user-page-index.sql"), $wgDatabase ); + echo "ok\n"; + } +} + function pg_describe_table($table) { -- 2.20.1