From 2b99cb286c40d4006820a4358eaf83d8f396f416 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Fri, 25 Apr 2014 02:56:41 +0000 Subject: [PATCH] Call the XML writing function for those that need it. Clear memcache for those using XML on demand --- app/destinations/destination_delete.php | 11 +++++++++++ app/destinations/destination_edit.php | 13 +++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/destinations/destination_delete.php b/app/destinations/destination_delete.php index 2d6d6bc3d0..b402e68a6d 100644 --- a/app/destinations/destination_delete.php +++ b/app/destinations/destination_delete.php @@ -58,6 +58,7 @@ else { $result = $orm->find()->get(); foreach ($result as &$row) { $dialplan_uuid = $row["dialplan_uuid"]; + $destination_context = $row["destination_context"]; } unset ($prep_statement); @@ -83,6 +84,16 @@ else { $db->exec(check_sql($sql)); unset($sql); +//synchronize the xml config + save_dialplan_xml(); + +//clear memcache + $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); + if ($fp) { + $switch_cmd = "memcache delete dialplan:".$destination_context; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } + //redirect the user $_SESSION["message"] = $text['message-delete']; header("Location: destinations.php"); diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index e2fbc04324..0a53c35543 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -94,7 +94,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //add or update the database if ($_POST["persistformvar"] != "true") { - //get the array $dialplan_details = $_POST["dialplan_details"]; @@ -221,7 +220,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (strlen($destination_response['uuid']) > 0) { $destination_uuid = $destination_response['uuid']; } - + + //synchronize the xml config + save_dialplan_xml(); + + //clear memcache + $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); + if ($fp) { + $switch_cmd = "memcache delete dialplan:".$destination_context; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } + //redirect the user if ($action == "add") { $_SESSION["message"] = $text['message-add'];