Merge branch 'ent-4880-error-borrar-historico-datos-cli' into 'develop'

Fixed CLI delete data

See merge request artica/pandorafms!2857
This commit is contained in:
Daniel Rodriguez 2020-01-07 10:25:38 +01:00
commit 4464bf71d8
1 changed files with 9 additions and 9 deletions

View File

@ -640,9 +640,9 @@ sub pandora_delete_module_data ($$) {
my $buffer = 1000;
while(1) {
my $nd = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module);
my $ndinc = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module);
my $ndlog4x = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module);
my $nd = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos WHERE id_agente_modulo=?', $id_module);
my $ndinc = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_inc WHERE id_agente_modulo=?', $id_module);
my $ndlog4x = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_log4x WHERE id_agente_modulo=?', $id_module);
my $ndstring = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module);
my $ntot = $nd + $ndinc + $ndlog4x + $ndstring;
@ -652,19 +652,19 @@ sub pandora_delete_module_data ($$) {
}
if($nd > 0) {
db_do ($dbh, 'DELETE FROM tagente_datos WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer);
db_delete_limit($dbh, 'tagente_datos', 'id_agente_modulo='.$id_module, $buffer);
}
if($ndinc > 0) {
db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer);
db_delete_limit($dbh, 'tagente_datos_inc', 'id_agente_modulo='.$id_module, $buffer);
}
if($ndlog4x > 0) {
db_do ($dbh, 'DELETE FROM tagente_datos_log4x WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer);
db_delete_limit($dbh, 'tagente_datos_log4x', 'id_agente_modulo='.$id_module, $buffer);
}
if($ndstring > 0) {
db_do ($dbh, 'DELETE FROM tagente_datos_string WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer);
db_delete_limit($dbh, 'tagente_datos_string', 'id_agente_modulo='.$id_module, $buffer);
}
}
@ -4416,7 +4416,7 @@ sub cli_delete_data($) {
print_log "DELETING THE DATA OF THE AGENT $name\n\n";
pandora_delete_data($dbh, 'module', $id_agent);
pandora_delete_data($dbh, 'agent', $id_agent);
}
} else {
my $id_agent = get_agent_id($dbh,$name);
@ -4424,7 +4424,7 @@ sub cli_delete_data($) {
print_log "DELETING THE DATA OF THE AGENT $name\n\n";
pandora_delete_data($dbh, 'module', $id_agent);
pandora_delete_data($dbh, 'agent', $id_agent);
}
}
elsif($opt eq '-g' || $opt eq '--g') {