merged with HEAD and other interesting changes

This commit is contained in:
David Delikat 2009-03-19 04:12:03 +00:00
parent 66c6c0fae5
commit 856cc06d04
151 changed files with 7335 additions and 2602 deletions

View file

@ -0,0 +1,47 @@
package WebGUI::PassiveAnalytics::Logging;
use strict;
use WebGUI::Session;
use WebGUI::Asset;
=head1 NAME
Package WebGUI::PassiveAnalytics::Logging
=head1 DESCRIPTION
Encapsulate all logging functions in here.
=cut
#----------------------------------------------------------------------------
=head2 log ( session, asset )
Log Passive Analytics data to the db.
=head3 session
A session variable.
=head3 asset
The asset to log.
=cut
sub log {
my ($session, $asset) = @_;
return unless $session->setting->get('passiveAnalyticsEnabled');
my $assetClass = $asset->get('className');
$assetClass =~ s/^WebGUI::Asset:://;
if ( $assetClass ne 'Snippet'
&& substr($assetClass,0,4) ne 'File') {
$session->db->write(
q|INSERT INTO `passiveLog` (userId, sessionId, assetId, timestamp, url) VALUES (?,?,?,?,?)|,
[ $session->user->userId, $session->getId, $asset->getId, time(), $session->request->unparsed_uri,]
);
}
}
1;