WikiSimpleLog
<< | Cookbook-V1 | >>
Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.
Wiki Simple Log
Goal
I run different Pmwikis on my server, where the main activity is not at all related to these wikis. Of course, I obtain from my provider the log of activities (starting with the previous day), but sorting take too long. I wanted to have an overview of activty for each of my wikis.
Furthermore, one of my wikis is reserved for a closed group of users with a group password. I provided each member with a login name and a password (in fact the same for all). Cheating is still possible, but these users are not that much inclined to experiment.
This log gives (almost in real time) for each call to the wiki:
the counter, the login name (if provided), the IP address (already given with [[$LastModifiedHost]]
), the name of the ISP closest node, the navigator, the OS, the date and time, and the referrer, when it exists.
Solution
I installed a php module in my script directory called from the local.php file. This module use two external files (located, in my case, in the same directory as pmwiki.php): one is a simple text file logcounter.txt, the other being the log, visitors.htm which can be called directly over the net.
Files
Save the following script to wikisimplelog.php
You will also need to create two empty files logcounter.txt and visitors.htm.
Installation
modify your local.php in adding towards the end:
include_once("/your_path/wikisimplelog.php");
Configuration
No further configuration.
Examples
1/ open gate: this link will lead you to a page on my site. When you click the link within that page you will access the visitor log, where the last entry should be your trace.
2/ closed group Choose your own alias, and use the password demo and click here. Again you could visit the log where the last line (reload!) should give you back the same informations plus your alias.
Updates
KT: I made a few minor cosmetical updates to this utility:
- made the script produce the code for an HTML table.
- created a "visitors.php" file that includes the "visitors.log" so it is possible to customize the look of the log.
- added a CSS to make customizations convenient.
- added a pair of lines to log the action of the user and the Wiki page he was visiting.
Here it is: Attach:visitors.tar.gz
- A live example of the modified log is here
History
- first installation in this cookbok : October, 19, 2003
- CSS update: November, 10, 2003
Contributor(s)
- Jean-Claude G. (mail: wiki at jcgg.net)
- Konstantin Tretyakov
Comments, Bugs
- It's a bit too talkative: a trace is made for each pmwiki.php call and not once per visitor. But my level in php prevents me to refine this much. On the other hand, it permits to trace when (and by who, if in a closed-group) an edit action occured.
- cheating would be more difficult if the password associated with an alias could be read from a file... My next mission?
- I just don't know anymore
pmwiki-2.3.38 -- Last modified by {{}}?