Call the XML writing function for those that need it. Clear memcache for those using XML on demand

This commit is contained in:
Mark Crane
2014-04-25 02:56:41 +00:00
parent 9feccaa075
commit 2b99cb286c
2 changed files with 22 additions and 2 deletions

View File

@@ -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");

View File

@@ -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'];