* Add user_text index to filearchives (for renames at least)
authorAaron Schulz <aaron@users.mediawiki.org>
Mon, 12 May 2008 04:35:08 +0000 (04:35 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Mon, 12 May 2008 04:35:08 +0000 (04:35 +0000)
* Remove useless, incomplete, deleted_user index

maintenance/archives/patch-filearhive-user-index.sql [new file with mode: 0644]
maintenance/tables.sql
maintenance/updaters.inc

diff --git a/maintenance/archives/patch-filearhive-user-index.sql b/maintenance/archives/patch-filearhive-user-index.sql
new file mode 100644 (file)
index 0000000..c79000a
--- /dev/null
@@ -0,0 +1,5 @@
+-- Adding index to sort by uploader
+ALTER TABLE /*$wgDBprefix*/filearchive 
+  ADD INDEX fa_user_timestamp (fa_user_text,fa_timestamp),
+  -- Remove useless, incomplete index
+  DROP INDEX fa_deleted_user;
index 1caa598..5b83983 100644 (file)
@@ -841,7 +841,7 @@ CREATE TABLE /*$wgDBprefix*/filearchive (
   INDEX (fa_name, fa_timestamp),             -- pick out by image name
   INDEX (fa_storage_group, fa_storage_key),  -- pick out dupe files
   INDEX (fa_deleted_timestamp),              -- sort by deletion time
-  INDEX (fa_deleted_user)                    -- sort by deleter
+  INDEX fa_user_timestamp (fa_user_text,fa_timestamp) -- sort by uploader
 
 ) /*$wgDBTableOptions*/;
 
index dce4494..190b29a 100644 (file)
@@ -142,6 +142,7 @@ $wgMysqlUpdates = array(
        array( 'do_populate_parent_id' ),
        array( 'check_bin', 'protected_titles', 'pt_title',      'patch-pt_title-encoding.sql', ),
        array( 'maybe_do_profiling_memory_update' ),
+       array( 'do_filearchive_indices_update' ),
 );
 
 
@@ -970,6 +971,7 @@ function do_backlinking_indices_update() {
                !index_has_field('imagelinks', 'il_to', 'il_from'))
        {       
                dbsource( archive( 'patch-backlinkindexes.sql' ) );
+               echo( "...backlinking indices updated\n" );
        }
 }
 
@@ -978,6 +980,18 @@ function do_categorylinks_indices_update() {
        if (!index_has_field('categorylinks', 'cl_sortkey', 'cl_from'))
        {       
                dbsource( archive( 'patch-categorylinksindex.sql' ) );
+               echo( "...categorylinks indices updated\n" );
+       }
+}
+
+function do_filearchive_indices_update() {
+       global $wgDatabase;
+       echo( "Checking filearchive indices...\n" );
+       $info = $wgDatabase->indexInfo( 'filearchive', 'fa_user_timestamp', __METHOD__ );
+       if ( !$info )
+       {       
+               dbsource( archive( 'patch-filearhive-user-index.sql' ) );
+               echo( "...filearchive indices updated\n" );
        }
 }