Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.status.php |
— | — | @@ -123,7 +123,7 @@ |
124 | 124 | * Insert to the database |
125 | 125 | * @return bool |
126 | 126 | */ |
127 | | - public static function updateDb() { |
| 127 | + public static function updateDB() { |
128 | 128 | global $wgUser; |
129 | 129 | // Skip users we don't track |
130 | 130 | if ( OnlineStatusBar::isValid ( $wgUser ) != true ) { |
— | — | @@ -160,18 +160,12 @@ |
161 | 161 | public static function updateStatus() { |
162 | 162 | global $wgUser, $wgOnlineStatusBarDefaultOffline, $wgOnlineStatusBarTrackIpUsers, $wgOnlineStatusBarDefaultEnabled; |
163 | 163 | // if anon users are not tracked and user is anon leave it |
164 | | - if ( !$wgOnlineStatusBarTrackIpUsers ) { |
165 | | - if ( !$wgUser->isLoggedIn() ) { |
166 | | - return false; |
167 | | - } |
168 | | - } |
169 | | - // if user doesn't want to be tracked leave it as well for privacy reasons |
170 | | - if ( $wgUser->isLoggedIn() && !$wgUser->getOption ( 'OnlineStatusBar_active', $wgOnlineStatusBarDefaultEnabled ) ) { |
| 164 | + if (!OnlineStatusBar::isValid( $wgUser )) { |
171 | 165 | return false; |
172 | 166 | } |
173 | 167 | $user_status = self::getStatus( $wgUser, true ); |
174 | 168 | if ( $user_status == $wgOnlineStatusBarDefaultOffline ) { |
175 | | - self::updateDb(); |
| 169 | + self::updateDB(); |
176 | 170 | return true; |
177 | 171 | } |
178 | 172 | |
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBarHooks.php |
— | — | @@ -1,4 +1,8 @@ |
2 | 2 | <?php |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 4 | + echo "This is a part of mediawiki and can't be started separately"; |
| 5 | + die(); |
| 6 | +} |
3 | 7 | |
4 | 8 | /** |
5 | 9 | * Hooks for OnlineStatusBar |
— | — | @@ -43,10 +47,12 @@ |
44 | 48 | */ |
45 | 49 | public static function updateStatus() { |
46 | 50 | global $wgUser; |
47 | | - // Purge user page (optional) |
48 | | - OnlineStatusBar::purge( $wgUser ); |
49 | | - // Update status |
50 | | - OnlineStatusBar_StatusCheck::updateStatus(); |
| 51 | + if ( OnlineStatusBar::isValid( $wgUser ) { |
| 52 | + // Purge user page (optional) |
| 53 | + OnlineStatusBar::purge( $wgUser ); |
| 54 | + // Update status |
| 55 | + OnlineStatusBar_StatusCheck::updateStatus(); |
| 56 | + } |
51 | 57 | return true; |
52 | 58 | } |
53 | 59 | |
— | — | @@ -58,8 +64,6 @@ |
59 | 65 | * @return bool |
60 | 66 | */ |
61 | 67 | public static function renderBar( &$article, &$outputDone, &$pcache ) { |
62 | | - $context = $article->getContext(); |
63 | | - |
64 | 68 | // Update status of all users who wants to be tracked |
65 | 69 | OnlineStatusBar_StatusCheck::updateStatus(); |
66 | 70 | |
— | — | @@ -93,6 +97,7 @@ |
94 | 98 | $image = OnlineStatusBar::getImageHtml( $status, $modetext ); |
95 | 99 | $text = wfMessage( 'onlinestatusbar-line', $user->getName() ) |
96 | 100 | ->rawParams( $image )->params( $modetext )->escaped(); |
| 101 | + $context = $article->getContext(); |
97 | 102 | $context->getOutput()->addHtml( OnlineStatusBar::getStatusBarHtml( $text ) ); |
98 | 103 | |
99 | 104 | return true; |