Extension talk:Whos online

is there any way to show a list of users that are online?

Andy

'Refreshing' the WhosOnline results
The extension works fine but, it will not show the current status because the page that should show the status is cached. When I save that page again it is rerenderen and the correct status is shown. What I now did is set $wgEnableParserCache = false; in includes/DefaultSettings.php. surely there must be a less 'drastic' way to do this for only 1 page.

Vic

Installation step 3
Hello, I'm a bit of a n00b when it comes to these things. Installing an extension, OK, editing LocalSettings.php, fine, but editing the DB, eek! Is the PHP script as an alternative to the first part, or are they both necessary?

What exactly should I be looking for to edit the DB? In my web interface of my webhost it has links to 'restore', 'modify' and 'delete' the DB. It also has this advice: mysql -u username -ppassword -h hostname databasename for accessing a DB from the commandline. Is this what I should be doing? Any advice? :) cheers, pfctdayelise 11:32, 1 August 2006 (UTC)


 * The part labelled as "You can use the following PHP script for installing" is another users suggestion on how to not worry about building the new table manually but to have MediaWiki do it for you. I have not reviewed or tested the code at this stage and it is an alternative.  It will make the installation a lot easier for new users if MediaWiki does it for you, so I will be adding the code to the actual installation process.  If you give me 24 hours or so, I should be able to update the documentation appropriately. -- (Smcnaught) 15:33, 1 August 2006 (UTC).


 * OK that would be awesome. Thanks, I'll wait. :) --pfctdayelise 02:50, 2 August 2006 (UTC)
 * I have updated the docs. I hope that it helps you. (Smcnaught) 02:36, 4 August 2006 (UTC)

Maybe it would be a good idea to integrate the installation into function renderWhosOnline( $input ). If the first SQL-query (DELETE) fails, call an install function. Yet this would require the wiki user to have CREATE rights.

$username = $wgUser->getName; $tblname = $wgDBprefix."online";

$sql = "DELETE from $tblname WHERE username = '$username' OR timestamp < '$old' "; $db =& wfGetDB( DB_WRITE ); if ( $db !== false ) { $ret = $db->query( $sql, '', true ); } else { $ret = false; } if ( false === $ret ) { $sql = "CREATE TABLE $tblname (     `userid` int(5) NOT NULL default '0',      `username` varchar(255) NOT NULL default ,      `timestamp` varchar(255) NOT NULL default       ) TYPE=MyISAM "; $ret = wfQuery($sql, DB_WRITE, ""); }

$sql = "INSERT INTO $wgDBprefix"."online (userid,username,timestamp) VALUES ('$userid','$username','$now')"; -- Xypron 05:52, 4 August 2006 (UTC)
 * Has this been tested in your environment Xypron? (Smcnaught) 16:48, 4 August 2006 (UTC)

Allowing wikiuser to have CREATE access
Here is how you can configure your wikiuser to have CREATE access to your wikidb: [user@server extensions]$ mysql -u root -p wikidb Enter password: mysql> REVOKE ALL PRIVILEGES ON *. * FROM 'wikiuser'@'localhost'; mysql> REVOKE GRANT OPTION ON *. * FROM 'wikiuser'@ 'localhost'; mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ON *. * TO 'wikiuser'@ 'localhost'; -- (Smcnaught) 17:13, 4 August 2006 (UTC) - I am also available on irc.chekmate.org #MediaWiki

Testing...
Hmm. I put the script in my extensions folder and ran it (well, actually just put its address in my web browser. I think that's the same thing?). It told me this: Warning: array_push [function.array-push]: First argument should be an array in [...]/extensions/talkright.php on line 23 CREATE TABLE bb_online ( `userid` int(5) NOT NULL default '0', `username` varchar(255) NOT NULL default , `timestamp` varchar(255) NOT NULL default  ) TYPE=MyISAM Notice: Table bb_online created. in [...]/extensions/build_whois.php on line 26

So I'm kinda confused. It gave me a warning about an unrelated extension. (Talkright_extension)

I put &lt;whosonline&gt; on a page in my wiki to see if it worked anyway. No dice. :) It said this:

