From 751b1c721c9cd6f8e2c9675c8bc486ba7a2bf323 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 16 Jan 2013 00:26:48 +0000 Subject: [PATCH] Clear memcache as needed. --- app/call_center/call_center_queue_edit.php | 14 ++++ app/call_flows/call_flow_delete.php | 7 ++ app/call_flows/call_flow_edit.php | 7 ++ .../resources/classes/switch_call_forward.php | 2 +- .../classes/switch_do_not_disturb.php | 2 +- .../resources/classes/switch_follow_me.php | 2 +- .../conference_center_delete.php | 7 ++ .../conference_center_edit.php | 7 ++ app/conferences/conference_delete.php | 8 +++ app/conferences/conference_edit.php | 51 +++++++-------- app/dialplan/dialplan_add.php | 22 +++++-- app/dialplan/dialplan_copy.php | 7 ++ app/dialplan/dialplan_delete.php | 7 ++ app/dialplan/dialplan_details_delete.php | 6 ++ app/dialplan/dialplan_details_edit.php | 15 ++++- app/dialplan/dialplan_edit.php | 7 ++ app/dialplan_inbound/dialplan_inbound_add.php | 7 ++ .../dialplan_outbound_add.php | 13 ++-- app/extensions/extension_edit.php | 2 +- app/fax/fax_delete.php | 7 ++ app/fax/fax_edit.php | 10 +++ app/fifo/fifo_add.php | 7 ++ app/fifo/fifo_delete.php | 7 ++ app/fifo/fifo_detail_delete.php | 11 +++- app/fifo/fifo_detail_edit.php | 14 ++++ app/fifo/fifo_edit.php | 14 ++++ app/gateways/gateway_delete.php | 9 ++- app/gateways/gateway_edit.php | 7 ++ app/hot_desking/extension_delete.php | 21 +++++- app/hot_desking/extension_edit.php | 22 ++++++- app/hunt_group/hunt_group_delete.php | 7 ++ app/hunt_group/hunt_group_edit.php | 7 ++ app/ivr_menu/ivr_menu_edit.php | 32 ++++------ .../resources/classes/switch_ivr_menu.php | 50 +++++++++------ app/ring_groups/ring_groups_delete.php | 12 ++++ app/ring_groups/ring_groups_edit.php | 7 ++ app/sip_profiles/sip_profiles_delete.php | 6 ++ app/sip_profiles/sip_profiles_edit.php | 64 ++++++++++--------- app/time_conditions/time_condition_add.php | 22 +++++-- includes/classes/switch_directory.php | 6 +- 40 files changed, 404 insertions(+), 131 deletions(-) diff --git a/app/call_center/call_center_queue_edit.php b/app/call_center/call_center_queue_edit.php index dbe021ec0f..fd204ede54 100644 --- a/app/call_center/call_center_queue_edit.php +++ b/app/call_center/call_center_queue_edit.php @@ -170,6 +170,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //syncrhonize the configuration save_call_center_xml(); + //delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } + //redirect the user require_once "includes/header.php"; echo "\n"; @@ -209,6 +216,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //syncrhonize the configuration save_call_center_xml(); + //delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } + //redirect the user require_once "includes/header.php"; echo "\n"; diff --git a/app/call_flows/call_flow_delete.php b/app/call_flows/call_flow_delete.php index 8195a3f5e0..cccb609d65 100644 --- a/app/call_flows/call_flow_delete.php +++ b/app/call_flows/call_flow_delete.php @@ -77,6 +77,13 @@ if (strlen($id)>0) { //apply settings reminder $_SESSION["reload_xml"] = true; + + //delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } } //redirect the user diff --git a/app/call_flows/call_flow_edit.php b/app/call_flows/call_flow_edit.php index 268d3a06b4..49bc13590a 100644 --- a/app/call_flows/call_flow_edit.php +++ b/app/call_flows/call_flow_edit.php @@ -339,6 +339,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //apply settings reminder $_SESSION["reload_xml"] = true; + //delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } + //redirect the browser require_once "includes/header.php"; echo "\n"; diff --git a/app/calls/resources/classes/switch_call_forward.php b/app/calls/resources/classes/switch_call_forward.php index 0a6388402b..86dca350e9 100644 --- a/app/calls/resources/classes/switch_call_forward.php +++ b/app/calls/resources/classes/switch_call_forward.php @@ -87,7 +87,7 @@ include "root.php"; //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_cmd = "memcache delete directory:".$this->extension."@".$this->domain_name; $switch_result = event_socket_request($fp, 'api '.$switch_cmd); } diff --git a/app/calls/resources/classes/switch_do_not_disturb.php b/app/calls/resources/classes/switch_do_not_disturb.php index 5c94c2ffd8..abb8232dfe 100644 --- a/app/calls/resources/classes/switch_do_not_disturb.php +++ b/app/calls/resources/classes/switch_do_not_disturb.php @@ -113,7 +113,7 @@ include "root.php"; //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_cmd = "memcache delete directory:".$this->extension."@".$this->domain_name; $switch_result = event_socket_request($fp, 'api '.$switch_cmd); } diff --git a/app/calls/resources/classes/switch_follow_me.php b/app/calls/resources/classes/switch_follow_me.php index ab12c50bc9..ba7ed92e81 100644 --- a/app/calls/resources/classes/switch_follow_me.php +++ b/app/calls/resources/classes/switch_follow_me.php @@ -330,7 +330,7 @@ include "root.php"; //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_cmd = "memcache delete directory:".$this->extension."@".$this->domain_name; $switch_result = event_socket_request($fp, 'api '.$switch_cmd); } diff --git a/app/conference_centers/conference_center_delete.php b/app/conference_centers/conference_center_delete.php index 720b4a5ac6..79940fd9e8 100644 --- a/app/conference_centers/conference_center_delete.php +++ b/app/conference_centers/conference_center_delete.php @@ -72,6 +72,13 @@ if (strlen($id)>0) { $db->query($sql); unset($sql); + //delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } + //syncrhonize configuration save_dialplan_xml(); diff --git a/app/conference_centers/conference_center_edit.php b/app/conference_centers/conference_center_edit.php index a72e864e2b..302760065a 100644 --- a/app/conference_centers/conference_center_edit.php +++ b/app/conference_centers/conference_center_edit.php @@ -264,6 +264,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "and dialplan_uuid = '$dialplan_uuid' "; $db->query($sql); + //delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } + //save the xml save_dialplan_xml(); diff --git a/app/conferences/conference_delete.php b/app/conferences/conference_delete.php index f67530a044..71bc27f21c 100644 --- a/app/conferences/conference_delete.php +++ b/app/conferences/conference_delete.php @@ -83,6 +83,14 @@ if (strlen($id)>0) { //apply settings reminder $_SESSION["reload_xml"] = true; + + //delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } + } //redirect the user diff --git a/app/conferences/conference_edit.php b/app/conferences/conference_edit.php index 1f8b2a10eb..2b095322ab 100644 --- a/app/conferences/conference_edit.php +++ b/app/conferences/conference_edit.php @@ -217,20 +217,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $dialplan_detail_group = '2'; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); - //save the xml - save_dialplan_xml(); - - //apply settings reminder - $_SESSION["reload_xml"] = true; - - //redirect the browser - require_once "includes/header.php"; - echo "\n"; - echo "
\n"; - echo "".$text['confirm-add']."\n"; - echo "
\n"; - require_once "includes/footer.php"; - return; } //if ($action == "add") if ($action == "update") { @@ -285,21 +271,30 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "and dialplan_uuid = '$dialplan_uuid' "; $db->query($sql); - //save the xml - save_dialplan_xml(); - - //apply settings reminder - $_SESSION["reload_xml"] = true; - - //redirect the browser - require_once "includes/header.php"; - echo "\n"; - echo "
\n"; - echo "".$text['confirm-update']."\n"; - echo "
\n"; - require_once "includes/footer.php"; - return; } //if ($action == "update") + + //save the xml + save_dialplan_xml(); + + //apply settings reminder + $_SESSION["reload_xml"] = true; + + //delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } + + //redirect the browser + require_once "includes/header.php"; + echo "\n"; + echo "
\n"; + echo "".$text['confirm-update']."\n"; + echo "
\n"; + require_once "includes/footer.php"; + return; + } //if ($_POST["persistformvar"] != "true") } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) diff --git a/app/dialplan/dialplan_add.php b/app/dialplan/dialplan_add.php index a42c02aa57..00dea0f2f8 100644 --- a/app/dialplan/dialplan_add.php +++ b/app/dialplan/dialplan_add.php @@ -240,13 +240,21 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //synchronize the xml config save_dialplan_xml(); - require_once "includes/header.php"; - echo "\n"; - echo "
\n"; - echo "Update Complete\n"; - echo "
\n"; - require_once "includes/footer.php"; - return; + //delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } + + //redirect the browser + require_once "includes/header.php"; + echo "\n"; + echo "
\n"; + echo "Update Complete\n"; + echo "
\n"; + require_once "includes/footer.php"; + return; } //end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) ?>