From 3ef8a83c0a86c68f94acc17f4c77282673307dae Mon Sep 17 00:00:00 2001 From: Happy-melon Date: Wed, 20 Apr 2011 15:33:04 +0000 Subject: [PATCH] Follow-up r86482: patch to add an index on user_email. Not a problem if this is not run on WMF wikis as long as they don't enable the $wgPasswordResetRoutes['email']. --- includes/DefaultSettings.php | 2 +- includes/installer/MysqlUpdater.php | 13 +++++++------ includes/specials/SpecialPasswordReset.php | 2 -- maintenance/archives/patch-user_email_index.sql | 1 + 4 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 maintenance/archives/patch-user_email_index.sql diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 6bc943711e..bd6c733067 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3012,7 +3012,7 @@ $wgLivePasswordStrengthChecks = false; */ $wgPasswordResetRoutes = array( 'username' => true, - 'email' => false, // Warning: enabling this will be *very* slow on large wikis + 'email' => false, ); /** diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index f9f212d32c..3ab4b92b5f 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -163,21 +163,22 @@ class MysqlUpdater extends DatabaseUpdater { // 1.17 array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ), array( 'addIndex', 'iwlinks', 'iwl_prefix_title_from', 'patch-rename-iwl_prefix.sql' ), - array( 'addField', 'updatelog', 'ul_value', 'patch-ul_value.sql' ), + array( 'addField', 'updatelog', 'ul_value', 'patch-ul_value.sql' ), array( 'addField', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ), - array( 'dropIndex', 'iwlinks', 'iwl_prefix', 'patch-kill-iwl_prefix.sql' ), - array( 'dropIndex', 'iwlinks', 'iwl_prefix_from_title', 'patch-kill-iwl_pft.sql' ), - array( 'addField', 'categorylinks', 'cl_collation', 'patch-categorylinks-better-collation.sql' ), + array( 'dropIndex', 'iwlinks', 'iwl_prefix', 'patch-kill-iwl_prefix.sql' ), + array( 'dropIndex', 'iwlinks', 'iwl_prefix_from_title', 'patch-kill-iwl_pft.sql' ), + array( 'addField', 'categorylinks', 'cl_collation', 'patch-categorylinks-better-collation.sql' ), array( 'doClFieldsUpdate' ), array( 'doCollationUpdate' ), array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ), array( 'addTable', 'module_deps', 'patch-module_deps.sql' ), - array( 'dropIndex', 'archive', 'ar_page_revid', 'patch-archive_kill_ar_page_revid.sql' ), - array( 'addIndex', 'archive', 'ar_revid', 'patch-archive_ar_revid.sql' ), + array( 'dropIndex', 'archive', 'ar_page_revid', 'patch-archive_kill_ar_page_revid.sql' ), + array( 'addIndex', 'archive', 'ar_revid', 'patch-archive_ar_revid.sql' ), array( 'doLangLinksLengthUpdate' ), // 1.18 array( 'doUserNewTalkTimestampNotNull' ), + array( 'addIndex', 'user', 'user_email', 'patch-user_email_index.sql' ), ); } diff --git a/includes/specials/SpecialPasswordReset.php b/includes/specials/SpecialPasswordReset.php index fe9d9248a4..ee2b10b194 100644 --- a/includes/specials/SpecialPasswordReset.php +++ b/includes/specials/SpecialPasswordReset.php @@ -105,8 +105,6 @@ class SpecialPasswordReset extends FormSpecialPage { && Sanitizer::validateEmail( $data['Email'] ) ) { $method = 'email'; - - // FIXME: this is an unindexed query $res = wfGetDB( DB_SLAVE )->select( 'user', '*', diff --git a/maintenance/archives/patch-user_email_index.sql b/maintenance/archives/patch-user_email_index.sql new file mode 100644 index 0000000000..7218c958f8 --- /dev/null +++ b/maintenance/archives/patch-user_email_index.sql @@ -0,0 +1 @@ + ALTER TABLE /*$wgDBprefix*/user ADD INDEX ( `user_email`, `user_name` ); \ No newline at end of file -- 2.20.1