Skip to content

Commit

Permalink
Use of NetworkPort_NetworkPort-->add() instead of MakeConnector(). Se…
Browse files Browse the repository at this point in the history
…e release fusioninventory#47
  • Loading branch information
Vincent MAZZONI committed Apr 29, 2010
1 parent 3454f2a commit cb8bc51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion inc/port.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ function connectDB($destination_port='') {
if ($DB->numrows($resultVerif) == "0") { // no existing connection between those 2 ports
$this->disconnectDB($this->getValue('ID')); // disconnect this port
$this->disconnectDB($destination_port); // disconnect destination port
if (makeConnector($this->getValue('ID'),$destination_port)) { // connect those 2 ports
$nn = new NetworkPort_NetworkPort();
if ($nn->add(array('networkports_id_1'=> $this->getValue('ID'),
'networkports_id_2' => $destination_port))) { //connect those 2 ports
$ptap->updateProcess($_SESSION['glpi_plugin_fusioninventory_processnumber'],
array('query_nb_connections_created' => '1'));
PluginFusioninventorySnmphistory::addLogConnection("make",$this->getValue('ID'));
Expand Down
3 changes: 2 additions & 1 deletion inc/snmp.classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ function PortsConnection($source_port, $destination_port,$FK_process,$vlan="") {
$nn->delete(array('id'=>$destination_port));
}

makeConnector($source_port,$destination_port);
$nn->add(array('networkports_id_1'=> $source_port,
'networkports_id_2' => $destination_port));
PluginFusioninventorySnmphistory::addLogConnection("make",$destination_port,$FK_process);
PluginFusioninventorySnmphistory::addLogConnection("make",$source_port,$FK_process);

Expand Down
7 changes: 5 additions & 2 deletions inc/unknowndevice.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ function hubNetwork($p_oPort) {

$nw = new Netwire;
$np = new Netport;
$nn = new NetworkPort_NetworkPort();
// List of macs : $p_oPort->getPortsToConnect

// recherche dans unknown_device table le hub
Expand Down Expand Up @@ -478,7 +479,8 @@ function hubNetwork($p_oPort) {
$input["device_type"] = $this->type;
$input["name"] = "Link";
$id_port = $np->add($input);
makeConnector($p_oPort->getValue('ID'), $id_port);
$nn->add(array('networkports_id_1'=> $p_oPort->getValue('ID'),
'networkports_id_2' => $id_port));

foreach ($p_oPort->getMacsToConnect() as $ifmac) {
$input = array();
Expand All @@ -492,7 +494,8 @@ function hubNetwork($p_oPort) {
$result = $DB->query($query);
if ($DB->numrows($result) == 1) {
$line = $DB->fetch_assoc($result);
makeConnector($line['ID'], $id_port);
$nn->add(array('networkports_id_1'=> $line['ID'],
'networkports_id_2' => $id_port));
} else {
// Create device inconnu

Expand Down

0 comments on commit cb8bc51

Please sign in to comment.