Make the indentation on the dialplan delete more consistent with the rest of the code base.
This commit is contained in:
parent
bb1886ad63
commit
dd51a8237b
|
|
@ -48,71 +48,72 @@ else {
|
|||
$dialplan_uuids = $_REQUEST["id"];
|
||||
$app_uuid = check_str($_REQUEST['app_uuid']);
|
||||
|
||||
if (sizeof($dialplan_uuids) > 0) {
|
||||
//delete the dialplans
|
||||
if (sizeof($dialplan_uuids) > 0) {
|
||||
|
||||
//get dialplan contexts
|
||||
foreach ($dialplan_uuids as $dialplan_uuid) {
|
||||
//get dialplan contexts
|
||||
foreach ($dialplan_uuids as $dialplan_uuid) {
|
||||
//check each
|
||||
$dialplan_uuid = check_str($dialplan_uuid);
|
||||
|
||||
//check each
|
||||
$dialplan_uuid = check_str($dialplan_uuid);
|
||||
|
||||
//get the dialplan data
|
||||
$sql = "select * from v_dialplans ";
|
||||
$sql .= "where dialplan_uuid = '".$dialplan_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$database_dialplan_uuid = $row["dialplan_uuid"];
|
||||
$dialplan_contexts[] = $row["dialplan_context"];
|
||||
//get the dialplan data
|
||||
$sql = "select * from v_dialplans ";
|
||||
$sql .= "where dialplan_uuid = '".$dialplan_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$database_dialplan_uuid = $row["dialplan_uuid"];
|
||||
$dialplan_contexts[] = $row["dialplan_context"];
|
||||
}
|
||||
unset($prep_statement);
|
||||
}
|
||||
unset($prep_statement);
|
||||
}
|
||||
|
||||
//start the atomic transaction
|
||||
$db->beginTransaction();
|
||||
//start the atomic transaction
|
||||
$db->beginTransaction();
|
||||
|
||||
//delete dialplan and details
|
||||
$dialplans_deleted = 0;
|
||||
foreach ($dialplan_uuids as $dialplan_uuid) {
|
||||
//delete dialplan and details
|
||||
$dialplans_deleted = 0;
|
||||
foreach ($dialplan_uuids as $dialplan_uuid) {
|
||||
|
||||
//delete child data
|
||||
$sql = "delete from v_dialplan_details ";
|
||||
$sql .= "where dialplan_uuid = '".$dialplan_uuid."'; ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
//delete child data
|
||||
$sql = "delete from v_dialplan_details ";
|
||||
$sql .= "where dialplan_uuid = '".$dialplan_uuid."'; ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
//delete parent data
|
||||
$sql = "delete from v_dialplans ";
|
||||
$sql .= "where dialplan_uuid = '".$dialplan_uuid."'; ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
//delete parent data
|
||||
$sql = "delete from v_dialplans ";
|
||||
$sql .= "where dialplan_uuid = '".$dialplan_uuid."'; ";
|
||||
$db->query($sql);
|
||||
unset($sql);
|
||||
|
||||
$dialplans_deleted++;
|
||||
}
|
||||
|
||||
//commit the atomic transaction
|
||||
$db->commit();
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
//strip duplicate contexts
|
||||
$dialplan_contexts = array_unique($dialplan_contexts, SORT_STRING);
|
||||
|
||||
//delete the dialplan contexts from memcache
|
||||
if (sizeof($dialplan_contexts) > 0) {
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
if ($fp) {
|
||||
foreach($dialplan_contexts as $dialplan_context) {
|
||||
$switch_cmd = "memcache delete dialplan:".$dialplan_context;
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$dialplans_deleted++;
|
||||
}
|
||||
|
||||
//commit the atomic transaction
|
||||
$db->commit();
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
//strip duplicate contexts
|
||||
$dialplan_contexts = array_unique($dialplan_contexts, SORT_STRING);
|
||||
|
||||
//delete the dialplan contexts from memcache
|
||||
if (sizeof($dialplan_contexts) > 0) {
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
if ($fp) {
|
||||
foreach($dialplan_contexts as $dialplan_context) {
|
||||
$switch_cmd = "memcache delete dialplan:".$dialplan_context;
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//redirect the browser
|
||||
$_SESSION["message"] = $text['message-delete'].(($dialplans_deleted > 1) ? ": ".$dialplans_deleted : null);
|
||||
header("Location: ".PROJECT_PATH."/app/dialplan/dialplans.php".(($app_uuid != '') ? "?app_uuid=".$app_uuid : null));
|
||||
|
||||
$_SESSION["message"] = $text['message-delete'].(($dialplans_deleted > 1) ? ": ".$dialplans_deleted : null);
|
||||
header("Location: ".PROJECT_PATH."/app/dialplan/dialplans.php".(($app_uuid != '') ? "?app_uuid=".$app_uuid : null));
|
||||
?>
|
||||
Loading…
Reference in New Issue