Extension talk:WhosOnline
From MediaWiki.org
Contents |
[edit] Users/Installers: Don't forget the prefix
In case your wiki uses a prefix (e.g. "mw") for the database tables, change the first line of the SQL instruction into something like:
CREATE TABLE `mw_online` (
.....
Other than that:
- This extension works fine with Mediwiki version 1.12.0
- If you want to make a quicklink from the sidebar, edit MediaWiki:Sidebar and add something like:
** Special:WhosOnline|Who is online
- Daniel / edutechwiki.unige.ch
[edit] List visitors?
I would use this extensions since it's stable and hasn't got the UNIQ problem but as a special page it's not very useful. I think most users want to integrate the stats on Main Page or another exisiting page. E.g. Guests: 75, Users (2): Bob, Paul. WHat brings me to the next point. Ignoring the anonymous visitors is what makes me ignore this extension ;)
- Btw: Works fine in 1.12 for me as well --Subfader 13:12, 12 May 2008 (UTC)
- Thanks for this nice extension!
Works also fine in my 1.12 without any fiddling, but Subfader is right: connectable to a "$footerlinks" in "MyModifiedSkin.php" it would be even better. Difficult to implement? --michael 10:00, 16 May 2008 (UTC)
- I also agree with Subfader. My wish list is integrable throughout the wiki and accounting for guests.
[edit] Having problem with sql table
I can't seem to add the sql table.
After entering this: CREATE TABLE mw_online (`userid` int(5) NOT NULL default '0',`username` varchar(255) NOT NULL default ,`timestamp` char(14) NOT NULL default , PRIMARY KEY USING HASH (`userid`, `username`),INDEX USING BTREE (`timestamp`)) TYPE=MEMORY;
I get this response -bash: syntax error near unexpected token `('
I think it's to do with the INDEX USING BTREE (`timestamp`) section.
Any ideas how to fix this?
Thanks
--LizK 09:23, 20 August 2008 (UTC)
- No idea, sorry.
- Assuming you have the extension files in $IP/extensions/WhosOnline, why don't you cd extensions/WhosOnline, edit whosonline.sql with your favorite text editor (nano, vim etc.), replace $wgDBprefix with mw_ and then run mysql -u [your mysql username here] -p [database name here] < whosonline.sql? That's a lot easier (for me, anyway) than copying and pasting stuff. :) --Sayuri 13:54, 20 August 2008 (UTC)
For $wgDBprefix, do I remove the /* */ that surrounds them too? Thanks. Fader 23:51, 26 March 2009 (UTC)
[edit] Allow inclusion of the page
This patch allows inclusion of the Special page, in a similar way to Special:Newpages (eg. {{:Special:WhosOnline}}). If you use {{:Special:WhosOnline/10/shownav}} it will only show 10 users and will have the navigation controls.
Edit WhosOnlineSpecialPage.php and change line 79:
class SpecialWhosOnline extends SpecialPage {
to
class SpecialWhosOnline extends IncludableSpecialPage {
Then go to line 111 and change the rest of the execute() function from
$pager = new PagerWhosOnline(); $body = $pager->getBody(); $wgOut->addHTML($pager->getNavigationBar()); $wgOut->addHTML('<ul>'.$body.'</ul>');
to
$pager = new PagerWhosOnline(); $shownavigation = ! $this->including(); if ( $para ) { $bits = preg_split( '/\s*,\s*/', trim( $para ) ); foreach ( $bits as $bit ) { if ( 'shownav' == $bit ) $shownavigation = true; if ( is_numeric( $bit ) ) $pager->mLimit = $bit; $m = array(); if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) $pager->mLimit = intval($m[1]); } } $body = $pager->getBody(); if ($shownavigation) $wgOut->addHTML($pager->getNavigationBar()); $wgOut->addHTML('<ul>'.$body.'</ul>');
- Wow, that works fine, Dude! Thanks a lot :-) -- Tommy us Kölle 13:59, 11 December 2009 (UTC)
[edit] I liked this one
I liked the idea behind this extension, so I modified it a little to do more of what I wanted:
Can show partial IP addresses or 'Guest', page last viewed, and keeps active users at the top of the list, with updated page info.
WhosOnline list becomes more like this:
- Ace - Special:WhosOnline
- Guest - Wiki_Top_Ten
Example of 'Guest' view mode: http://www.gshi.org/wiki/Special:WhosOnline
See WhosOnline files for info and all-done file setup with version-agreeing files: http://www.gshi.org/ugetab/Wiki/
[edit] Hack to make it work with postgres
I had to change the create table script so that the php code would work with a postgres database:
CREATE TABLE online ( userid bigint NOT NULL DEFAULT 0, username character varying(255) NOT NULL DEFAULT ''::character varying, "timestamp" bigint NOT NULL, CONSTRAINT online_pk PRIMARY KEY (userid, username) ) WITH (OIDS=FALSE); ALTER TABLE online OWNER TO mediawiki; -- Index: timestamp_idx -- DROP INDEX timestamp_idx; CREATE INDEX timestamp_idx ON online USING btree ("timestamp");
The biggest change was the type of timestamp from character to bigint.
I also had to change the php file WhosOnlineSpecialPage.php on line 107 so that it would look like this:
$db->delete('online', array('timestamp < '.$old.''), __METHOD__);
Notice all I did was remove the double-quotes. Postgres thought it should be looking for a table.
[edit] Strange Issue
I have just upgraded my mediawiki from 1.9.2 to latest 1.15.1, and also installed the whosonline page, I get a strange error that each time I view the page, it is adding my user ? i.e. I have mulitple listings of my user in the page, how can I stop these duplicates ?
Many thanks
Mark
--Mark 09:20, 20 January 2010 (UTC)This is still happening, does anyone know how I can stop duplicates appearing ? Many thanks