Update the memcache reference to use the new cache PHP class.

This commit is contained in:
Mark Crane 2015-01-16 00:21:02 +00:00
parent 495f4a0226
commit bee6b9ae5e
32 changed files with 207 additions and 231 deletions

View File

@ -49,41 +49,37 @@ else {
//delete the extension //delete the extension
if (strlen($id)>0) { if (strlen($id)>0) {
//read the call_block_number
$sql = " select c.call_block_number, d.domain_name from v_call_block as c ";
$sql .= "JOIN v_domains as d ON c.domain_uuid=d.domain_uuid ";
$sql .= "where c.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and c.call_block_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll();
$result_count = count($result);
if ($result_count > 0) {
$call_block_number = $result[0]["call_block_number"];
$domain_name = $result[0]["domain_name"];
//read the call_block_number //clear the cache
$sql = " select c.call_block_number, d.domain_name from v_call_block as c "; $cache = new cache;
$sql .= "JOIN v_domains as d ON c.domain_uuid=d.domain_uuid "; $cache->delete("app:call_block:".$domain_name.":".$call_block_number);
$sql .= "where c.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and c.call_block_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll();
$result_count = count($result);
if ($result_count > 0) {
$call_block_number = $result[0]["call_block_number"];
$domain_name = $result[0]["domain_name"];
//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 app:call_block:".$domain_name.":".$call_block_number;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
} }
} unset ($prep_statement, $sql);
unset ($prep_statement, $sql);
$sql = "delete from v_call_block "; //delete the call block
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql = "delete from v_call_block ";
$sql .= "and call_block_uuid = '$id' "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare(check_sql($sql)); $sql .= "and call_block_uuid = '$id' ";
$prep_statement->execute(); $prep_statement = $db->prepare(check_sql($sql));
unset($prep_statement, $sql); $prep_statement->execute();
unset($prep_statement, $sql);
} }
//redirect the browser
$_SESSION["message"] = $text['label-delete-complete']; $_SESSION["message"] = $text['label-delete-complete'];
header("Location: call_block.php"); header("Location: call_block.php");
return; return;
?> ?>

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -172,12 +172,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$call_block_number = $result[0]["call_block_number"]; $call_block_number = $result[0]["call_block_number"];
$domain_name = $result[0]["domain_name"]; $domain_name = $result[0]["domain_name"];
//delete extension from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("app:call_block:".$domain_name.":".$call_block_number);
$switch_cmd = "memcache delete app:call_block:".$domain_name.":".$call_block_number;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
} }
unset ($prep_statement, $sql); unset ($prep_statement, $sql);

View File

@ -85,6 +85,10 @@ if (strlen($id) > 0) {
$db->query($sql); $db->query($sql);
unset($sql); unset($sql);
//clear the cache
$cache = new cache;
$cache->delete("memcache delete dialplan:".$_SESSION["context"]);
//syncrhonize configuration //syncrhonize configuration
save_dialplan_xml(); save_dialplan_xml();
@ -92,8 +96,8 @@ if (strlen($id) > 0) {
$_SESSION["reload_xml"] = true; $_SESSION["reload_xml"] = true;
} }
//redirect the browser
$_SESSION["message"] = $text['message-delete']; $_SESSION["message"] = $text['message-delete'];
header("Location: call_center_queues.php"); header("Location: call_center_queues.php");
return; return;
?> ?>

View File

@ -283,12 +283,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//syncrhonize the configuration //syncrhonize the configuration
save_call_center_xml(); save_call_center_xml();
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("memcache delete dialplan:".$_SESSION["context"]);
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
$_SESSION["message"] = $text['message-update']; $_SESSION["message"] = $text['message-update'];
} //if ($action == "update") } //if ($action == "update")

View File

