*Add usertext_timestamp index to archive table
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 27 Jun 2007 20:43:29 +0000 (20:43 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 27 Jun 2007 20:43:29 +0000 (20:43 +0000)
maintenance/archives/patch-archive-user-index.sql [new file with mode: 0644]
maintenance/updaters.inc

diff --git a/maintenance/archives/patch-archive-user-index.sql b/maintenance/archives/patch-archive-user-index.sql
new file mode 100644 (file)
index 0000000..2c2e9e4
--- /dev/null
@@ -0,0 +1,4 @@
+-- Adds a user,timestamp index to the archive table\r
+-- Used for browsing deleted contributions and renames\r
+ALTER TABLE /*$wgDBprefix*/archive \r
+       ADD INDEX usertext_timestamp ( ar_user_text , ar_timestamp )\r
index 01759c9..af1cb53 100644 (file)
@@ -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(