r70075 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70074‎ | r70075 | r70076 >
Date:10:02, 28 July 2010
Author:werdna
Status:deferred (Comments)
Tags:
Comment:
Revert r70017 and r70018. I'm not going to deliberately remove support for 1.15 just because 1.16 was released a few minutes ago.
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/NewMessagesController.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/NewMessagesController.php
@@ -108,7 +108,8 @@
109109 }
110110
111111 private static function getRowsObject( $t ) {
112 - $tables = array( 'watchlist', 'user_message_state', 'user_properties' );
 112+ // <= 1.15 compatibility, it kinda sucks having to do all this up here.
 113+ $tables = array( 'watchlist', 'user_message_state' );
113114 $joins = array(
114115 'user_message_state' =>
115116 array(
@@ -117,17 +118,28 @@
118119 'ums_user=wl_user',
119120 'ums_thread' => $t->id()
120121 )
121 - ),
122 - 'user_properties' =>
123 - array(
 122+ )
 123+ );
 124+ $fields = array( 'wl_user', 'ums_user', 'ums_read_timestamp' );
 125+
 126+ global $wgVersion;
 127+ if ( version_compare( $wgVersion, '1.15.999', '<=' ) ) {
 128+ $oldPrefCompat = true;
 129+
 130+ $tables[] = 'user';
 131+ $joins['user'] = array( 'left join', 'user_id=wl_user' );
 132+ $fields[] = 'user_options';
 133+ } else {
 134+ $tables[] = 'user_properties';
 135+ $joins['user_properties'] = array(
124136 'left join',
125137 array(
126138 'up_user=wl_user',
127139 'up_property' => 'lqtnotifytalk',
128140 )
129 - )
130 - );
131 - $fields = array( 'wl_user', 'ums_user', 'ums_read_timestamp', 'up_value' );
 141+ );
 142+ $fields[] = 'up_value';
 143+ }
132144
133145 $dbr = wfGetDB( DB_SLAVE );
134146 return $dbr->select( $tables, $fields, self::getWhereClause( $t ), __METHOD__, array(), $joins );
@@ -256,30 +268,34 @@
257269 $dbr = wfGetDB( DB_SLAVE );
258270 $fields = array( $dbr->tableName( 'user' ) . '.*' );
259271 $join_conds = array();
260 -
261 - $tableNameUserProperties = $dbr->tableName( 'user_properties' );
 272+ $oldPreferenceFormat = false;
 273+ if ( version_compare( $wgVersion, '1.16', '<' ) ) {
 274+ $oldPreferenceFormat = true;
 275+ } else {
 276+ $tableNameUserProperties = $dbr->tableName( 'user_properties' );
262277
263 - $tables[] = $tableNameUserProperties . ' as tc_prop';
264 - $fields[] = 'tc_prop.up_value as timecorrection';
 278+ $tables[] = $tableNameUserProperties . ' as tc_prop';
 279+ $fields[] = 'tc_prop.up_value as timecorrection';
265280
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 - );
 281+ $join_conds[$tableNameUserProperties . ' as tc_prop'] = array(
 282+ 'left join',
 283+ array(
 284+ 'tc_prop.up_user=user_id',
 285+ 'tc_prop.up_property' => 'timecorrection',
 286+ )
 287+ );
273288
274 - $tables[] = $tableNameUserProperties . ' as l_prop';
275 - $fields[] = 'l_prop.up_value as language';
 289+ $tables[] = $tableNameUserProperties . ' as l_prop';
 290+ $fields[] = 'l_prop.up_value as language';
276291
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 - );
 292+ $join_conds[$tableNameUserProperties . ' as l_prop'] = array(
 293+ 'left join',
 294+ array(
 295+ 'l_prop.up_user=user_id',
 296+ 'l_prop.up_property' => 'language',
 297+ )
 298+ );
 299+ }
284300
285301 $res = $dbr->select(
286302 $tables, $fields,
@@ -301,7 +317,9 @@
302318 while ( $row = $dbr->fetchObject( $res ) ) {
303319 $u = User::newFromRow( $row );
304320
305 - if ( $row->language ) {
 321+ if ( $oldPreferenceFormat ) {
 322+ $langCode = $u->getOption( 'language' );
 323+ } elseif ( $row->language ) {
306324 $langCode = $row->language;
307325 } else {
308326 global $wgLanguageCode;
@@ -311,7 +329,11 @@
312330 $lang = Language::factory( $langCode );
313331
314332 // Adjust with time correction
315 - $timeCorrection = $row->timecorrection;
 333+ if ( $oldPreferenceFormat ) {
 334+ $timeCorrection = $u->getOption( 'timecorrection' );
 335+ } else {
 336+ $timeCorrection = $row->timecorrection;
 337+ }
316338 $adjustedTimestamp = $lang->userAdjust( $timestamp, $timeCorrection );
317339
318340 $date = $lang->date( $adjustedTimestamp );
@@ -324,7 +346,7 @@
325347 $msg = wfMsgReal( $msgName, $params, true /* use DB */, $langCode,
326348 true /*transform*/ );
327349
328 - $to = new MailAddress( $u );
 350+ $to = new MailAddress( $u );
329351 $subject = wfMsgReal( $subjectMsg, array( $threadSubject ), true /* use DB */,
330352 $langCode, true /* transform */ );
331353
@@ -370,9 +392,8 @@
371393
372394 $cval = $wgMemc->get( wfMemcKey( 'lqt-new-messages-count', $user->getId() ) );
373395
374 - if ( $cval ) {
 396+ if ( $cval )
375397 return $cval;
376 - }
377398
378399 $dbr = wfGetDB( DB_SLAVE );
379400

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70017Remove some pre 1.15.999 compatability stuff (1.16 is due to be released, and...reedy15:49, 27 July 2010
r70018Kill off some more < 1.16 stuffreedy15:52, 27 July 2010

Comments

#Comment by Reedy (talk | contribs)   14:32, 28 July 2010

Support was removed BEFORE 1.16 was released ;)

But it had been long branched, so I presumed it would've been fine

#Comment by Werdna (talk | contribs)   14:33, 28 July 2010

Generally yes, but LQT is under active development and the 1.15 version is pretty crap, so…

Status & tagging log