r81031 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81030‎ | r81031 | r81032 >
Date:16:32, 26 January 2011
Author:reedy
Status:ok
Tags:
Comment:
Improvement on r81030, pass on table aliasing to database code, and also table prefixing
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/NewMessagesController.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/NewMessagesController.php
@@ -70,8 +70,7 @@
7171 } else {
7272 throw new MWException( "writeUserMessageState expected User or integer but got $user" );
7373 }
74 -
75 -
 74+
7675 $conversation = Threads::withId($thread_id)->topmostThread()->id();
7776
7877 $dbw = wfGetDB( DB_MASTER );
@@ -245,14 +244,14 @@
246245 }
247246
248247 // Send email notification, fetching all the data in one go
249 - $tableNameUserProperties = $dbr->tableName( 'user_properties' );
 248+ $dbr = wfGetDB( DB_SLAVE );
250249
251250 $tables = array(
252251 'user',
253 - $tableNameUserProperties . ' AS tc_prop',
254 - $tableNameUserProperties . ' AS l_prop'
 252+ 'tc_prop' => 'user_properties',
 253+ 'l_prop' => 'user_properties'
255254 );
256 - $dbr = wfGetDB( DB_SLAVE );
 255+
257256 $fields = array(
258257 $dbr->tableName( 'user' ) . '.*',
259258 'tc_prop.up_value AS timecorrection',
@@ -260,14 +259,14 @@
261260 );
262261
263262 $join_conds = array(
264 - $tableNameUserProperties . ' AS tc_prop' => array(
 263+ 'tc_prop' => array(
265264 'LEFT JOIN',
266265 array(
267266 'tc_prop.up_user=user_id',
268267 'tc_prop.up_property' => 'timecorrection',
269268 )
270269 ),
271 - $tableNameUserProperties . ' AS l_prop' => array(
 270+ 'l_prop' => array(
272271 'LEFT JOIN',
273272 array(
274273 'l_prop.up_user=user_id',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r81030Reapplying r70018 in a cleaner wayreedy16:28, 26 January 2011

Status & tagging log