From d6fe3c0cfc36ac65d8395a29e83869cba836a152 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Mon, 8 Nov 2010 16:14:12 +0000 Subject: [PATCH] 2010-11-08 Sergio Martin * util/pandora_sync_db.pl: Added two special synchronization cases git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3558 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/util/pandora_sync_db.pl | 22 ++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index c92805e4d1..19e9f5ca0c 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2010-11-08 Sergio Martin + + * util/pandora_sync_db.pl: Added two special + synchronization cases + 2010-11-08 Sergio Martin * util/pandora_sync_db.pl: Fixed array pass diff --git a/pandora_server/util/pandora_sync_db.pl b/pandora_server/util/pandora_sync_db.pl index 589b5e76a0..b247256835 100755 --- a/pandora_server/util/pandora_sync_db.pl +++ b/pandora_server/util/pandora_sync_db.pl @@ -158,6 +158,14 @@ sub pandora_sync_main ($$$) { my @types; print "\n[*] Cleaning destination database.\n"; + + # Mixed and special cases deletion + empty_table($dbh_dest, 'tlayout_data'); + if($sync_data == 1) { + empty_table($dbh_dest, 'tevento'); + } + empty_table($dbh_dest, 'treport_content'); + empty_table($dbh_dest, 'treport_content_sla_combined'); for(my $i = 0; $i <= $#{$tables_data[0]}; $i++) { empty_table($dbh_dest, $tables_data[0]->[$i]) unless !defined $tables_data[0]->[$i]; @@ -175,12 +183,6 @@ sub pandora_sync_main ($$$) { print "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b[*] $percent % Completed" unless $percent > 100; } - - # Mixed cases - empty_table($dbh_dest, 'tlayout_data'); - if($sync_data == 1) { - empty_table($dbh_dest, 'tevento'); - } print "\n\n"; @@ -199,6 +201,14 @@ sub pandora_sync_main ($$$) { enterprise_hook('sync_clone_table', [$dbh_source, $dbh_dest, 'tevento', \@columns, \@types, \@id_agent_comparation, \@id_agentmodule_comparation, \@id_server_export_comparation, \@id_server_comparation]); } + @columns = ('id_agent_module', 'id_agent'); + @types = ('module', 'agent'); + enterprise_hook('sync_clone_table', [$dbh_source, $dbh_dest, 'treport_content', \@columns, \@types, \@id_agent_comparation, \@id_agentmodule_comparation, \@id_server_export_comparation, \@id_server_comparation]); + + #Special + #This case is not mixed but is here to respect the foreing key + enterprise_hook('sync_clone_table', [$dbh_source, $dbh_dest, 'treport_content_sla_combined', 'id_agent_module', 'module', \@id_agent_comparation, \@id_agentmodule_comparation, \@id_server_export_comparation, \@id_server_comparation]); + my $errors = $errors_agents + $errors_modules + $errors_servers + $errors_exportservers; if($errors == 0) {