r100546 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100545‎ | r100546 | r100547 >
Date:16:15, 23 October 2011
Author:petrb
Status:deferred
Tags:
Comment:
returned back missing function
Modified paths:
  • /trunk/extensions/OnlineStatusBar/OnlineStatusBar.body.php (modified) (history)
  • /trunk/extensions/OnlineStatusBar/OnlineStatusBar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.body.php
@@ -32,10 +32,15 @@
3333 $modeText = $wgOnlineStatusBarModes[$mode];
3434 return Html::element( 'img', array( 'src' => $icon ) );
3535 }
 36+
 37+ static function GetNow()
 38+ {
 39+ return gmdate( 'Ymdhis', time() );
 40+ }
3641
3742 static function UpdateDb()
3843 {
39 - global $wgUser, $wgOnlineStatusBarDefaultOnline;
 44+ global $wgUser, $wgOnlineStatusBarDefaultOnline, $wgOnlineStatusBarTable;
4045 if ( OnlineStatusBar::GetStatus( $wgUser->getID() ) != $wgOnlineStatusBarDefaultOnline )
4146 {
4247 $dbw = wfGetDB( DB_MASTER );
@@ -45,7 +50,7 @@
4651 'username' => $wgUser->getName(),
4752 'timestamp' => $dbw->timestamp( wfTimestamp() ),
4853 );
49 - $dbw->insert( 'online_status', $row, __METHOD__, 'DELAYED' );
 54+ $dbw->insert( $wgOnlineStatusBarTable, $row, __METHOD__, 'DELAYED' );
5055 }
5156
5257 return false;
@@ -53,7 +58,7 @@
5459
5560 static function UpdateStatus()
5661 {
57 - global $wgUser, $wgOnlineStatusBarDefaultOffline;
 62+ global $wgUser, $wgOnlineStatusBarDefaultOffline, $wgOnlineStatusBarTable;
5863 $now = OnlineStatusBar::GetNow();
5964 if ( OnlineStatusBar::GetStatus( $wgUser->getId() ) == $wgOnlineStatusBarDefaultOffline )
6065 {
@@ -62,7 +67,7 @@
6368 }
6469 $dbw = wfGetDB( DB_MASTER );
6570 $dbw->update(
66 - 'online_status',
 71+ $wgOnlineStatusBarTable,
6772 array( 'timestamp' => $dbw->timestamp( wfTimestamp() ) ),
6873 array( 'username' => $wgUser->getID() ),
6974 __METHOD__
@@ -74,16 +79,16 @@
7580
7681 public static function DeleteOld()
7782 {
78 - global $wgOnlineStatusBar_LogoutTime, $wgDBname;
 83+ global $wgOnlineStatusBar_LogoutTime, $wgDBname, $wgOnlineStatusBarTable;
7984 $dbw = wfGetDB( DB_MASTER );
8085 $time = wfTimestamp( TS_UNIX ) - $wgOnlineStatusBar_LogoutTime;
8186 $time = $dbw->addQuotes( $dbw->timestamp( $time ) );
82 - $dbw->delete( 'online_status', array( "timestamp < $time" ) , __METHOD__ );
 87+ $dbw->delete( $wgOnlineStatusBarTable, array( "timestamp < $time" ) , __METHOD__ );
8388 return 0;
8489 }
8590
8691 static function GetStatus( $userID ) {
87 - global $wgOnlineStatusBarModes, $wgOnlineStatusBarDefaultOffline, $wgOnlineStatusBarDefaultOnline, $wgDBname;
 92+ global $wgOnlineStatusBarModes, $wgOnlineStatusBarTable, $wgOnlineStatusBarDefaultOffline, $wgOnlineStatusBarDefaultOnline, $wgDBname;
8893 $dbw = wfGetDB( DB_MASTER );
8994 OnlineStatusBar::DeleteOld();
9095 $result = $dbw->selectField( 'online_status', 'userid', array( 'userid' => $userID ), __METHOD__, array( 'limit 1', 'order by timestamp desc' ) );
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.php
@@ -30,6 +30,7 @@
3131
3232 // Configuration
3333 // Those values can be overriden in LocalSettings, do not change it here
 34+$wgOnlineStatusBarTable = "online_status";
3435 $wgOnlineStatusBarModes = array (
3536 'online' => "On-line",
3637 'busy' => "Busy",

Status & tagging log