From c19cd89bc509416e232ea487f0a3e1e7209c60e9 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Mon, 24 Aug 2015 10:34:33 +0400 Subject: [PATCH] Fix. Delete some keys from memcache --- app/call_centers/call_center_queue_delete.php | 2 +- app/call_centers/call_center_queue_edit.php | 2 +- app/call_flows/call_flow_edit.php | 2 +- app/calls/call_edit.php | 5 ++++- app/calls/resources/classes/call_forward.php | 10 ++++++---- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/call_centers/call_center_queue_delete.php b/app/call_centers/call_center_queue_delete.php index edcf624951..bad7ad96cc 100644 --- a/app/call_centers/call_center_queue_delete.php +++ b/app/call_centers/call_center_queue_delete.php @@ -86,7 +86,7 @@ if (strlen($id) > 0) { //clear the cache $cache = new cache; - $cache->delete("memcache delete dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["context"]); //synchronize configuration save_dialplan_xml(); diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index 77ab53a661..05f82c1580 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -329,7 +329,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //clear the cache $cache = new cache; - $cache->delete("memcache delete dialplan:".$_SESSION["context"]); + $cache->delete("dialplan:".$_SESSION["context"]); //set the update message $_SESSION["message"] = $text['message-update']; diff --git a/app/call_flows/call_flow_edit.php b/app/call_flows/call_flow_edit.php index 254601b5d8..1380c69912 100644 --- a/app/call_flows/call_flow_edit.php +++ b/app/call_flows/call_flow_edit.php @@ -337,7 +337,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //clear the cache $cache = new cache; - $cache->delete("memcache delete dialplan:".$call_flow_context); + $cache->delete("dialplan:".$call_flow_context); //set the message if ($action == "add") { diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php index 85e26d0ad9..b9b149b954 100644 --- a/app/calls/call_edit.php +++ b/app/calls/call_edit.php @@ -379,7 +379,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //clear the cache $cache = new cache; - $cache->delete("memcache delete directory:".$extension."@".$_SESSION['domain_name']); + $cache->delete("directory:".$extension."@".$_SESSION['domain_name']); + if(strlen($number_alias) > 0){ + $cache->delete("directory:".$number_alias."@".$_SESSION['domain_name']); + } //redirect the user $_SESSION["message"] = $text['confirm-update']; diff --git a/app/calls/resources/classes/call_forward.php b/app/calls/resources/classes/call_forward.php index 9b7fe294f7..74688572ed 100644 --- a/app/calls/resources/classes/call_forward.php +++ b/app/calls/resources/classes/call_forward.php @@ -35,6 +35,7 @@ include "root.php"; public $domain_name; public $extension_uuid; private $extension; + private $number_alias; public $forward_all_destination; public $forward_all_enabled; private $dial_string; @@ -58,6 +59,7 @@ include "root.php"; if (count($result) > 0) { foreach ($result as &$row) { $this->extension = $row["extension"]; + $this->number_alias = $row["number_alias"]; $this->accountcode = $row["accountcode"]; $this->toll_allow = $row["toll_allow"]; $this->outbound_caller_id_name = $row["outbound_caller_id_name"]; @@ -155,10 +157,10 @@ include "root.php"; unset($sql); //delete extension from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete directory:".$this->extension."@".$this->domain_name; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + $cache = new cache; + $cache->delete("directory:".$this->extension."@".$this->domain_name); + if(strlen($this->number_alias) > 0){ + $cache->delete("directory:".$this->number_alias."@".$this->domain_name); } } //function