From 6770d15b3ca70455c3dc5c33cd3da1adf8c8c7d5 Mon Sep 17 00:00:00 2001 From: Greenbea Date: Thu, 5 Nov 2020 11:29:41 -0500 Subject: [PATCH 1/2] Fix cache delete for global dialplans --- app/dialplans/dialplan_edit.php | 3 +++ resources/classes/cache.php | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/dialplans/dialplan_edit.php b/app/dialplans/dialplan_edit.php index 3fc41d263a..72b7fa301e 100644 --- a/app/dialplans/dialplan_edit.php +++ b/app/dialplans/dialplan_edit.php @@ -267,6 +267,9 @@ //clear the cache $cache = new cache; + if ($dialplan_context == "\${domain_name}") { + $dialplan_context = "*"; + } $cache->delete("dialplan:".$dialplan_context); //set the message diff --git a/resources/classes/cache.php b/resources/classes/cache.php index 84ecf6100b..dcd1655817 100644 --- a/resources/classes/cache.php +++ b/resources/classes/cache.php @@ -145,11 +145,13 @@ class cache { event_socket_request($fp, $event); //remove the local files - if (file_exists($_SESSION['cache']['location']['text'] . "/" . $key)) { - unlink($_SESSION['cache']['location']['text'] . "/" . $key); - } - if (file_exists($_SESSION['cache']['location']['text'] . "/" . $key . ".tmp")) { - unlink($_SESSION['cache']['location']['text'] . "/" . $key . ".tmp"); + foreach (glob($_SESSION['cache']['location']['text'] . "/" . $key) as $file) { + if (file_exists($file)) { + unlink($file); + } + if (file_exists($file)) { + unlink($file . ".tmp"); + } } } From 9708c482fe67dbef48c26ab4b9a6af18129c195b Mon Sep 17 00:00:00 2001 From: agree <37550360+greenbea@users.noreply.github.com> Date: Thu, 5 Nov 2020 17:56:17 -0500 Subject: [PATCH 2/2] Update dialplan_edit.php --- app/dialplans/dialplan_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dialplans/dialplan_edit.php b/app/dialplans/dialplan_edit.php index 72b7fa301e..07c204786c 100644 --- a/app/dialplans/dialplan_edit.php +++ b/app/dialplans/dialplan_edit.php @@ -267,7 +267,7 @@ //clear the cache $cache = new cache; - if ($dialplan_context == "\${domain_name}") { + if ($dialplan_context == "\${domain_name}" or $dialplan_context == "global") { $dialplan_context = "*"; } $cache->delete("dialplan:".$dialplan_context);