@ -342,12 +342,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//apply settings reminder //apply settings reminder
$_SESSION["reload_xml"] = true; $_SESSION["reload_xml"] = true;
//delete the cache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("memcache delete dialplan:".$call_flow_context);
$switch_cmd = "memcache delete dialplan:".$call_flow_context;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//set the message //set the message
if ($action == "add") { if ($action == "add") {

View File

@ -372,12 +372,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
//delete extension from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("memcache delete directory:".$extension."@".$_SESSION['domain_name']);
$switch_cmd = "memcache delete directory:".$extension."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the user //redirect the user
$_SESSION["message"] = $text['confirm-update']; $_SESSION["message"] = $text['confirm-update'];

View File

@ -78,12 +78,9 @@ if (strlen($id)>0) {
$db->query($sql); $db->query($sql);
unset($sql); unset($sql);
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$_SESSION["context"]);
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//syncrhonize configuration //syncrhonize configuration
save_dialplan_xml(); save_dialplan_xml();

View File

@ -259,12 +259,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "and dialplan_uuid = '$dialplan_uuid' "; $sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql); $db->query($sql);
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']);
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//save the xml //save the xml
save_dialplan_xml(); save_dialplan_xml();

View File

@ -84,18 +84,15 @@ if (strlen($id)>0) {
//apply settings reminder //apply settings reminder
$_SESSION["reload_xml"] = true; $_SESSION["reload_xml"] = true;
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$_SESSION["context"]);
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
} }
//redirect the browser
$_SESSION["message"] = $text['confirm-delete']; $_SESSION["message"] = $text['confirm-delete'];
header("Location: conferences.php"); header("Location: conferences.php");
return; return;
?> ?>

View File

@ -279,15 +279,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//apply settings reminder //apply settings reminder
$_SESSION["reload_xml"] = true; $_SESSION["reload_xml"] = true;
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$_SESSION["context"]);
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
header("Location: conferences.php"); //redirect the browser
return; header("Location: conferences.php");
return;
} //if ($_POST["persistformvar"] != "true") } //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -93,12 +93,9 @@ else {
//synchronize the xml config //synchronize the xml config
save_dialplan_xml(); save_dialplan_xml();
//clear memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$destination_context);
$switch_cmd = "memcache delete dialplan:".$destination_context;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the user //redirect the user
$_SESSION["message"] = $text['message-delete']; $_SESSION["message"] = $text['message-delete'];

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2013-2014 Portions created by the Initial Developer are Copyright (C) 2013-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):

View File

@ -100,14 +100,11 @@ else {
//strip duplicate contexts //strip duplicate contexts
$dialplan_contexts = array_unique($dialplan_contexts, SORT_STRING); $dialplan_contexts = array_unique($dialplan_contexts, SORT_STRING);
//delete the dialplan contexts from memcache //clear the cache
$cache = new cache;
if (sizeof($dialplan_contexts) > 0) { if (sizeof($dialplan_contexts) > 0) {
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); foreach($dialplan_contexts as $dialplan_context) {
if ($fp) { $cache->delete("dialplan:".$dialplan_context);
foreach($dialplan_contexts as $dialplan_context) {
$switch_cmd = "memcache delete dialplan:".$dialplan_context;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
} }
} }
} }

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2014 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010-2014 Copyright (C) 2010-2015
All Rights Reserved. All Rights Reserved.
Contributor(s): Contributor(s):

View File

@ -647,12 +647,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//commit the atomic transaction //commit the atomic transaction
$count = $db->exec("COMMIT;"); //returns affected rows $count = $db->exec("COMMIT;"); //returns affected rows
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:public");
$switch_cmd = "memcache delete dialplan:public";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//synchronize the xml config //synchronize the xml config
save_dialplan_xml(); save_dialplan_xml();

View File

