Fix. `event_socket_mkdir` for Windows system. (#1724)
This commit is contained in:
parent
3ca2b832ca
commit
a6a6a1aaac
|
|
@ -1957,27 +1957,24 @@ function number_pad($number,$n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function event_socket_mkdir($dir) {
|
function event_socket_mkdir($dir) {
|
||||||
//if the handle does not exist create it
|
//connect to fs
|
||||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||||
if (!$fp) {
|
if (!$fp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//send the mkdir command to freeswitch
|
//send the mkdir command to freeswitch
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
//send the api command to check if the module exists
|
//build and send the mkdir command to freeswitch
|
||||||
$switch_cmd = "system mkdir -p '$dir'";
|
$switch_cmd = "lua mkdir.lua '$dir'";
|
||||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||||
unset($switch_cmd);
|
fclose($fp);
|
||||||
if (trim($switch_result) == "-ERR no reply") {
|
//check result
|
||||||
return true;
|
if (trim($switch_result) == "-ERR no reply") {
|
||||||
}
|
return true;
|
||||||
else {
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
//can not create directory
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
require "resources.functions.mkdir"
|
||||||
|
|
||||||
|
local path = argv[1]
|
||||||
|
|
||||||
|
if path and #path > 0 then
|
||||||
|
mkdir(path)
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue