r86485 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86484‎ | r86485 | r86486 >
Date:15:33, 20 April 2011
Author:happy-melon
Status:resolved (Comments)
Tags:schema 
Comment:
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'].
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/installer/MysqlUpdater.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialPasswordReset.php (modified) (history)
  • /trunk/phase3/maintenance/archives/patch-user_email_index.sql (added) (history)

Diff [purge]

Index: trunk/phase3/maintenance/archives/patch-user_email_index.sql
@@ -0,0 +1 @@
 2+ ALTER TABLE /*$wgDBprefix*/user ADD INDEX ( `user_email`, `user_name` );
\ No newline at end of file
Property changes on: trunk/phase3/maintenance/archives/patch-user_email_index.sql
___________________________________________________________________
Added: svn:eol-style
13 + native
Index: trunk/phase3/includes/installer/MysqlUpdater.php
@@ -163,21 +163,22 @@
164164 // 1.17
165165 array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ),
166166 array( 'addIndex', 'iwlinks', 'iwl_prefix_title_from', 'patch-rename-iwl_prefix.sql' ),
167 - array( 'addField', 'updatelog', 'ul_value', 'patch-ul_value.sql' ),
 167+ array( 'addField', 'updatelog', 'ul_value', 'patch-ul_value.sql' ),
168168 array( 'addField', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ),
169 - array( 'dropIndex', 'iwlinks', 'iwl_prefix', 'patch-kill-iwl_prefix.sql' ),
170 - array( 'dropIndex', 'iwlinks', 'iwl_prefix_from_title', 'patch-kill-iwl_pft.sql' ),
171 - array( 'addField', 'categorylinks', 'cl_collation', 'patch-categorylinks-better-collation.sql' ),
 169+ array( 'dropIndex', 'iwlinks', 'iwl_prefix', 'patch-kill-iwl_prefix.sql' ),
 170+ array( 'dropIndex', 'iwlinks', 'iwl_prefix_from_title', 'patch-kill-iwl_pft.sql' ),
 171+ array( 'addField', 'categorylinks', 'cl_collation', 'patch-categorylinks-better-collation.sql' ),
172172 array( 'doClFieldsUpdate' ),
173173 array( 'doCollationUpdate' ),
174174 array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),
175175 array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
176 - array( 'dropIndex', 'archive', 'ar_page_revid', 'patch-archive_kill_ar_page_revid.sql' ),
177 - array( 'addIndex', 'archive', 'ar_revid', 'patch-archive_ar_revid.sql' ),
 176+ array( 'dropIndex', 'archive', 'ar_page_revid', 'patch-archive_kill_ar_page_revid.sql' ),
 177+ array( 'addIndex', 'archive', 'ar_revid', 'patch-archive_ar_revid.sql' ),
178178 array( 'doLangLinksLengthUpdate' ),
179179
180180 // 1.18
181181 array( 'doUserNewTalkTimestampNotNull' ),
 182+ array( 'addIndex', 'user', 'user_email', 'patch-user_email_index.sql' ),
182183 );
183184 }
184185
Index: trunk/phase3/includes/DefaultSettings.php
@@ -3012,7 +3012,7 @@
30133013 */
30143014 $wgPasswordResetRoutes = array(
30153015 'username' => true,
3016 - 'email' => false, // Warning: enabling this will be *very* slow on large wikis
 3016+ 'email' => false,
30173017 );
30183018
30193019 /**
Index: trunk/phase3/includes/specials/SpecialPasswordReset.php
@@ -105,8 +105,6 @@
106106 && Sanitizer::validateEmail( $data['Email'] ) )
107107 {
108108 $method = 'email';
109 -
110 - // FIXME: this is an unindexed query
111109 $res = wfGetDB( DB_SLAVE )->select(
112110 'user',
113111 '*',

Follow-up revisions

RevisionCommit summaryAuthorDate
r86527Follow-up r86485: SQL error in patch, and also add the index to tables.sql.happy-melon19:02, 20 April 2011
r90125SQLite support for r86485maxsem17:57, 15 June 2011
r92932Follow-up r86482, r86485: removed user_name portion of user_email index per CRaaron08:15, 23 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86482(bug 13015, bug 18347, bug 18996, bug 20473, bug 23669, bug 28244) separate t...happy-melon15:27, 20 April 2011

Comments

#Comment by Reedy (talk | contribs)   18:54, 20 April 2011

Adding user_email key to table user... A database query syntax error has occurred. The last attempted database query was: "ALTER TABLE `mw_user` ADD INDEX ( `user_email`, `user_name` ) " from within function "DatabaseBase::sourceFile( /home/reedy/mediawiki/trunk/phase3/maintenance/archives/patch-user_email_index.sql )". Database returned error "1170: BLOB/TEXT column 'user_email' used in key specification without a key length (localhost)"

Status & tagging log