r51953 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51952‎ | r51953 | r51954 >
Date:09:41, 16 June 2009
Author:werdna
Status:deferred
Tags:
Comment:
Revert unrelated LQT stuff in r51952.
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/LqtNewMessages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/LqtNewMessages.php
@@ -94,7 +94,11 @@
9595 if ( $changeUser->getId() == $row->wl_user )
9696 continue;
9797
98 - if ( $row->ums_user && !$row->ums_read_timestamp ) {
 98+ if ( $row->ums_read_timestamp ) {
 99+ $conds = array( 'ums_user' => $row->ums_user,
 100+ 'ums_thread' => $t->id() );
 101+ $update_tuples[$row->ums_user.$t->id()] = $dbw->makeList( $conds, LIST_AND );
 102+ } elseif ( $row->ums_user ) {
99103 // It's already positive.
100104 } else {
101105 $insert_rows[] =
@@ -110,6 +114,9 @@
111115 }
112116 }
113117
 118+ // Avoids duplicates
 119+ $update_tuples = array_values( $update_tuples );
 120+
114121 // Add user talk notification
115122 if ( $t->article()->getTitle()->getNamespace() == NS_USER_TALK ) {
116123 $name = $t->article()->getTitle()->getText();
@@ -118,9 +125,12 @@
119126 if ( $user ) {
120127 $user->setNewtalk( true );
121128
122 - $insert_rows[] = array( 'ums_user' => $user->getId(),
 129+ $dbw->replace( 'user_message_state',
 130+ array( array( 'ums_user', 'ums_thread' ) ),
 131+ array( 'ums_user' => $user->getId(),
123132 'ums_thread' => $t->id(),
124 - 'ums_read_timestamp' => null );
 133+ 'ums_read_timestamp' => null ),
 134+ __METHOD__ );
125135
126136 if ( $user->getOption( 'enotifusertalkpages' ) ) {
127137 $notify_users[] = $user->getId();
@@ -131,9 +141,14 @@
132142
133143 // Do the actual updates
134144 if ( count($insert_rows) ) {
135 - $dbw->replace( 'user_message_state', array( array( 'ums_user', 'ums_thread' ) ),
136 - $insert_rows, __METHOD__ );
 145+ $dbw->insert( 'user_message_state', $insert_rows, __METHOD__, array( 'IGNORE' ) );
137146 }
 147+ if ( count($update_tuples) ) {
 148+ $where = $dbw->makeList( $update_tuples, LIST_OR );
 149+
 150+ $dbw->update( 'user_message_state', array( 'ums_read_timestamp' => null ),
 151+ array($where), __METHOD__ );
 152+ }
138153
139154 if ( count($notify_users) ) {
140155 self::notifyUsersByMail( $t, $notify_users, wfTimestampNow(), $type );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r51952Fix bug in global auth caused by r48970 (I think). You need to call this->cha...werdna09:40, 16 June 2009

Status & tagging log