Add an enable button, to disable Logging.
Refactor out logging code into its own module for cleanliness.
This commit is contained in:
parent
f676bfc536
commit
4df4862c68
4 changed files with 23 additions and 10 deletions
|
|
@ -18,6 +18,7 @@ use strict;
|
|||
use LWP::MediaTypes qw(guess_media_type);
|
||||
use Time::HiRes;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::PassiveAnalytics::Logging;
|
||||
|
||||
use Apache2::Const -compile => qw(OK);
|
||||
|
||||
|
|
@ -171,15 +172,7 @@ sub page {
|
|||
}
|
||||
}
|
||||
##Passive Analytics Logging
|
||||
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,]
|
||||
);
|
||||
}
|
||||
WebGUI::PassiveAnalytics::Logging::log($session, $asset);
|
||||
|
||||
$output = tryAssetMethod($session,$asset,$method);
|
||||
$output = tryAssetMethod($session,$asset,"view") unless ($output || ($method eq "view"));
|
||||
|
|
|
|||
|
|
@ -425,6 +425,12 @@ sub www_settings {
|
|||
label => $i18n->get('Delete Delta Table?'),
|
||||
hoverHelp => $i18n->get('Delete Delta Table? help'),
|
||||
);
|
||||
$f->yesNo(
|
||||
name => 'enabled',
|
||||
value => $session->form->get('enabled') || $session->setting->get('passiveAnalyticsEnabled') || 0,
|
||||
label => $i18n->get('Enabled?'),
|
||||
hoverHelp => $i18n->get('Enabled? help'),
|
||||
);
|
||||
$f->submit();
|
||||
my $ac = WebGUI::AdminConsole->new($session,'passiveAnalytics');
|
||||
$ac->addSubmenuItem($session->url->page('op=passiveAnalytics;func=editRuleflow'), $i18n->get('Passive Analytics'));
|
||||
|
|
@ -445,6 +451,7 @@ sub www_settingsSave {
|
|||
my $form = $session->form;
|
||||
$session->setting->set('passiveAnalyticsInterval', $form->process('pauseInterval', 'integer'));
|
||||
$session->setting->set('passiveAnalyticsDeleteDelta', $form->process('deleteDelta', 'yesNo' ));
|
||||
$session->setting->set('passiveAnalyticsEnabled', $form->process('enabled', 'yesNo' ));
|
||||
return www_settings($session);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,6 +123,18 @@ home\?func=match, or<br />
|
|||
context => q|Button label to begin analyzing the logs.|
|
||||
},
|
||||
|
||||
'Enabled?' => {
|
||||
message => q|Enable Passive Analytics?|,
|
||||
lastUpdated => 0,
|
||||
context => q||
|
||||
},
|
||||
|
||||
'Enabled? help' => {
|
||||
message => q|Passive Analytics will do no logging until enabled.|,
|
||||
lastUpdated => 0,
|
||||
context => q||
|
||||
},
|
||||
|
||||
'Regular Expression Error:' => {
|
||||
message => q|Regular Expression Error:|,
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
|
|
@ -95,13 +95,14 @@ sub installPassiveAnalyticsRule {
|
|||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the PassiveAnalytics Rule table
|
||||
# Add the PassiveAnalytics Settings
|
||||
sub addPassiveAnalyticsSettings {
|
||||
my $session = shift;
|
||||
print "\tInstall Passive Analytics settings... ";
|
||||
# and here's our code
|
||||
$session->setting->add('passiveAnalyticsInterval', 300);
|
||||
$session->setting->add('passiveAnalyticsDeleteDelta', 0);
|
||||
$session->setting->add('passiveAnalyticsEnabled', 0);
|
||||
print "DONE!\n";
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue