From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png

Release status: stable

Implementation User activity
Description Adds little bar with icon indicating whether user is online or not on user page.
Author(s) Petr Bena
Latest version 1.0.2 (2011-11-10)
MediaWiki 1.17.0 or higher
Database changes Yes
License GPL
Hooks used


Translate the OnlineStatusBar extension if it is available at translatewiki.net

Check usage and version matrix; code metrics
Bugs: list open list all report

OnlineStatusBar adds a little bar to user and talk pages of each user who enabled it, which signalizes whether they are available or not. It also creates the magic word {{ISONLINE}} which may be used on user pages to check the status of a user. It is available in the user preferences.

Steps[edit | edit source]

Crystal Clear action build green.png Step 1: Downloading[edit | edit source]

The extension can be retrieved directly from Git [?]:

  • Browse code
  • Some extensions have tags for stable releases.
  • Each branch is associated with a past MediaWiki release. There is also a "master" branch containing the latest alpha version (might require an alpha version of MediaWiki).

Extract the snapshot and place it in the extensions/OnlineStatusBar/ directory of your MediaWiki installation.

If you are familiar with git and have shell access to your server, you can also obtain the extension as follows:

cd extensions/
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/OnlineStatusBar.git

Simple Comic rar.png Step 2: Extracting[edit | edit source]

After downloading, you need to extract the extension folder in your MediaWiki root's /extensions folder.
Example on a Unix-like OS and with the trunk version of MediaWiki:

tar -xzf OnlineStatusBar-master-5ff5c7c.tar.gz -C /var/www/mediawiki/extensions
If your wiki is on a remote server, extract the files to a temporary directory on your local computer, and then upload all of the extracted files to the extensions directory on the server.

Nuvola table.png Step 3: Add some Tables[edit | edit source]

Run the following SQL query to create additional tables in your MediaWiki's database:

CREATE TABLE online_status (
`username` VARCHAR(255) NOT NULL DEFAULT '',
`timestamp` CHAR(14) NOT NULL DEFAULT '',

If you are using SQLite, use this SQL query instead:

CREATE TABLE online_status (
username VARCHAR(255) NOT NULL DEFAULT '',
CREATE INDEX username ON online_status (username);

Symbol support vote.svg Step 4: Activating the Extension[edit | edit source]

Add the following to LocalSettings.php:


FlaggedRevs-3-1.svg Step 5: Conclusion[edit | edit source]

The extension should now be active.

Configuration[edit | edit source]

You may insert those parameters into LocalSettings.php:

  • $wgOnlineStatusBarDefaultIpUsers - if you want to track also ip users
  • $wgOnlineStatusBarDefaultOnline - default online status
  • $wgOnlineStatusBarDefaultOffline - default offline status
  • $wgOnlineStatusBarDefaultEnabled - if it's enabled for all users as default
  • $wgOnlineStatusBarWriteTime - delay between database write access for update
  • $wgOnlineStatusBar_LogoutTime

Documentation[edit | edit source]

How does it work[edit | edit source]

This extension creates a new table which contains username and last time when user opened some page. Each user has option to enable it in preferences (under Misc heading), all users who do not have it enabled are not affected and do not update this table. When user login or logout it insert / delete the record from table, expired records are frequently removed so that table is very small, users update the table everytime when they read any page so that information whether they are available is updated.

When viewing a user page where enabled it will show the current users availability like so:


Caching[edit | edit source]

Extension is using caching in order to access db only when it's necessary, memcached is required for that.

Api[edit | edit source]

New module for api called "onlinestatus" is available, you can display user online status by opening:


where User is username of user

Performance[edit | edit source]

It reads db everytime when user who has this enabled open any page (cached) in order to find if it's necessary to update timestamp, if timestamp is older than value specified in config, it's updated, thanks to that extension shouldn't write more frequently than once a 5 minutes or so.

Classes[edit | edit source]

It contains 4 classes each in separate file

OnlineStatusBarHooks[edit | edit source]

This class contains the hooks which are used.

ISONLINE[edit | edit source]

Extension also add a magic word {{isonline}} which turns to current status of user, possible states are:

  • online - User in online
  • away / busy - User is away or busy
  • unknown - User doesn't want to be tracked or it's not a user
  • offline - User is offline

See also[edit | edit source]