Merge pull request #1122 from moteus/delete_memcache

Fix. Delete some keys from memcache
This commit is contained in:
FusionPBX 2015-08-24 08:48:22 -06:00
commit 483d2a9aeb
5 changed files with 13 additions and 8 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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