Made PassiveAnalytics upgrade code shhhh if $quiet

This commit is contained in:
Patrick Donelan 2009-03-15 01:28:43 +00:00
parent 7ad927092a
commit 96ac9d63ee

View file

@ -127,7 +127,7 @@ sub installAssetHistory {
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
sub pa_installLoggingTables { sub pa_installLoggingTables {
my $session = shift; my $session = shift;
print "\tInstall logging tables... "; print "\tInstall logging tables... " unless $quiet;
my $db = $session->db; my $db = $session->db;
$db->write(<<EOT1); $db->write(<<EOT1);
DROP TABLE IF EXISTS `passiveLog` DROP TABLE IF EXISTS `passiveLog`
@ -164,29 +164,29 @@ CREATE TABLE `bucketLog` (
`timeStamp` datetime `timeStamp` datetime
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
EOT3 EOT3
print "DONE!\n"; print "DONE!\n" unless $quiet;
} }
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Add the PassiveAnalytics Rule table # Add the PassiveAnalytics Rule table
sub pa_installPassiveAnalyticsRule { sub pa_installPassiveAnalyticsRule {
my $session = shift; my $session = shift;
print "\tInstall Passive Analytics rule table, via Crud... "; print "\tInstall Passive Analytics rule table, via Crud... " unless $quiet;
# and here's our code # and here's our code
WebGUI::PassiveAnalytics::Rule->crud_createTable($session); WebGUI::PassiveAnalytics::Rule->crud_createTable($session);
print "DONE!\n"; print "DONE!\n" unless $quiet;
} }
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Add the PassiveAnalytics Settings # Add the PassiveAnalytics Settings
sub pa_addPassiveAnalyticsSettings { sub pa_addPassiveAnalyticsSettings {
my $session = shift; my $session = shift;
print "\tInstall Passive Analytics settings... "; print "\tInstall Passive Analytics settings... " unless $quiet;
# and here's our code # and here's our code
$session->setting->add('passiveAnalyticsInterval', 300); $session->setting->add('passiveAnalyticsInterval', 300);
$session->setting->add('passiveAnalyticsDeleteDelta', 0); $session->setting->add('passiveAnalyticsDeleteDelta', 0);
$session->setting->add('passiveAnalyticsEnabled', 0); $session->setting->add('passiveAnalyticsEnabled', 0);
print "DONE!\n"; print "DONE!\n" unless $quiet;
} }
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
@ -194,7 +194,7 @@ sub pa_addPassiveAnalyticsSettings {
sub pa_addPassiveAnalyticsStatus { sub pa_addPassiveAnalyticsStatus {
my $session = shift; my $session = shift;
my $db = $session->db; my $db = $session->db;
print "\tInstall Passive Analytics status table... "; print "\tInstall Passive Analytics status table... " unless $quiet;
# and here's our code # and here's our code
$db->write(<<EOT2); $db->write(<<EOT2);
DROP TABLE if exists passiveAnalyticsStatus; DROP TABLE if exists passiveAnalyticsStatus;
@ -208,7 +208,7 @@ CREATE TABLE `passiveAnalyticsStatus` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
EOT3 EOT3
$db->write('insert into passiveAnalyticsStatus (userId) VALUES (3)'); $db->write('insert into passiveAnalyticsStatus (userId) VALUES (3)');
print "DONE!\n"; print "DONE!\n" unless $quiet;
} }
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
@ -216,7 +216,7 @@ EOT3
# for the adminConsole and the content handler # for the adminConsole and the content handler
sub pa_installPassiveAnalyticsConfig { sub pa_installPassiveAnalyticsConfig {
my $session = shift; my $session = shift;
print "\tAdd Passive Analytics entry to the config file... "; print "\tAdd Passive Analytics entry to the config file... " unless $quiet;
# Admin Bar/Console # Admin Bar/Console
my $adminConsole = $session->config->get('adminConsole'); my $adminConsole = $session->config->get('adminConsole');
if (!exists $adminConsole->{'passiveAnalytics'}) { if (!exists $adminConsole->{'passiveAnalytics'}) {
@ -234,7 +234,6 @@ sub pa_installPassiveAnalyticsConfig {
if (!isIn('WebGUI::Content::PassiveAnalytics',@{ $contentHandlers} ) ) { if (!isIn('WebGUI::Content::PassiveAnalytics',@{ $contentHandlers} ) ) {
my $contentIndex = 0; my $contentIndex = 0;
HANDLER: while ($contentIndex <= $#{ $contentHandlers } ) { HANDLER: while ($contentIndex <= $#{ $contentHandlers } ) {
print $contentHandlers->[$contentIndex]."\n";
##Insert before Operation ##Insert before Operation
if($contentHandlers->[$contentIndex] eq 'WebGUI::Content::Operation') { if($contentHandlers->[$contentIndex] eq 'WebGUI::Content::Operation') {
splice @{ $contentHandlers }, $contentIndex, 0, 'WebGUI::Content::PassiveAnalytics'; splice @{ $contentHandlers }, $contentIndex, 0, 'WebGUI::Content::PassiveAnalytics';
@ -255,14 +254,14 @@ sub pa_installPassiveAnalyticsConfig {
} }
$workflowActivities->{'None'} = [ @none ]; $workflowActivities->{'None'} = [ @none ];
$session->config->set('workflowActivities', $workflowActivities); $session->config->set('workflowActivities', $workflowActivities);
print "DONE!\n"; print "DONE!\n" unless $quiet;
} }
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Add the Passive Analytics Workflow # Add the Passive Analytics Workflow
sub pa_installWorkflow { sub pa_installWorkflow {
my $session = shift; my $session = shift;
print "\tAdd Passive Analytics Workflow... "; print "\tAdd Passive Analytics Workflow... " unless $quiet;
my $workflow = WebGUI::Workflow->create( my $workflow = WebGUI::Workflow->create(
$session, $session,
{ {
@ -278,7 +277,7 @@ sub pa_installWorkflow {
$summarize->set('title', 'Perform duration analysis'); $summarize->set('title', 'Perform duration analysis');
$bucket->set( 'title', 'Please log entries into buckets'); $bucket->set( 'title', 'Please log entries into buckets');
$workflow->set({enabled => 1}); $workflow->set({enabled => 1});
print "DONE!\n"; print "DONE!\n" unless $quiet;
} }
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------