r104559 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104558‎ | r104559 | r104560 >
Date:12:48, 29 November 2011
Author:petrb
Status:deferred
Tags:
Comment:
updated some comments and implemented write timeout for anons too
Modified paths:
  • /trunk/extensions/OnlineStatusBar/OnlineStatusBar.status.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.status.php
@@ -68,11 +68,11 @@
6969 global $wgOnlineStatusBarDefaultOffline, $wgOnlineStatusBarDefaultOnline;
7070 // instead of delete every time just select the records which are not that old
7171 if ( !$delayed_check ) {
72 - $t_time = OnlineStatusBar::getTimeoutDate();
7372 // first try to use cache
7473 $result = self::getCache( $user->getName(), ONLINESTATUSBAR_NORMAL_CACHE );
7574
7675 if ( $result == '' ) {
 76+ $t_time = OnlineStatusBar::getTimeoutDate();
7777 $dbr = wfGetDB( DB_SLAVE );
7878 $result = $dbr->selectField( 'online_status', 'timestamp', array( 'username' => $user->getName(),
7979 'timestamp > ' . $dbr->addQuotes( $dbr->timestamp( $t_time ) ) ),
@@ -81,6 +81,7 @@
8282 self::setCache( $user->getName(), $result, ONLINESTATUSBAR_NORMAL_CACHE );
8383 }
8484 } else {
 85+ // checking only if we need to do write or not
8586 $result = self::getCache( $user->getName(), ONLINESTATUSBAR_DELAYED_CACHE );
8687 if ( $result == '' ) {
8788 $dbr = wfGetDB( DB_SLAVE );
@@ -99,6 +100,7 @@
100101 if ( $user->isLoggedIn() ) {
101102 $status = $user->getOption( 'OnlineStatusBar_status', $wgOnlineStatusBarDefaultOnline );
102103 if ( $delayed_check ) {
 104+ // check if it's old or not
103105 if ( $result < wfTimestamp( TS_MW, $w_time ) ) {
104106 $status = 'write';
105107 }
@@ -109,6 +111,11 @@
110112 }
111113 } else {
112114 $status = $wgOnlineStatusBarDefaultOnline;
 115+ if ( $delayed_check ) {
 116+ if ( $result < wfTimestamp( TS_MW, $w_time ) ) {
 117+ $status = 'write';
 118+ }
 119+ }
113120 }
114121 }
115122

Status & tagging log