Fix the copy of the conf directory files during the install

This commit is contained in:
Mark Crane 2014-05-09 23:17:30 +00:00
parent 9645b2f69d
commit f4b17fd742
2 changed files with 30 additions and 41 deletions

View File

@ -91,19 +91,15 @@ include "root.php";
$this->copy_scripts(); $this->copy_scripts();
$this->copy_sounds(); $this->copy_sounds();
$this->copy_swf(); $this->copy_swf();
//$this->copy_phrases();
} }
function copy_conf() { function copy_conf() {
clearstatcache(); clearstatcache();
if (file_exists($this->switch_conf_dir)) { if (file_exists($this->switch_conf_dir)) {
$src_dir = $this->switch_conf_dir; //make a backup copy of the conf directory
$dst_dir = $this->switch_conf_dir.'.orig'; $src_dir = $this->switch_conf_dir;
if ($src_dir != "/conf") { $dst_dir = $this->switch_conf_dir.'.orig';
mkdir($src_dir, 0755, true); if (is_readable($src_dir)) {
}
if (is_readable($src_dir)) {
//make a backup copy of the conf directory
if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") { if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") {
$this->recursive_copy($src_dir, $dst_dir); $this->recursive_copy($src_dir, $dst_dir);
$this->recursive_delete($this->switch_conf_dir); $this->recursive_delete($this->switch_conf_dir);
@ -112,11 +108,29 @@ include "root.php";
exec ('mv '.$src_dir.' '.$dst_dir); exec ('mv '.$src_dir.' '.$dst_dir);
//exec ('cp -RLp '.$src_dir.' '.$dst_dir); //exec ('cp -RLp '.$src_dir.' '.$dst_dir);
} }
//make sure the conf directory exists }
if (!mkdir($this->switch_conf_dir, 0755, true)) { else {
//throw new Exception("Failed to create the switch conf directory '".$this->switch_conf_dir."'. "); if ($src_dir != "/conf") {
mkdir($src_dir, 0755, true);
} }
} }
//make sure the conf directory exists
if (!mkdir($this->switch_conf_dir, 0755, true)) {
//throw new Exception("Failed to create the switch conf directory '".$this->switch_conf_dir."'. ");
}
//copy resources/templates/conf to the freeswitch conf dir
if (file_exists('/usr/share/fusionpbx/resources/templates/conf')){
$src_dir = "/usr/share/fusionpbx/resources/templates/conf";
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf";
}
$dst_dir = $this->switch_conf_dir;
if (is_readable($dst_dir)) {
$this->recursive_copy($src_dir, $dst_dir);
}
//print_r($install->result);
} }
} }
@ -180,7 +194,8 @@ include "root.php";
} }
} }
} }
// }
}
} }
function copy_swf() { function copy_swf() {
@ -198,21 +213,9 @@ include "root.php";
} }
} }
//function copy_phrases() {
// clearstatcache();
// if (file_exists($this->switch_conf_dir."/lang")) {
// $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf/lang";
// $dst_dir = $this->switch_conf_dir."/lang";
// if (is_readable($this->switch_conf_dir)) {
//
// }
// }
//}
} }
//how to use the class //how to use the class
//include "resources/classes/install.php";
//$install = new install; //$install = new install;
//$install->domain_uuid = $domain_uuid; //$install->domain_uuid = $domain_uuid;
//$install->switch_conf_dir = $switch_conf_dir; //$install->switch_conf_dir = $switch_conf_dir;

View File

@ -1279,27 +1279,13 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
$install->switch_conf_dir = $switch_conf_dir; $install->switch_conf_dir = $switch_conf_dir;
$install->switch_scripts_dir = $switch_scripts_dir; $install->switch_scripts_dir = $switch_scripts_dir;
$install->switch_sounds_dir = $switch_sounds_dir; $install->switch_sounds_dir = $switch_sounds_dir;
$install->recursive_delete($switch_conf_dir);
clearstatcache();
$install->copy_conf(); $install->copy_conf();
$install->copy(); $install->copy();
clearstatcache();
//copy resources/templates/conf to the freeswitch conf dir
if (file_exists('/usr/share/fusionpbx/resources/templates/conf')){
$src_dir = "/usr/share/fusionpbx/resources/templates/conf";
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/conf";
}
$dst_dir = $switch_conf_dir;
if (is_readable($dst_dir)) {
$install->recursive_copy($src_dir, $dst_dir);
}
//print_r($install->result);
//create the dialplan/default.xml for single tenant or dialplan/domain.xml //create the dialplan/default.xml for single tenant or dialplan/domain.xml
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/dialplan")) { if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/dialplan")) {
require_once "app/dialplan/resources/classes/dialplan.php";
$dialplan = new dialplan; $dialplan = new dialplan;
$dialplan->domain_uuid = $_SESSION["domain_uuid"]; $dialplan->domain_uuid = $_SESSION["domain_uuid"];
$dialplan->domain = $domain_name; $dialplan->domain = $domain_name;