From 3151b9b74ac1896be77064c6ab481ff47f51a1f0 Mon Sep 17 00:00:00 2001 From: badcrc Date: Wed, 29 Jun 2016 03:18:28 +0200 Subject: [PATCH] Clear memcached when toggling on/off dialplans (#1717) When clicking True/False link from the dialplan list (like outbound routers for examples), the change isn't effective until the cache expires. Full editing the dialplan entry (dialplan_detail_edit.php) does this right and clears the cache, I took the code from there. --- app/dialplan/dialplans.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/dialplan/dialplans.php b/app/dialplan/dialplans.php index 56c6536073..0dcb9c7a03 100644 --- a/app/dialplan/dialplans.php +++ b/app/dialplan/dialplans.php @@ -49,6 +49,13 @@ else { unset($sql); $_SESSION["message"] = $text['message-update']; } + +//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"]; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } //set the http values as php variables $search = check_str($_REQUEST["search"]); @@ -403,4 +410,4 @@ else { unset ($val); unset ($c); -?> \ No newline at end of file +?>