| Index: trunk/extensions/LiquidThreads/classes/NewMessagesController.php |
| — | — | @@ -256,34 +256,30 @@ |
| 257 | 257 | $dbr = wfGetDB( DB_SLAVE ); |
| 258 | 258 | $fields = array( $dbr->tableName( 'user' ) . '.*' ); |
| 259 | 259 | $join_conds = array(); |
| 260 | | - $oldPreferenceFormat = false; |
| 261 | | - if ( version_compare( $wgVersion, '1.16', '<' ) ) { |
| 262 | | - $oldPreferenceFormat = true; |
| 263 | | - } else { |
| 264 | | - $tableNameUserProperties = $dbr->tableName( 'user_properties' ); |
| | 260 | + |
| | 261 | + $tableNameUserProperties = $dbr->tableName( 'user_properties' ); |
| 265 | 262 | |
| 266 | | - $tables[] = $tableNameUserProperties . ' as tc_prop'; |
| 267 | | - $fields[] = 'tc_prop.up_value as timecorrection'; |
| | 263 | + $tables[] = $tableNameUserProperties . ' as tc_prop'; |
| | 264 | + $fields[] = 'tc_prop.up_value as timecorrection'; |
| 268 | 265 | |
| 269 | | - $join_conds[$tableNameUserProperties . ' as tc_prop'] = array( |
| 270 | | - 'left join', |
| 271 | | - array( |
| 272 | | - 'tc_prop.up_user=user_id', |
| 273 | | - 'tc_prop.up_property' => 'timecorrection', |
| 274 | | - ) |
| 275 | | - ); |
| | 266 | + $join_conds[$tableNameUserProperties . ' as tc_prop'] = array( |
| | 267 | + 'left join', |
| | 268 | + array( |
| | 269 | + 'tc_prop.up_user=user_id', |
| | 270 | + 'tc_prop.up_property' => 'timecorrection', |
| | 271 | + ) |
| | 272 | + ); |
| 276 | 273 | |
| 277 | | - $tables[] = $tableNameUserProperties . ' as l_prop'; |
| 278 | | - $fields[] = 'l_prop.up_value as language'; |
| | 274 | + $tables[] = $tableNameUserProperties . ' as l_prop'; |
| | 275 | + $fields[] = 'l_prop.up_value as language'; |
| 279 | 276 | |
| 280 | | - $join_conds[$tableNameUserProperties . ' as l_prop'] = array( |
| 281 | | - 'left join', |
| 282 | | - array( |
| 283 | | - 'l_prop.up_user=user_id', |
| 284 | | - 'l_prop.up_property' => 'language', |
| 285 | | - ) |
| 286 | | - ); |
| 287 | | - } |
| | 277 | + $join_conds[$tableNameUserProperties . ' as l_prop'] = array( |
| | 278 | + 'left join', |
| | 279 | + array( |
| | 280 | + 'l_prop.up_user=user_id', |
| | 281 | + 'l_prop.up_property' => 'language', |
| | 282 | + ) |
| | 283 | + ); |
| 288 | 284 | |
| 289 | 285 | $res = $dbr->select( |
| 290 | 286 | $tables, $fields, |
| — | — | @@ -305,9 +301,7 @@ |
| 306 | 302 | while ( $row = $dbr->fetchObject( $res ) ) { |
| 307 | 303 | $u = User::newFromRow( $row ); |
| 308 | 304 | |
| 309 | | - if ( $oldPreferenceFormat ) { |
| 310 | | - $langCode = $u->getOption( 'language' ); |
| 311 | | - } elseif ( $row->language ) { |
| | 305 | + if ( $row->language ) { |
| 312 | 306 | $langCode = $row->language; |
| 313 | 307 | } else { |
| 314 | 308 | global $wgLanguageCode; |
| — | — | @@ -317,11 +311,7 @@ |
| 318 | 312 | $lang = Language::factory( $langCode ); |
| 319 | 313 | |
| 320 | 314 | // Adjust with time correction |
| 321 | | - if ( $oldPreferenceFormat ) { |
| 322 | | - $timeCorrection = $u->getOption( 'timecorrection' ); |
| 323 | | - } else { |
| 324 | | - $timeCorrection = $row->timecorrection; |
| 325 | | - } |
| | 315 | + $timeCorrection = $row->timecorrection; |
| 326 | 316 | $adjustedTimestamp = $lang->userAdjust( $timestamp, $timeCorrection ); |
| 327 | 317 | |
| 328 | 318 | $date = $lang->date( $adjustedTimestamp ); |
| — | — | @@ -334,7 +324,7 @@ |
| 335 | 325 | $msg = wfMsgReal( $msgName, $params, true /* use DB */, $langCode, |
| 336 | 326 | true /*transform*/ ); |
| 337 | 327 | |
| 338 | | - $to = new MailAddress( $u ); |
| | 328 | + $to = new MailAddress( $u ); |
| 339 | 329 | $subject = wfMsgReal( $subjectMsg, array( $threadSubject ), true /* use DB */, |
| 340 | 330 | $langCode, true /* transform */ ); |
| 341 | 331 | |
| — | — | @@ -380,8 +370,9 @@ |
| 381 | 371 | |
| 382 | 372 | $cval = $wgMemc->get( wfMemcKey( 'lqt-new-messages-count', $user->getId() ) ); |
| 383 | 373 | |
| 384 | | - if ( $cval ) |
| | 374 | + if ( $cval ) { |
| 385 | 375 | return $cval; |
| | 376 | + } |
| 386 | 377 | |
| 387 | 378 | $dbr = wfGetDB( DB_SLAVE ); |
| 388 | 379 | |