Get the script_dir path from event socket.

This commit is contained in:
markjcrane 2016-04-03 09:47:58 -06:00
parent 194dccfd93
commit df9d78a11f
1 changed files with 6 additions and 2 deletions

View File

@ -153,11 +153,15 @@ class scripts {
$config = "/usr/local/etc/fusionpbx/config.lua"; $config = "/usr/local/etc/fusionpbx/config.lua";
} }
else { else {
$config = $_SESSION['switch']['scripts']['dir']."/resources/config.lua"; //connect to event socket
$esl = new event_socket;
$esl->connect($this->event_socket_ip_address, $this->event_socket_port, $this->event_socket_password);
$script_dir = trim($esl->request('api global_getvar script_dir'));
$config = $script_dir."/resources/config.lua";
} }
$fout = fopen($config,"w"); $fout = fopen($config,"w");
if(!$fout){ if(!$fout){
throw new Exception("Failed to open '$config' for writing"); return;
} }
//make the config.lua //make the config.lua