ActionLog

Summary: Maintain a page log of wiki actions
Version: 2006-08-03
Status: Stable
Prerequisites: pmwiki-2.1.10
Maintainer: Dfaure
License: See terms in php file
Discussion: ActionLog-Talk
Users: +3 (View / Edit)

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-2023-08-16.phpΔ to the cookbook directory (rename it) 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

See discussion at ActionLog-Talk

User notes +3: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.