converted passive profile log thingy to workflow
This commit is contained in:
parent
2c3b6fc785
commit
f215d28b51
5 changed files with 106 additions and 58 deletions
89
lib/WebGUI/Workflow/Activity/SummarizePassiveProfileLog.pm
Normal file
89
lib/WebGUI/Workflow/Activity/SummarizePassiveProfileLog.pm
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
package WebGUI::Workflow::Activity::SummarizePassiveProfileLog;
|
||||
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Workflow::Activity';
|
||||
use WebGUI::PassiveProfiling;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Workflow::Activity::SummarizePassiveProfileLog;
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Calculates the statistics for passive profiling so that they may be used in the AOI macros.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See WebGUI::Workflow::Activity for details on how to use any activity.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( session, definition )
|
||||
|
||||
See WebGUI::Workflow::Activity::defintion() for details.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new($session, "Workflow_Activity_SummarizePassiveProfileLog");
|
||||
push(@{$definition}, {
|
||||
name=>$i18n->get("topicName"),
|
||||
properties=> { }
|
||||
});
|
||||
return $class->SUPER::definition($session,$definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 execute ( )
|
||||
|
||||
See WebGUI::Workflow::Activity::execute() for details.
|
||||
|
||||
=cut
|
||||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
return unless ($self->session->setting->get("passiveProfilingEnabled"));
|
||||
my ($firstDate) = $self->session->db->quickArray("select min(dateOfEntry) from passiveProfileLog");
|
||||
my $sessionExpired = time() - $self->session->setting->get("sessionTimeout");
|
||||
# We process entries for registered users and expired visitor sessions
|
||||
my $sql = "select * from passiveProfileLog where userId <> 1 or (userId = 1 and dateOfEntry < ?)";
|
||||
my $sth = $self->session->db->read($sql, [$sessionExpired]);
|
||||
while (my $data = $sth->hashRef) {
|
||||
WebGUI::PassiveProfiling::summarizeAOI($self->session,$data);
|
||||
$self->session->db->write("delete from passiveProfileLog where passiveProfileLogId = ?", [$data->{passiveProfileLogId}]);
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package WebGUI::i18n::English::Workflow_Activity_SummarizePassiveProfileLog;
|
||||
|
||||
our $I18N = {
|
||||
'topicName' => {
|
||||
message => q|Summarize Passive Profile Log|,
|
||||
context => q|The name of this workflow activity.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue