0.3.14
This commit is contained in:
parent
aad2c4da9a
commit
6b5f8c8927
@ -86,79 +86,74 @@ if($_SERVER['REQUEST_METHOD'] == 'POST'){
|
|||||||
$peerDepth = $cable['remote_object_depth'];
|
$peerDepth = $cable['remote_object_depth'];
|
||||||
$peerPort = $cable['remote_object_port'];
|
$peerPort = $cable['remote_object_port'];
|
||||||
$localAttrPrefix = $cable['localAttrPrefix'];
|
$localAttrPrefix = $cable['localAttrPrefix'];
|
||||||
|
|
||||||
|
// Remove any populated port entries that may exist
|
||||||
|
$qls->SQL->delete(
|
||||||
|
'app_populated_port',
|
||||||
|
array(
|
||||||
|
'object_id' => array('=', $elementID),
|
||||||
|
'AND',
|
||||||
|
'object_face' => array('=', $elementFace),
|
||||||
|
'AND',
|
||||||
|
'object_depth' => array('=', $elementDepth),
|
||||||
|
'AND',
|
||||||
|
'port_id' => array('=', $elementPort)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if($qls->App->loopDetected2($peerID, $peerFace, $peerDepth, $peerPort, $elementID, $elementFace, $elementDepth, $elementPort)) {
|
// Clear any inventory entries
|
||||||
$errMsg = 'Loop detected.';
|
if (isset($qls->App->inventoryArray[$elementID][$elementFace][$elementDepth][$elementPort])) {
|
||||||
array_push($validate->returnData['error'], $errMsg);
|
foreach($qls->App->inventoryArray[$elementID][$elementFace][$elementDepth][$elementPort] as $inventoryEntry) {
|
||||||
} else {
|
$rowID = $inventoryEntry['rowID'];
|
||||||
|
$localAttrPrefix = $inventoryEntry['localAttrPrefix'];
|
||||||
// Remove any populated port entries that may exist
|
|
||||||
$qls->SQL->delete(
|
if ($inventoryEntry['localEndID'] == 0) {
|
||||||
'app_populated_port',
|
|
||||||
array(
|
|
||||||
'object_id' => array('=', $elementID),
|
|
||||||
'AND',
|
|
||||||
'object_face' => array('=', $elementFace),
|
|
||||||
'AND',
|
|
||||||
'object_depth' => array('=', $elementDepth),
|
|
||||||
'AND',
|
|
||||||
'port_id' => array('=', $elementPort)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Clear any inventory entries
|
|
||||||
if (isset($qls->App->inventoryArray[$elementID][$elementFace][$elementDepth][$elementPort])) {
|
|
||||||
foreach($qls->App->inventoryArray[$elementID][$elementFace][$elementDepth][$elementPort] as $inventoryEntry) {
|
|
||||||
$rowID = $inventoryEntry['rowID'];
|
|
||||||
$localAttrPrefix = $inventoryEntry['localAttrPrefix'];
|
|
||||||
|
|
||||||
if ($inventoryEntry['localEndID'] == 0) {
|
// Found entry is not a managed cable... delete
|
||||||
|
$qls->SQL->delete('app_inventory', array('id' => array('=', $rowID)));
|
||||||
// Found entry is not a managed cable... delete
|
} else {
|
||||||
$qls->SQL->delete('app_inventory', array('id' => array('=', $rowID)));
|
|
||||||
} else {
|
// Found entry is a managed cable... zeroize
|
||||||
|
$qls->SQL->update(
|
||||||
// Found entry is a managed cable... zeroize
|
'app_inventory',
|
||||||
$qls->SQL->update(
|
array(
|
||||||
'app_inventory',
|
$localAttrPrefix.'_object_id' => 0,
|
||||||
array(
|
$localAttrPrefix.'_port_id' => 0,
|
||||||
$localAttrPrefix.'_object_id' => 0,
|
$localAttrPrefix.'_object_face' => 0,
|
||||||
$localAttrPrefix.'_port_id' => 0,
|
$localAttrPrefix.'_object_depth' => 0
|
||||||
$localAttrPrefix.'_object_face' => 0,
|
),
|
||||||
$localAttrPrefix.'_object_depth' => 0
|
array(
|
||||||
),
|
'id' => array('=', $rowID)
|
||||||
array(
|
)
|
||||||
'id' => array('=', $rowID)
|
);
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update connection in database
|
|
||||||
$qls->SQL->update(
|
|
||||||
'app_inventory',
|
|
||||||
array(
|
|
||||||
$localAttrPrefix.'_object_id' => $elementID,
|
|
||||||
$localAttrPrefix.'_port_id' => $elementPort,
|
|
||||||
$localAttrPrefix.'_object_face' => $elementFace,
|
|
||||||
$localAttrPrefix.'_object_depth' => $elementDepth
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'id' => array('=', $cable['rowID'])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$qls->App->inventoryByIDArray[$connectorID]['local_object_id'] = $elementID;
|
|
||||||
$qls->App->inventoryByIDArray[$connectorID]['local_object_face'] = $elementFace;
|
|
||||||
$qls->App->inventoryByIDArray[$connectorID]['local_object_depth'] = $elementDepth;
|
|
||||||
$qls->App->inventoryByIDArray[$connectorID]['local_object_port'] = $elementPort;
|
|
||||||
$cable = $qls->App->inventoryByIDArray[$connectorID];
|
|
||||||
|
|
||||||
// Retrieve connector path
|
|
||||||
$connectorFlatPath = $qls->App->buildConnectorFlatPath($cable, 'local');
|
|
||||||
$validate->returnData['success']['connectorFlatPath'] = $connectorFlatPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update connection in database
|
||||||
|
$qls->SQL->update(
|
||||||
|
'app_inventory',
|
||||||
|
array(
|
||||||
|
$localAttrPrefix.'_object_id' => $elementID,
|
||||||
|
$localAttrPrefix.'_port_id' => $elementPort,
|
||||||
|
$localAttrPrefix.'_object_face' => $elementFace,
|
||||||
|
$localAttrPrefix.'_object_depth' => $elementDepth
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'id' => array('=', $cable['rowID'])
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$qls->App->inventoryByIDArray[$connectorID]['local_object_id'] = $elementID;
|
||||||
|
$qls->App->inventoryByIDArray[$connectorID]['local_object_face'] = $elementFace;
|
||||||
|
$qls->App->inventoryByIDArray[$connectorID]['local_object_depth'] = $elementDepth;
|
||||||
|
$qls->App->inventoryByIDArray[$connectorID]['local_object_port'] = $elementPort;
|
||||||
|
$cable = $qls->App->inventoryByIDArray[$connectorID];
|
||||||
|
|
||||||
|
// Retrieve connector path
|
||||||
|
$connectorFlatPath = $qls->App->buildConnectorFlatPath($cable, 'local');
|
||||||
|
$validate->returnData['success']['connectorFlatPath'] = $connectorFlatPath;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'connectionExploreClear':
|
case 'connectionExploreClear':
|
||||||
@ -436,12 +431,6 @@ function validate($data, &$validate, &$qls){
|
|||||||
);
|
);
|
||||||
$validate->validateTrunkedEndpoint($connectionPeerArray);
|
$validate->validateTrunkedEndpoint($connectionPeerArray);
|
||||||
|
|
||||||
// Validate no loops will result
|
|
||||||
if($qls->App->loopDetected2($localID, $localFace, $localDepth, $localPort, $remoteID, $remoteFace, $remoteDepth, $remotePort)) {
|
|
||||||
$errMsg = 'Loop detected.';
|
|
||||||
array_push($validate->returnData['error'], $errMsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Does this action need to be confirmed?
|
// Does this action need to be confirmed?
|
||||||
if(!isset($data['confirmed'])) {
|
if(!isset($data['confirmed'])) {
|
||||||
if (isset($qls->App->inventoryArray[$remoteID][$remoteFace][$remoteDepth][$remotePort])) {
|
if (isset($qls->App->inventoryArray[$remoteID][$remoteFace][$remoteDepth][$remotePort])) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user