r104710 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104709‎ | r104710 | r104711 >
Date:17:51, 30 November 2011
Author:petrb
Status:deferred
Tags:
Comment:
Now instead of flushing it update cache so that there is no need for select after db update
Modified paths:
  • /trunk/extensions/OnlineStatusBar/OnlineStatusBar.status.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.status.php
@@ -140,11 +140,12 @@
141141 }
142142 // If we track them, let's insert it to the table
143143 $dbw = wfGetDB( DB_MASTER );
 144+ $timestamp = $dbw->timestamp();
144145 $row = array(
145146 'username' => $wgUser->getName(),
146 - 'timestamp' => $dbw->timestamp(),
 147+ 'timestamp' => $timestamp,
147148 );
148 - self::setCache( $wgUser->getName(), '', ONLINESTATUSBAR_NORMAL_CACHE );
 149+ self::setCache( $wgUser->getName(), $timestamp, ONLINESTATUSBAR_NORMAL_CACHE );
149150 $dbw->insert( 'online_status', $row, __METHOD__ );
150151 return false;
151152 }
@@ -181,13 +182,14 @@
182183
183184 if ( $user_status == 'write' ) {
184185 $dbw = wfGetDB( DB_MASTER );
 186+ $timestamp = $dbw->timestamp();
185187 $dbw->update(
186188 'online_status',
187 - array( 'timestamp' => $dbw->timestamp() ),
 189+ array( 'timestamp' => $timestamp ),
188190 array( 'username' => $wgUser->getName() ),
189191 __METHOD__
190192 );
191 - self::setCache( $wgUser->getName(), '', ONLINESTATUSBAR_NORMAL_CACHE );
 193+ self::setCache( $wgUser->getName(), $timestamp, ONLINESTATUSBAR_NORMAL_CACHE );
192194 self::deleteOld();
193195 }
194196 return true;

Status & tagging log