A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

(SQL query hidden)

from within function "". MySQL returned error "1146: Table 'brunswickbug.bb_cur' doesn't exist ([...])". So, there you go, I guess it didn't create it, or something weird happened...

any ideas? pfctdayelise 13:00, 4 August 2006 (UTC)
 * This was a command line script, not one to be executed by the browser.

[user@server extensions]$ php build_whois.php
 * If you execute this script from the command line it should work. I would attempt this first, but I am going to be adding Xypron's recommendation to place the table build within the actual script. (Smcnaught) 16:54, 4 August 2006 (UTC) - I am also available on irc.chekmate.org #MediaWiki

2 tags on 1 page gives error
Thanks for the nice extention.

I have a problem when putting 2 tags on one page like:

This will geve me the following result �UNIQ5b2252c1f9be61f-whosonline-4754b5f228bd3c2200000001-QINU

Guests: 0 Registered: 1 (Slagter )

Any idea on what might cause this? 80.126.111.189 14:31, 10 August 2006 (UTC)


 * Thanks but this does not seem to solve the problem. What I did next was just to put only a return $wgOut->parse('TEST'); in the function renderWhosOnline just after the line $timeperiod = 3600; # number of seconds. Still the strange output. I suspect the $wgOut->parse to be the problem.
 * I am using MediaWiki 1.7.1 and php5.1.2 on Ubuntu Linux. Since I am not a programmer this is way to deep in MediaWiki source code. I think I just have to stick to only use only one  element per page. 80.126.111.189 08:46, 15 August 2006 (UTC)

Problem when using on same page as Calendar extension
�UNIQ86c6cec5b91c52b-calendar-25468dc92042a4c000000001-QINU

Same problem as above but it seems to happen on any page using multiple extensions.

table "wiki_online" not updating
I don't know if I just never noticed it or what, but I recently upgraded from the old version (the one that didn't show you who was online) of this extension to the new version. Now it seems to always just show me as logged on. I checked the SQL tables and found "wiki_online" and I was the only entry in there. I deleted it and had everyone log back on, the only entry that repopulated was my username. Does anyone know how this can be fixed or if this is normal? I think it has something to do with this extension. Thanks!

Update
Upon closer inspection, it seems as though if I log in with a different account on my PC it updates the table ok, but anyone else using a different PC it doesn't. I've even had them log out, clear cookies/cache, and log back in...still no updates to the table. Any ideas?


 * The timeperiod is presently set to 3600 seconds (1 hour), thus it will show how many unique users have accessed the site within the last hour. The script is not meant to be accurate to the minute as a user may be online and working on creating a page but not cause any updates to the site for a long period.  It sounds like the issue you are experiencing is by design. :-) (Smcnaught 04:55, 13 October 2006 (UTC))

Update for MediaWiki 1.9.0
When using Whos Online extension, the page gives error. It seems that the line "$ti = wfStrencode($wgTitle->getDBkey);" is a problem. The function wfStrencode is not defined as global function in MDW 1.9.0 (and 1.9.1). -- Paul.D

Yes, I can confirm - same qith wfQuery. In support forums of MediaWiki I was informed that these methods are very obsolete and have been removed in 1.9.0. In 1.8.3 all was fine. I was suggested to use "methods on database objects" instead. Since I am not a MediaWiki programmer I don't know what that means. Can please anybody help? I do not update my wiki from 1.8.3 to 1.9.0 because of this highly needed extension. Thanks a lot -- 84.191.1.166 10:22, 21 January 2007 (UTC) Pyro

mm.. to avoid such errors you may do the following... insert require_once ("includes/DatabaseFunctions.php"); require_once ("extensions/WhosOnline.php"); instead of require_once ("extensions/WhosOnline.php"); as described in 6.3 chapter of installation

DatabaseFunctions.php is not included by default and was written for back-compatibility

Update for MediaWiki 1.10?
Is it possible to get an update for version 1.10? Many thanks in advance. I really like this MediaWiki extension. /Minken