r62859 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62858‎ | r62859 | r62860 >
Date:00:08, 23 February 2010
Author:siebrand
Status:ok (Comments)
Tags:
Comment:
Fix database error (hopefully). Needs review (also because NewMessages::writeMessageStateForUpdatedThread() could contain a similar issue.

Executed query was the below, even though the database table prefix is "bw_".

SELECT
`bw_user`.*,
tc_prop.up_value as timecorrection,
l_prop.up_value as language
FROM
`bw_user` left join
user_properties as tc_prop ON ((up_user=user_id) AND up_property = 'timecorrection') left join
user_properties as l_prop ON ((up_user=user_id) AND up_property = 'language')
WHERE
user_id = '3165'
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/NewMessagesController.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/NewMessagesController.php
@@ -267,10 +267,12 @@
268268 if ( version_compare( $wgVersion, '1.16', '<' ) ) {
269269 $oldPreferenceFormat = true;
270270 } else {
271 - $tables[] = 'user_properties as tc_prop';
 271+ $tableNameUserProperties = $dbr->tableName( 'user_properties' );
 272+
 273+ $tables[] = $tableNameUserProperties . ' as tc_prop';
272274 $fields[] = 'tc_prop.up_value as timecorrection';
273275
274 - $join_conds['user_properties as tc_prop'] = array(
 276+ $join_conds[$tableNameUserProperties . ' as tc_prop'] = array(
275277 'left join',
276278 array(
277279 'up_user=user_id',
@@ -278,10 +280,10 @@
279281 )
280282 );
281283
282 - $tables[] = 'user_properties as l_prop';
 284+ $tables[] = $tableNameUserProperties . ' as l_prop';
283285 $fields[] = 'l_prop.up_value as language';
284286
285 - $join_conds['user_properties as l_prop'] = array(
 287+ $join_conds[$tableNameUserProperties . ' as l_prop'] = array(
286288 'left join',
287289 array(
288290 'up_user=user_id',

Follow-up revisions

RevisionCommit summaryAuthorDate
r62886Follow-up to r62859: trying to fix Error: 1052 Column 'up_user' in on clause ...siebrand18:40, 23 February 2010
r63620MFT r62859, r62886: DB query error for installations with a table prefix.tstarling23:41, 11 March 2010

Comments

#Comment by Tim Starling (talk | contribs)   23:28, 11 March 2010

I don't see any other table selectors in that file. I'm going to backport these two revisions to 1.16.

Status & tagging log