Extension:OnlineStatusBar/cs
Rozšíření OnlineStatusBar přidává na uživatelské a diskusní stránky každého uživatele, který ho povolil, malý pruh, který signalizuje, zda je daný uživatel k dispozici či nikoli.
Také vytváří magické slovo {{ISONLINE}}
, které lze použít na uživatelských stránkách ke kontrole stavu uživatele.
Je k dispozici v uživatelských preferencích.
Instalace
- Stáhněte soubor/y a vložte je do adresáře pojmenovaného
OnlineStatusBar
ve vaší složceextensions/
.
Vývojáři a přispěvatelé kódu by si místo toho měli nainstalovat rozšíření from Git pomocí:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/OnlineStatusBar - Na konec vašeho souboru LocalSettings.php přidejte následující kód:
wfLoadExtension( 'OnlineStatusBar' );
- Spusťte aktualizační skript, který automaticky provede všechny nezbytné databázové změny, jaké rozšíření vyžaduje.
- Spusťte následující SQL dotaz pro vytvoření dalších tabulek v databázi MediaWiki:
CREATE TABLE online_status (
`username` varchar(255) NOT NULL default '',
`timestamp` char(14) NOT NULL default '',
PRIMARY KEY USING HASH (`username`)
) ENGINE=MEMORY;
Pokud používáte SQLite, použijte místo toho tento SQL dotaz:
CREATE TABLE online_status (
username varchar(255) NOT NULL default '',
timestamp char(14) NOT NULL default ''
);
CREATE INDEX username ON online_status (username);
- Vyžaduje nastavení v konfiguračním souboru.
Dokončeno – Přejděte na stránku Special:Version vaší wiki a zkontrolujte, zda bylo rozšíření úspěšně nainstalováno.
Konfigurace
You may insert those parameters into LocalSettings.php:
$wgOnlineStatusBarDefaultIpUsers
– pokud chcete sledovat i uživatele IP adres$wgOnlineStatusBarDefaultOnline
– výchozí online stav$wgOnlineStatusBarDefaultOffline
– výchozí offline stav$wgOnlineStatusBarDefaultEnabled
– pokud je to ve výchozím nastavení povoleno pro všechny uživatele$wgOnlineStatusBarWriteTime
– zpoždění mezi přístupy k zápisu do databáze pro aktualizaci$wgOnlineStatusBar_LogoutTime
Dokumentace
Jak to funguje
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
Extension is using caching in order to access db only when it's necessary, memcached is required for that.
Api
New module for api called "onlinestatus" is available, you can display user online status by opening:
api.php?action=query&prop=onlinestatus&onlinestatususer=User
where User is username of user
Performance
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
It contains 4 classes each in separate file
OnlineStatusBarHooks
This class contains the hooks which are used.
ISONLINE
Extension also add a magic word {{isonline}} which turns to current status of user, possible states are:
- online - User is 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
Working inside the Foreground Skin
To make this extension show up at the right place inside the Foreground skin, the same skin as Wikiapiary, you need to change the following line:
On line 36 of resources/ext.onlinestatusbar.js change:
// Add status bar wrapper
$( 'h1' ).first().prepend( $statusbarFields );
to
// Add status bar wrapper
$( 'h2.title' ).first().prepend( $statusbarFields );
Cindy.cicalese, the writer of the Extension:Title Icon, found this fix.