From ff7e5323b55c1200dbbccdfec1ee4f66beb69a30 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 3 Apr 2016 09:47:58 -0600 Subject: [PATCH] Get the script_dir path from event socket. --- app/scripts/resources/classes/scripts.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/scripts/resources/classes/scripts.php b/app/scripts/resources/classes/scripts.php index ecf29e3da8..7da8aacde6 100644 --- a/app/scripts/resources/classes/scripts.php +++ b/app/scripts/resources/classes/scripts.php @@ -153,11 +153,15 @@ class scripts { $config = "/usr/local/etc/fusionpbx/config.lua"; } 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"); if(!$fout){ - throw new Exception("Failed to open '$config' for writing"); + return; } //make the config.lua