From 7ad7cab40f87bd3078e279d045fbd20fc2bbfbab Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 27 Jun 2007 20:43:29 +0000 Subject: [PATCH] *Add usertext_timestamp index to archive table --- .../archives/patch-archive-user-index.sql | 4 ++++ maintenance/updaters.inc | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 maintenance/archives/patch-archive-user-index.sql diff --git a/maintenance/archives/patch-archive-user-index.sql b/maintenance/archives/patch-archive-user-index.sql new file mode 100644 index 0000000000..2c2e9e4b85 --- /dev/null +++ b/maintenance/archives/patch-archive-user-index.sql @@ -0,0 +1,4 @@ +-- Adds a user,timestamp index to the archive table +-- Used for browsing deleted contributions and renames +ALTER TABLE /*$wgDBprefix*/archive + ADD INDEX usertext_timestamp ( ar_user_text , ar_timestamp ) diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 01759c9625..af1cb536e6 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -76,8 +76,8 @@ $wgNewFields = array( array( 'archive', 'ar_len', 'patch-ar_len.sql' ), array( 'revision', 'rev_parent_id', 'patch-rev_parent_id.sql' ), array( 'page_restrictions', 'pr_id', 'patch-page_restrictions_sortkey.sql' ), - array( 'ipblocks', 'ipb_block_email', 'patch-ipb_emailban.sql' ), - array( 'oldimage', 'oi_metadata', 'patch-oi_metadata.sql'), + array( 'ipblocks', 'ipb_block_email', 'patch-ipb_emailban.sql' ), + array( 'oldimage', 'oi_metadata', 'patch-oi_metadata.sql'), ); function rename_table( $from, $to, $patch ) { @@ -221,6 +221,16 @@ function do_logging_timestamp_index() { } } +function do_archive_user_index() { + global $wgDatabase; + if( $wgDatabase->indexExists( 'archive', 'usertext_timestamp' ) ) { + echo "...usertext,timestamp key on archive already exists.\n"; + } else { + echo "Adding usertext,timestamp key on archive table... "; + dbsource( archive("patch-archive-user-index.sql"), $wgDatabase ); + echo "ok\n"; + } +} function do_watchlist_update() { global $wgDatabase; @@ -944,6 +954,8 @@ function do_all_updates( $shared = false, $purge = true ) { do_categorylinks_indices_update(); flush(); do_restrictions_update(); flush (); + + do_archive_user_index(); flush (); echo "Deleting old default messages (this may take a long time!)..."; flush(); deleteDefaultMessages(); @@ -1275,7 +1287,8 @@ function do_postgres_updates() { ); $newindexes = array( - array("revision", "rev_text_id_idx", "patch-rev_text_id_idx.sql") + array("revision", "rev_text_id_idx", "patch-rev_text_id_idx.sql"), + array("archive", "usertext_timestamp", "patch-archive-user-index.sql"), ); $newrules = array( -- 2.20.1