Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.status.php |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | if ( $user->isLoggedIn() ) { |
40 | 40 | $status = $user->getOption( 'OnlineStatusBar_status', $wgOnlineStatusBarDefaultOnline ); |
41 | 41 | if ( $delayed_check ) { |
42 | | - if ( $result < $w_time ) { |
| 42 | + if ( $result < wfTimestamp( TS_MW, $w_time ) ) { |
43 | 43 | $status = 'write'; |
44 | 44 | } |
45 | 45 | } |
— | — | @@ -131,6 +131,14 @@ |
132 | 132 | return 0; |
133 | 133 | } |
134 | 134 | $dbw = wfGetDB( DB_MASTER ); |
| 135 | + $t_time = OnlineStatusBar::getTimeoutDate(); |
| 136 | + $result = $dbw->selectField( 'online_status', 'timestamp', array( "timestamp < " . $dbw->addQuotes( $dbw->timestamp( $t_time ) ) ), |
| 137 | + __METHOD__, array( 'LIMIT 1' ) ); |
| 138 | + if ( $result === false ) { |
| 139 | + // no need for delete |
| 140 | + return 0; |
| 141 | + } |
| 142 | + |
135 | 143 | // calculate time and convert it back to mediawiki format |
136 | 144 | $time = OnlineStatusBar::getTimeoutDate(); |
137 | 145 | $dbw->delete( 'online_status', array( "timestamp < " . $dbw->addQuotes( $dbw->timestamp( $time ) ) ), __METHOD__ ); |
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.body.php |
— | — | @@ -131,7 +131,7 @@ |
132 | 132 | global $wgOnlineStatusBar_WriteTime, $wgOnlineStatusBar_LogoutTime; |
133 | 133 | |
134 | 134 | if ($delayed) { |
135 | | - return wfTimestamp( TS_UNIX ) + $wgOnlineStatusBar_WriteTime; |
| 135 | + return wfTimestamp( TS_UNIX ) - $wgOnlineStatusBar_WriteTime; |
136 | 136 | } |
137 | 137 | |
138 | 138 | return wfTimestamp( TS_UNIX ) - $wgOnlineStatusBar_LogoutTime; |