Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.body.php |
— | — | @@ -97,10 +97,13 @@ |
98 | 98 | * @param $user User |
99 | 99 | * @return String |
100 | 100 | */ |
101 | | - public static function getStatus( $user ) { |
| 101 | + public static function getStatus( $user, $update = false ) { |
102 | 102 | global $wgOnlineStatusBarDefaultOffline, $wgOnlineStatusBarDefaultOnline; |
103 | 103 | // remove old entries |
104 | | - self::DeleteOld(); |
| 104 | + if ( $update ) |
| 105 | + { |
| 106 | + self::DeleteOld(); |
| 107 | + } |
105 | 108 | |
106 | 109 | $dbr = wfGetDB( DB_SLAVE ); |
107 | 110 | $result = $dbr->selectField( 'online_status', 'username', array( 'username' => $user->getName() ), |
— | — | @@ -148,7 +151,7 @@ |
149 | 152 | */ |
150 | 153 | public static function UpdateStatus() { |
151 | 154 | global $wgUser, $wgOnlineStatusBarDefaultOffline; |
152 | | - if ( OnlineStatusBar::GetStatus( $wgUser ) == $wgOnlineStatusBarDefaultOffline ) { |
| 155 | + if ( OnlineStatusBar::GetStatus( $wgUser, true ) == $wgOnlineStatusBarDefaultOffline ) { |
153 | 156 | OnlineStatusBar::UpdateDb(); |
154 | 157 | return true; |
155 | 158 | } |
— | — | @@ -171,7 +174,7 @@ |
172 | 175 | global $wgOnlineStatusBar_LogoutTime; |
173 | 176 | $dbw = wfGetDB( DB_MASTER ); |
174 | 177 | $time = $dbw->timestamp() - $wgOnlineStatusBar_LogoutTime; |
175 | | - $dbw->delete( 'online_status', array( "timestamp < $time" ), __METHOD__ ); |
| 178 | + $dbw->delete( 'online_status', array( "timestamp < " . $dbw->addQuotes( $time ) ), __METHOD__ ); |
176 | 179 | return 0; |
177 | 180 | } |
178 | 181 | |
— | — | @@ -203,4 +206,3 @@ |
204 | 207 | $dbw->delete( 'online_status', array( 'username' => $userName ), __METHOD__ ); // delete user |
205 | 208 | return true; |
206 | 209 | } |
207 | | -} |