@ -45,7 +45,6 @@ else {
//show the header //show the header
require_once "resources/header.php"; require_once "resources/header.php";
$document['title'] = $text['title-dialplan-outbound-add']; $document['title'] = $text['title-dialplan-outbound-add'];
require_once "resources/paging.php"; require_once "resources/paging.php";
//get the http post values and set theme as php variables //get the http post values and set theme as php variables
@ -62,8 +61,8 @@ else {
$gateway = check_str($_POST["gateway"]); $gateway = check_str($_POST["gateway"]);
$limit = check_str($_POST["limit"]); $limit = check_str($_POST["limit"]);
$accountcode = check_str($_POST["accountcode"]); $accountcode = check_str($_POST["accountcode"]);
$toll_allow_enable = check_str($_POST["toll_allow_enabled"]); $toll_allow_enable = check_str($_POST["toll_allow_enabled"]);
//set default to enabled //set default to enabled
if (strlen($toll_allow_enable) == 0) { $toll_allow_enable = "false"; } if (strlen($toll_allow_enable) == 0) { $toll_allow_enable = "false"; }
@ -532,19 +531,17 @@ else {
} //end for each } //end for each
} }
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$dialplan_context);
$switch_cmd = "memcache delete dialplan:".$dialplan_context;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//synchronize the xml config //synchronize the xml config
save_dialplan_xml(); save_dialplan_xml();
$_SESSION["message"] = $text['message-update']; //redirect the browser
header("Location: ".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3"); $_SESSION["message"] = $text['message-update'];
return; header("Location: ".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3");
return;
} //end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) } //end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
?> ?>

View File

@ -41,10 +41,24 @@ else {
} }
//check for the id //check for the id
if (count($_GET)>0) { if (count($_GET) > 0) {
$id = $_GET["id"]; $id = check_str($_GET["id"]);
} }
if (strlen($id)>0) { if (strlen($id) > 0) {
//get the user_context
$sql = "select extension, user_context from v_extensions ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and extension_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$extension = $row["extension"];
$user_context = $row["user_context"];
}
unset ($prep_statement);
//delete the extension //delete the extension
$sql = "delete from v_extensions "; $sql = "delete from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
@ -60,17 +74,20 @@ else {
$prep_statement->execute(); $prep_statement->execute();
unset($prep_statement, $sql); unset($prep_statement, $sql);
//clear the cache
$cache = new cache;
$cache->delete("directory:".$extension."@".$user_context);
//synchronize configuration //synchronize configuration
if (is_readable($_SESSION['switch']['extensions']['dir'])) { if (is_readable($_SESSION['switch']['extensions']['dir'])) {
require_once "app/extensions/resources/classes/extension.php";
$extension = new extension; $extension = new extension;
$extension->xml(); $extension->xml();
} }
} }
//redirect the browser
$_SESSION["message"] = $text['message-delete']; $_SESSION["message"] = $text['message-delete'];
header("Location: extensions.php"); header("Location: extensions.php");
return; return;
?> ?>

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2008-2014 All Rights Reserved. Copyright (C) 2008-2015 All Rights Reserved.
Contributor(s): Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
@ -659,12 +659,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$ext = new extension; $ext = new extension;
} }
//delete extension from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("directory:".$extension."@".$user_context);
$switch_cmd = "memcache delete directory:".$extension."@".$user_context;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
} }
//show the action and redirect the user //show the action and redirect the user

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -46,7 +46,7 @@ else {
} }
//delete the fax extension //delete the fax extension
if (strlen($fax_uuid)>0) { if (strlen($fax_uuid) > 0) {
//get the dialplan uuid //get the dialplan uuid
$sql = "select * from v_fax "; $sql = "select * from v_fax ";
@ -87,12 +87,9 @@ else {
//apply settings reminder //apply settings reminder
$_SESSION["reload_xml"] = true; $_SESSION["reload_xml"] = true;
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$_SESSION["context"]);
$switch_cmd .= "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
} }
//redirect the user //redirect the user

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -516,12 +516,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//apply settings reminder //apply settings reminder
$_SESSION["reload_xml"] = true; $_SESSION["reload_xml"] = true;
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$_SESSION["context"]);
$switch_cmd .= "memcache delete dialplan:".$_SESSION["context"];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the browser //redirect the browser
if ($action == "update" && permission_exists('fax_extension_edit')) { if ($action == "update" && permission_exists('fax_extension_edit')) {

View File

@ -273,12 +273,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config //synchronize the xml config
save_dialplan_xml(); save_dialplan_xml();
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$_SESSION["context"]);
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the user //redirect the user
$_SESSION["message"] = $text['message-add']; $_SESSION["message"] = $text['message-add'];

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -71,12 +71,9 @@ else {
} }
unset ($prep_statement); unset ($prep_statement);
//delete extension from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("directory:".$extension."@".$_SESSION['domain_name']);
$switch_cmd = "memcache delete directory:".$extension."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the user //redirect the user
$_SESSION["message"] = $text['message-delete']; $_SESSION["message"] = $text['message-delete'];

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2008-2012 All Rights Reserved. Copyright (C) 2008-2015 All Rights Reserved.
Contributor(s): Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
@ -147,12 +147,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} }
} }
//delete extension from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("directory:".$extension."@".$_SESSION['domain_name']);
$switch_cmd = "memcache delete directory:".$extension."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//set message and redirect user //set message and redirect user
if ($action == "add") { if ($action == "add") {

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -40,9 +40,10 @@ else {
$text[$key] = $value[$_SESSION['domain']['language']['code']]; $text[$key] = $value[$_SESSION['domain']['language']['code']];
} }
if (count($_GET) > 0) { //get the id
$id = check_str($_GET["id"]); if (count($_GET) > 0) {
} $id = check_str($_GET["id"]);
}
if (strlen($id) > 0) { if (strlen($id) > 0) {
//include the ivr menu class //include the ivr menu class
@ -56,12 +57,9 @@ if (strlen($id) > 0) {
//synchronize the xml config //synchronize the xml config
save_dialplan_xml(); save_dialplan_xml();
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$_SESSION["context"]);
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
} }
//redirect the user //redirect the user

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2013 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -229,12 +229,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} }
} }
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$_SESSION["context"]);
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the user //redirect the user
$_SESSION["message"] = $text['message-update']; $_SESSION["message"] = $text['message-update'];

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -95,12 +95,9 @@ else {
//apply settings reminder //apply settings reminder
$_SESSION["reload_xml"] = true; $_SESSION["reload_xml"] = true;
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$ring_group_context);
$switch_cmd = "memcache delete dialplan:".$ring_group_context;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
} }
//redirect the user //redirect the user

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2010-2014 Portions created by the Initial Developer are Copyright (C) 2010-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -290,12 +290,9 @@ else {
//apply settings reminder //apply settings reminder
$_SESSION["reload_xml"] = true; $_SESSION["reload_xml"] = true;
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$ring_group_context);
$switch_cmd = "memcache delete dialplan:".$ring_group_context;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//set the message //set the message
if ($action == "add") { if ($action == "add") {

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -45,6 +45,20 @@ if (count($_GET)>0) {
} }
if (strlen($id)>0) { if (strlen($id)>0) {
//get the details fo the sip profile
$sql = "select * from v_sip_profiles ";
$sql .= "where sip_profile_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll();
foreach ($result as &$row) {
$sip_profile_name = $row["sip_profile_name"];
$sip_profile_hostname = $row["sip_profile_hostname"];
$sip_profile_description = $row["sip_profile_description"];
}
unset ($prep_statement);
//delete the sip profile settings //delete the sip profile settings
$sql = "delete from v_sip_profile_settings "; $sql = "delete from v_sip_profile_settings ";
$sql .= "where sip_profile_uuid = '$id' "; $sql .= "where sip_profile_uuid = '$id' ";
@ -69,12 +83,18 @@ if (strlen($id)>0) {
//apply settings reminder //apply settings reminder
$_SESSION["reload_xml"] = true; $_SESSION["reload_xml"] = true;
//delete the sip profiles from memcache //get the hostname
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if ($sip_profile_name == nul) {
if ($fp) { $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$switch_cmd = "memcache delete configuration:sofia.conf"; if ($fp) {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd); $switch_cmd = "hostname";
$sip_profile_name = event_socket_request($fp, 'api '.$switch_cmd);
}
} }
//clear the cache
$cache = new cache;
$cache->delete("configuration:sofia.conf:".$sip_profile_name);
} }
//redirect the browser //redirect the browser

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -123,13 +123,19 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql); unset($sql);
} //if ($action == "update") } //if ($action == "update")
//delete the sip profiles from memcache //get the hostname
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if ($sip_profile_name == nul) {
if ($fp) { $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$switch_cmd = "memcache delete configuration:sofia.conf:$sip_profile_hostname"; if ($fp) {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd); $switch_cmd = "hostname";
$sip_profile_hostname = event_socket_request($fp, 'api '.$switch_cmd);
}
} }
//clear the cache
$cache = new cache;
$cache->delete("configuration:sofia.conf:".$sip_profile_hostname);
//redirect the browser //redirect the browser
$_SESSION["message"] = $text['message-update']; $_SESSION["message"] = $text['message-update'];
header("Location: sip_profiles.php"); header("Location: sip_profiles.php");

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -514,12 +514,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config //synchronize the xml config
save_dialplan_xml(); save_dialplan_xml();
//delete the dialplan context from memcache //clear the cache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $cache = new cache;
if ($fp) { $cache->delete("dialplan:".$_SESSION["context"]);
$switch_cmd = "memcache delete dialplan:".$_SESSION["context"];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the browser //redirect the browser
$_SESSION["message"] = $text['confirm-update-complete']; $_SESSION["message"] = $text['confirm-update-complete'];

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2014 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):