Jump to content

Extension:OnlineStatusBar

From mediawiki.org
This page is a translated version of the page Extension:OnlineStatusBar and the translation is 21% complete.
MediaWiki 拡張機能マニュアル
OnlineStatusBar
リリースの状態: 安定
実装 利用者アクティビティ
説明 Adds little bar with icon indicating whether user is online or not on user page.
作者 Petr Bena
最新バージョン 1.2.0 (2019-12-08)
互換性の方針 MediaWiki とともにリリースされるスナップショット。 master には後方互換性がありません。
データベースの変更 はい
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
  • $wgOnlineStatusBarDefaultOnline
  • $wgOnlineStatusBar_WriteTime
  • $wgOnlineStatusBarDefaultOffline
  • $wgOnlineStatusBar_LogoutTime
  • $wgOnlineStatusBarCacheTime
  • $wgOnlineStatusBarTrackIpUsers
  • $wgOnlineStatusBar_AwayTime
  • $wgOnlineStatusBarAutoDelete
  • $wgOnlineStatusBarDefaultEnabled
translatewiki.net で翻訳を利用できる場合は、OnlineStatusBar 拡張機能の翻訳にご協力ください
問題点 未解決のタスク · バグを報告

The OnlineStatusBar extension 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.

インストール

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.
  • ダウンロードして、ファイルをextensions/フォルダー内のOnlineStatusBarという名前のディレクトリ内に配置します。
    開発者とコード寄稿者は、上記の代わりに以下を使用してGitからインストールします:
    cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/OnlineStatusBar
    
  • 以下のコードを LocalSettings.php ファイルの末尾に追加します:
    wfLoadExtension( 'OnlineStatusBar' );
    
  • 更新スクリプトを実行します。このスクリプトは、この拡張機能が必要とするデータベーステーブルを自動的に作成します。
  • 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 '',
PRIMARY KEY USING HASH (`username`)
) ENGINE=MEMORY;

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

CREATE TABLE online_status (
username varchar(255) NOT NULL default '',
timestamp char(14) NOT NULL default ''
);
CREATE INDEX username ON online_status (username);

設定

You may insert those parameters into LocalSettings.php:

  • $wgOnlineStatusBarDefaultIpUsersif you want to track also ip users
  • $wgOnlineStatusBarDefaultOnlinedefault online status
  • $wgOnlineStatusBarDefaultOfflinedefault offline status
  • $wgOnlineStatusBarDefaultEnabledif it's enabled for all users as default
  • $wgOnlineStatusBarWriteTimedelay between database write access for update
  • $wgOnlineStatusBar_LogoutTime

説明文書

動作の仕組み

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:

キャッシュ

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

パフォーマンス

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.

クラス

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.