mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
merge from master
changed handling for upgrade to utilize the session event details if detect_switch is missing
This commit is contained in:
@@ -35,7 +35,14 @@ include "root.php";
|
||||
public $debug = false;
|
||||
|
||||
function __construct($domain_name, $domain_uuid, $detect_switch) {
|
||||
if(!is_a($detect_switch, 'detect_switch')){
|
||||
if($detect_switch == null){
|
||||
if(strlen($_SESSION['event_socket_ip_address']) == 0 or strlen($_SESSION['event_socket_port']) == 0 or strlen($_SESSION['event_socket_password']) == 0 ){
|
||||
throw new Exception('The parameter $detect_switch was empty and i could not find the event socket details from the session');
|
||||
}
|
||||
$detect_switch = new detect_switch($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
$domain_name = $_SESSION['domain_name'];
|
||||
$domain_uuid = $_SESSION['domain_uuid'];
|
||||
}elseif(!is_a($detect_switch, 'detect_switch')){
|
||||
throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)');
|
||||
}
|
||||
$this->domain_uuid = $domain_uuid;
|
||||
@@ -166,11 +173,10 @@ include "root.php";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function install() {
|
||||
$this->copy_conf();
|
||||
$this->copy_scripts();
|
||||
//tell freeswitch to restart
|
||||
//tell freeswitch to restart
|
||||
$this->write_progress("Restarting switch");
|
||||
$this->detect_switch->restart_switch();
|
||||
}
|
||||
@@ -182,10 +188,10 @@ include "root.php";
|
||||
function copy_conf() {
|
||||
$this->write_progress("Copying Config");
|
||||
//make a backup of the config
|
||||
if (file_exists($this->detect_switch->conf_dir())) {
|
||||
$this->backup_dir($this->detect_switch->conf_dir(), 'fusionpbx_switch_config');
|
||||
$this->recursive_delete($this->detect_switch->conf_dir());
|
||||
}
|
||||
if (file_exists($this->detect_switch->conf_dir())) {
|
||||
$this->backup_dir($this->detect_switch->conf_dir(), 'fusionpbx_switch_config');
|
||||
$this->recursive_delete($this->detect_switch->conf_dir());
|
||||
}
|
||||
//make sure the conf directory exists
|
||||
if (!is_dir($this->detect_switch->conf_dir())) {
|
||||
if (!mkdir($this->detect_switch->conf_dir(), 0774, true)) {
|
||||
@@ -236,15 +242,21 @@ include "root.php";
|
||||
|
||||
function copy_scripts() {
|
||||
$this->write_progress("Copying Scripts");
|
||||
if (file_exists($this->detect_switch->script_dir())) {
|
||||
if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
|
||||
$script_dir = $_SESSION['switch']['scripts']['dir'];
|
||||
}
|
||||
else {
|
||||
$script_dir = $this->detect_switch->script_dir();
|
||||
}
|
||||
if (file_exists($script_dir)) {
|
||||
if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){
|
||||
$src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts';
|
||||
}
|
||||
else {
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts';
|
||||
}
|
||||
$dst_dir = $this->detect_switch->script_dir();
|
||||
if (is_readable($this->detect_switch->script_dir())) {
|
||||
$dst_dir = $script_dir;
|
||||
if (is_readable($script_dir)) {
|
||||
$this->recursive_copy($src_dir, $dst_dir, $_SESSION['scripts']['options']['text']);
|
||||
unset($src_dir, $dst_dir);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user