mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Prevent two agents from being each other's parents.
This commit is contained in:
parent
c98a4be8fa
commit
121c3a1af8
@ -997,10 +997,14 @@ sub connect_pandora_agents($$$$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Update parents.
|
# Update parents.
|
||||||
if (!defined($PARENTS{$agent_2->{'id_agente'}})) {
|
if (!defined($PARENTS{$agent_2->{'id_agente'}}) &&
|
||||||
|
(!defined($PARENTS{$agent_1->{'id_agente'}}) ||
|
||||||
|
$PARENTS{$agent_1->{'id_agente'}} != $agent_2->{'id_agente'})) {
|
||||||
$PARENTS{$agent_2->{'id_agente'}} = $agent_1->{'id_agente'};
|
$PARENTS{$agent_2->{'id_agente'}} = $agent_1->{'id_agente'};
|
||||||
db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_1->{'id_agente'}, $agent_2->{'id_agente'});
|
db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_1->{'id_agente'}, $agent_2->{'id_agente'});
|
||||||
} elsif (!defined($PARENTS{$agent_1->{'id_agente'}})) {
|
} elsif (!defined($PARENTS{$agent_1->{'id_agente'}}) &&
|
||||||
|
(!defined($PARENTS{$agent_2->{'id_agente'}}) ||
|
||||||
|
$PARENTS{$agent_2->{'id_agente'}} != $agent_1->{'id_agente'})) {
|
||||||
$PARENTS{$agent_1->{'id_agente'}} = $agent_2->{'id_agente'};
|
$PARENTS{$agent_1->{'id_agente'}} = $agent_2->{'id_agente'};
|
||||||
db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_2->{'id_agente'}, $agent_1->{'id_agente'});
|
db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_2->{'id_agente'}, $agent_1->{'id_agente'});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user