Summary: Maintain a page log of wiki actions
Version: 2006-08-03
Status: Stable
Prerequisites: pmwiki-2.1.10
Question answered by this recipe
How can I keep a trace of all actions performed on the wiki pages?
Description
This recipe will populate a Site.ActionLog? wiki page with a trace log of all the wiki activity.
Installation
Copy actionlog.phpΔ to the cookbook directory and add include_once("cookbook/actionlog.php"); to config.php.
Configuration
The following configuration parameters would allow to fine tune the log behavior:
$ActionLogPageName- The trace page name (defaults to Site.ActionLog?).
$ActionLogFilterPattern- Allows to ignore actions matching a given regular expression (defaults as undefined). For example,
'/(browse|print)/' would disable logging of browsing or print previewing actions.
$ActionLogSelfExclude- Selects whether or not the activity on the trace page itself is excluded (defaults to
1).
$ActionLogAppend- Selects whether log lines are appended or prepended to the trace page (defaults to
false).
$ActionLogLineFmt- Defines the trace log line format. The string may be a combinaison of PHP's
strftime formating parameters, PmWiki's pseudo-variables and specific tags. It defaults to the single line:
' %Y-%m-%d %H:%M:%S - REMOTE_ADDR - {$AuthId} - {$Author} - ACTION - [[TARGET]]'
Where:
REMOTE_ADDR- is the address of the user.
ACTION- is the interaction he had with...
TARGET- the page concerned.
$ActionLogLinesMax- Sets the amount of last trace lines to keep (defaults as undefined).
$ActionLogArchive- When set to
1, allows a rotating action log of $ActionLogLinesMax depth to keep past events into backup pages (defaults as undefined).
$ActionLogArchivePageName- The backup page name template. It defaults to '
$ActionLogPageName-$Now' and may contain strftime formating parameters.
$ActionLogTrackUrl- When set to
1, enables logging of followed external links.
Warnings/Limitations
- The recipe script must be included after
scripts/authuser.php or scripts/author.php to have the {$AuthId} and {$Author} wiki variables properly defined.
- The standard wiki page modification notification system is disabled during ActionLog pages updates, and so shouldn't interfere with IMS caching.
- For now, the external url tracking can't urls with parameters.
Contributor
Releases Notes
- 2005-08-26 Initial release.
- 2006-03-22 Enhanced version. Updated licensing terms.
- 2006-03-29 Updated to work after the page content has been sent to the browser (following Hagan's suggestion).
- 2006-08-03 Heavily reworked. Added backup and preliminary url tracking.
See Also
Visitors Logging
TotalCounter
Comments
Despite being PHP-illiterate, I just found that I could add the HTTP_REFERER to the range of logged data, which makes ActionLog a good statistical tool for my purposes. Thanks for the recipe! :-) --Henning August 30, 2006, at 10:45 AM
- Oops - it seems that the run time behaviour of this recipe (or PmWiki itself) is a bit of a problem as soon as extremely large files are generated. When my log file grew to 2.9 MB, all the server wound up doing was trying to update the action log while page requests remained unanswered. Might have been an obvious mistake on my part to try and gather so much data ... Fortunately, simply removing the recipe from the config.php restored server load to normal instantly. --Henning September 04, 2006, at 08
- 57 AM
Hi Dfaure. Very nice recipe you have made, I like ActionLog very much. (I removed my previous post on this page, which was quite silly, hope that's ok). I added a few lines to make it ignore all my own actions (based on REMOTE_ADDR).
global $ActionLogIgnoredAddr;
if(isset($ActionLogIgnoredAddr) &&
in_array($_SERVER['REMOTE_ADDR'], $ActionLogIgnoredAddr)) return;
Then one can specify
$ActionLogIgnoredAddr = array('some', 'ip', 'addresses', 'here');
in local config --JeeBee? February 19, 2007, at 9:47 AM.
Would it be possible to have a modified version of the script which provides a log on per-page-basis and can be included on the page? By this a dedicated page author can check his own detailed statistics rather than the whole wiki stats. This can be a motivation for authors to improve their pages or add new ones. Thanks a lot, Martin
Could the additions bij JeeBee also be used to exclude certain authors by there $AuthId?