Index: trunk/extensions/OnlineStatusBar/OnlineStatusBar.php |
— | — | @@ -85,16 +85,6 @@ |
86 | 86 | $wgAutoloadClasses['OnlineStatusBar_StatusCheck'] = "$dir/OnlineStatusBar.status.php"; |
87 | 87 | $wgAutoloadClasses['OnlineStatusBarHooks'] = "$dir/OnlineStatusBarHooks.php"; |
88 | 88 | |
89 | | -// Configuration |
90 | | -// Those values can be overriden in LocalSettings, do not change it here |
91 | | -$wgOnlineStatusBarIcon = array( |
92 | | - 'online' => 'statusgreen.png', |
93 | | - 'busy' => 'statusorange.png', |
94 | | - 'away' => 'statusorange.png', |
95 | | - 'hidden' => 'statusred.png', |
96 | | - 'offline' => 'statusred.png', |
97 | | -); |
98 | | - |
99 | 89 | // For memcached |
100 | 90 | define( 'ONLINESTATUSBAR_DELAYED_CACHE', 'd' ); |
101 | 91 | define( 'ONLINESTATUSBAR_NORMAL_CACHE', 'n' ); |
— | — | @@ -102,6 +92,9 @@ |
103 | 93 | define( 'ONLINESTATUSBAR_CK_DELAYED', 1 ); |
104 | 94 | define( 'ONLINESTATUSBAR_CK_AWAY', 2 ); |
105 | 95 | |
| 96 | + |
| 97 | +// Configuration |
| 98 | +// Those values can be overriden in LocalSettings, do not change it here |
106 | 99 | // default for anonymous and uknown users |
107 | 100 | $wgOnlineStatusBarTrackIpUsers = false; |
108 | 101 | // it's better to cron this for performance reasons |
— | — | @@ -118,7 +111,24 @@ |
119 | 112 | $wgOnlineStatusBar_LogoutTime = 3600; |
120 | 113 | // time to wait until we consider user away |
121 | 114 | $wgOnlineStatusBar_AwayTime = 15; |
| 115 | +// Cache |
| 116 | +// default 10 minutes for online |
| 117 | +$wgOnlineStatusBarCacheTime = array( |
| 118 | + 'online' => 10, |
| 119 | + 'busy' => 10, |
| 120 | + 'away' => 10, |
| 121 | + 'offline' => 60, |
| 122 | +); |
| 123 | +// Icons |
| 124 | +$wgOnlineStatusBarIcon = array( |
| 125 | + 'online' => 'statusgreen.png', |
| 126 | + 'busy' => 'statusorange.png', |
| 127 | + 'away' => 'statusorange.png', |
| 128 | + 'hidden' => 'statusred.png', |
| 129 | + 'offline' => 'statusred.png', |
| 130 | +); |
122 | 131 | |
| 132 | + |
123 | 133 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'OnlineStatusBarHooks::ckSchema'; |
124 | 134 | $wgHooks['UserLogout'][] = 'OnlineStatusBarHooks::logout'; |
125 | 135 | $wgHooks['ArticleViewHeader'][] = 'OnlineStatusBarHooks::renderBar'; |
Index: trunk/extensions/OnlineStatusBar/OnlineStatusBarHooks.php |
— | — | @@ -98,6 +98,7 @@ |
99 | 99 | $text = wfMessage( 'onlinestatusbar-line', $user->getName() ) |
100 | 100 | ->rawParams( $image )->params( $modetext )->escaped(); |
101 | 101 | $context = $article->getContext(); |
| 102 | + $context->getOutput()->updateCacheExpiry($wgOnlineStatusBarCacheTime[$status] * 60); |
102 | 103 | $context->getOutput()->addHtml( OnlineStatusBar::getStatusBarHtml( $text ) ); |
103 | 104 | |
104 | 105 | return true; |
— | — | @@ -194,7 +195,7 @@ |
195 | 196 | * @return bool |
196 | 197 | */ |
197 | 198 | public static function parserGetVariable( &$parser, &$varCache, &$index, &$ret ) { |
198 | | - global $wgOnlineStatusBar_LogoutTime; |
| 199 | + global $wgOnlineStatusBarCacheTime; |
199 | 200 | if ( $index != 'ISONLINE' ) { |
200 | 201 | return true; |
201 | 202 | } |
— | — | @@ -211,9 +212,9 @@ |
212 | 213 | return true; |
213 | 214 | } |
214 | 215 | |
215 | | - // if user is online we need to remove parser cache so that page update when status change |
216 | | - if ( $result !== false && $result[0] != 'offline' ) { |
217 | | - $parser->getOutput()->updateCacheExpiry($wgOnlineStatusBar_LogoutTime); |
| 216 | + // if user is tracked we need to remove parser cache so that page update when status change |
| 217 | + if ( $result !== false ) { |
| 218 | + $parser->getOutput()->updateCacheExpiry($wgOnlineStatusBarCacheTime[$result[0]] * 60); |
218 | 219 | } |
219 | 220 | |
220 | 221 | $ret = $result[0]; |