From 0d8de71e1320bc744721ddfd0a84f8b3b63e2fae Mon Sep 17 00:00:00 2001 From: Junichi Satoh Date: Wed, 20 May 2015 16:38:49 +0900 Subject: [PATCH] Fixed error with open source version (without enterprise). (cherry picked from commit 64a595cd4d86cd50b30e567f4caa0471ba63616c) --- pandora_server/util/pandora_db.pl | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 305a9412c1..20e25fd80a 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -214,19 +214,22 @@ sub pandora_purgedb ($$) { } log_message ('', "\n"); - log_message ('PURGE', "Deleting validated events from tmetaconsole_event_history.", ''); - $events_to_delete = get_db_value ($dbh, "SELECT COUNT(*) FROM tmetaconsole_event_history WHERE estado = 1"); - while($events_to_delete > 0) { - db_do($dbh, "DELETE FROM tmetaconsole_event_history WHERE estado = 1 LIMIT ?", $BIG_OPERATION_STEP); - $events_to_delete = $events_to_delete - $BIG_OPERATION_STEP; + if (defined($conf->{'_enterprise_installed'}) && $conf->{'_enterprise_installed'} eq '1' && + defined($conf->{'_metaconsole'}) && $conf->{'_metaconsole'} eq '1'){ + log_message ('PURGE', "Deleting validated events from tmetaconsole_event_history.", ''); + $events_to_delete = get_db_value ($dbh, "SELECT COUNT(*) FROM tmetaconsole_event_history WHERE estado = 1"); + while($events_to_delete > 0) { + db_do($dbh, "DELETE FROM tmetaconsole_event_history WHERE estado = 1 LIMIT ?", $BIG_OPERATION_STEP); + $events_to_delete = $events_to_delete - $BIG_OPERATION_STEP; - # Mark the progress - log_message ('', "."); + # Mark the progress + log_message ('', "."); - # Do not overload the MySQL server - usleep (10000); + # Do not overload the MySQL server + usleep (10000); + } + log_message ('', "\n"); } - log_message ('', "\n"); } else { log_message ('PURGE', 'event_purge is set to 0. Old events will not be deleted.');