Flush memcache when changing phrases.

This commit is contained in:
Mark Crane 2015-03-10 00:47:42 +00:00
parent 3406ff62b4
commit 8f224fee80
1 changed files with 81 additions and 63 deletions

View File

@ -89,6 +89,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('phrase_add')) {
//add the phrase to the database
$phrase_uuid = uuid();
$sql = "insert into v_phrases ";
$sql .= "( ";
@ -152,12 +153,20 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
}
//save the xml to the file system if the phrase directory is set
save_phrases_xml();
//delete the phrase 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 languages:".$phrase_language;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//send a redirect
$_SESSION["message"] = $text['message-add'];
header("Location: phrase_edit.php?id=".$phrase_uuid);
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('phrase_edit')) {
@ -212,8 +221,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
}
//save the xml to the file system if the phrase directory is set
save_phrases_xml();
//delete the phrase 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 languages:".$phrase_language;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//send a redirect
$_SESSION["message"] = $text['message-update'];
header("Location: phrase_edit.php?id=".$phrase_uuid);
return;