From: Aaron Schulz Date: Mon, 12 May 2008 04:35:08 +0000 (+0000) Subject: * Add user_text index to filearchives (for renames at least) X-Git-Tag: 1.31.0-rc.0~47701 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=bb81c98d442a9759cca8fa2c848a7b1f169fd666;p=lhc%2Fweb%2Fwiklou.git * Add user_text index to filearchives (for renames at least) * Remove useless, incomplete, deleted_user index --- diff --git a/maintenance/archives/patch-filearhive-user-index.sql b/maintenance/archives/patch-filearhive-user-index.sql new file mode 100644 index 0000000000..c79000adaa --- /dev/null +++ b/maintenance/archives/patch-filearhive-user-index.sql @@ -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; diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 1caa5987ca..5b83983d99 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -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*/; diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index dce44945a9..190b29a88e 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -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" ); } }