Index: trunk/extensions/LiquidThreads/classes/NewMessagesController.php |
— | — | @@ -245,40 +245,36 @@ |
246 | 246 | } |
247 | 247 | |
248 | 248 | // Send email notification, fetching all the data in one go |
| 249 | + $tableNameUserProperties = $dbr->tableName( 'user_properties' ); |
249 | 250 | |
250 | | - global $wgVersion; |
251 | | - $tables = array( 'user' ); |
| 251 | + $tables = array( |
| 252 | + 'user', |
| 253 | + $tableNameUserProperties . ' AS tc_prop', |
| 254 | + $tableNameUserProperties . ' AS l_prop' |
| 255 | + ); |
252 | 256 | $dbr = wfGetDB( DB_SLAVE ); |
253 | | - $fields = array( $dbr->tableName( 'user' ) . '.*' ); |
254 | | - $join_conds = array(); |
255 | | - $oldPreferenceFormat = false; |
256 | | - if ( version_compare( $wgVersion, '1.16', '<' ) ) { |
257 | | - $oldPreferenceFormat = true; |
258 | | - } else { |
259 | | - $tableNameUserProperties = $dbr->tableName( 'user_properties' ); |
| 257 | + $fields = array( |
| 258 | + $dbr->tableName( 'user' ) . '.*', |
| 259 | + 'tc_prop.up_value AS timecorrection', |
| 260 | + 'l_prop.up_value as language' |
| 261 | + ); |
260 | 262 | |
261 | | - $tables[] = $tableNameUserProperties . ' as tc_prop'; |
262 | | - $fields[] = 'tc_prop.up_value as timecorrection'; |
263 | | - |
264 | | - $join_conds[$tableNameUserProperties . ' as tc_prop'] = array( |
265 | | - 'left join', |
| 263 | + $join_conds = array( |
| 264 | + $tableNameUserProperties . ' AS tc_prop' => array( |
| 265 | + 'LEFT JOIN', |
266 | 266 | array( |
267 | 267 | 'tc_prop.up_user=user_id', |
268 | 268 | 'tc_prop.up_property' => 'timecorrection', |
269 | 269 | ) |
270 | | - ); |
271 | | - |
272 | | - $tables[] = $tableNameUserProperties . ' as l_prop'; |
273 | | - $fields[] = 'l_prop.up_value as language'; |
274 | | - |
275 | | - $join_conds[$tableNameUserProperties . ' as l_prop'] = array( |
276 | | - 'left join', |
| 270 | + ), |
| 271 | + $tableNameUserProperties . ' AS l_prop' => array( |
| 272 | + 'LEFT JOIN', |
277 | 273 | array( |
278 | 274 | 'l_prop.up_user=user_id', |
279 | 275 | 'l_prop.up_property' => 'language', |
280 | 276 | ) |
281 | | - ); |
282 | | - } |
| 277 | + ) |
| 278 | + ); |
283 | 279 | |
284 | 280 | $res = $dbr->select( |
285 | 281 | $tables, $fields, |
— | — | @@ -300,9 +296,7 @@ |
301 | 297 | foreach( $res as $row ) { |
302 | 298 | $u = User::newFromRow( $row ); |
303 | 299 | |
304 | | - if ( $oldPreferenceFormat ) { |
305 | | - $langCode = $u->getOption( 'language' ); |
306 | | - } elseif ( $row->language ) { |
| 300 | + if ( $row->language ) { |
307 | 301 | $langCode = $row->language; |
308 | 302 | } else { |
309 | 303 | global $wgLanguageCode; |
— | — | @@ -312,11 +306,7 @@ |
313 | 307 | $lang = Language::factory( $langCode ); |
314 | 308 | |
315 | 309 | // Adjust with time correction |
316 | | - if ( $oldPreferenceFormat ) { |
317 | | - $timeCorrection = $u->getOption( 'timecorrection' ); |
318 | | - } else { |
319 | | - $timeCorrection = $row->timecorrection; |
320 | | - } |
| 310 | + $timeCorrection = $row->timecorrection; |
321 | 311 | $adjustedTimestamp = $lang->userAdjust( $timestamp, $timeCorrection ); |
322 | 312 | |
323 | 313 | $date = $lang->date( $adjustedTimestamp ); |
— | — | @@ -331,7 +321,7 @@ |
332 | 322 | $msg = wfMsgReal( $msgName, $params, true /* use DB */, $langCode, |
333 | 323 | true /*transform*/ ); |
334 | 324 | |
335 | | - $to = new MailAddress( $u ); |
| 325 | + $to = new MailAddress( $u ); |
336 | 326 | $subject = wfMsgReal( $subjectMsg, array( $threadSubject ), true /* use DB */, |
337 | 327 | $langCode, true /* transform */ ); |
338 | 328 | |