fixes during upgrade

This commit is contained in:
Matthew Vale
2015-12-02 15:55:21 +00:00
parent 120ea2cc40
commit 31619d8747
2 changed files with 38 additions and 33 deletions
@@ -78,7 +78,7 @@ require_once "root.php";
protected $_switch_sip_profiles_vdir = ''; protected $_switch_sip_profiles_vdir = '';
protected $_switch_dialplan_vdir = ''; protected $_switch_dialplan_vdir = '';
protected $_switch_backup_vdir = ''; protected $_switch_backup_vdir = '';
public function switch_voicemail_vdir() { return $this->_switch_voicemail_vdir; } public function switch_voicemail_vdir() { return $this->_switch_voicemail_vdir; }
public function switch_phrases_vdir() { return $this->_switch_phrases_vdir; } public function switch_phrases_vdir() { return $this->_switch_phrases_vdir; }
public function switch_extensions_vdir() { return $this->_switch_extensions_vdir; } public function switch_extensions_vdir() { return $this->_switch_extensions_vdir; }
public function switch_sip_profiles_vdir() { return $this->_switch_sip_profiles_vdir; } public function switch_sip_profiles_vdir() { return $this->_switch_sip_profiles_vdir; }
@@ -104,24 +104,24 @@ require_once "root.php";
protected $_db_create; protected $_db_create;
protected $_db_create_username; protected $_db_create_username;
protected $_db_create_password; protected $_db_create_password;
public function db_type() {return $this->_db_type; } public function db_type() { return $this->_db_type; }
public function db_path() {return $this->_db_path; } public function db_path() { return $this->_db_path; }
public function db_host() {return $this->_db_host; } public function db_host() { return $this->_db_host; }
public function db_port() {return $this->_db_port; } public function db_port() { return $this->_db_port; }
public function db_name() {return $this->_db_name; } public function db_name() { return $this->_db_name; }
public function db_username() {return $this->_db_username; } public function db_username() { return $this->_db_username; }
public function db_password() {return $this->_db_password; } public function db_password() { return $this->_db_password; }
public function db_create() {return $this->_db_create; } public function db_create() { return $this->_db_create; }
public function db_create_username() {return $this->_db_create_username; } public function db_create_username() { return $this->_db_create_username; }
public function db_create_password() {return $this->_db_create_password; } public function db_create_password() { return $this->_db_create_password; }
//misc information //misc information
protected $_domain_uuid; protected $_domain_uuid;
protected $_domain_name; protected $_domain_name;
protected $_domain_count; protected $_domain_count;
public function domain_uuid() {return $this->_domain_uuid; } public function domain_uuid() { return $this->_domain_uuid; }
public function domain_name() {return $this->_domain_name; } public function domain_name() { return $this->_domain_name; }
public function domain_count() {return $this->_domain_count; } public function domain_count() { return $this->_domain_count; }
public function set_domain_uuid($domain_uuid) { public function set_domain_uuid($domain_uuid) {
$e = new Exception(); $e = new Exception();
$trace = $e->getTrace(); $trace = $e->getTrace();
@@ -143,17 +143,20 @@ require_once "root.php";
} }
foreach ($this->_switch_dirs as $dir){ foreach ($this->_switch_dirs as $dir){
$session_var; $session_var;
preg_match( '/^switch_.*_dir$/', $dir, $session_var); preg_match( '/^switch_(.*)_dir$/', $dir, $session_var);
$this->$dir = $_SESSION['switch'][$session_var[0]]['dir']; $dir = "_$dir";
if($session_var[1] == 'script'){ $session_var[1] = 'scripts'; }
$this->$dir = $_SESSION['switch'][$session_var[1]]['dir'];
} }
foreach ($this->_switch_vdirs as $vdir){ foreach ($this->_switch_vdirs as $vdir){
$session_var; $session_var;
preg_match( '/^switch_.*_vdir$/', $vdir, $session_var); preg_match( '/^switch_(.*)_vdir$/', $vdir, $session_var);
$this->$vdir = $_SESSION['switch'][$session_var[0]]['dir']; $vdir = "_$vdir";
$this->$vdir = $_SESSION['switch'][$session_var[1]]['dir'];
} }
$this->switch_event_host = $_SESSION['event_socket_ip_address']; $this->_switch_event_host = $_SESSION['event_socket_ip_address'];
$this->switch_event_port = $_SESSION['event_socket_port']; $this->_switch_event_port = $_SESSION['event_socket_port'];
$this->switch_event_password = $_SESSION['event_socket_password']; $this->_switch_event_password = $_SESSION['event_socket_password'];
// domain info // domain info
$this->_domain_name = $_SESSION['domain_name']; $this->_domain_name = $_SESSION['domain_name'];
@@ -185,6 +188,9 @@ require_once "root.php";
$t_vdir = "_switch_$vdir"; $t_vdir = "_switch_$vdir";
$this->$t_vdir = $detect_switch->$vdir(); $this->$t_vdir = $detect_switch->$vdir();
} }
$this->_switch_event_host = $detect_switch->event_host;
$this->_switch_event_port = $detect_switch->event_port;
$this->_switch_event_password = $detect_switch->event_password;
//copy from _POST //copy from _POST
foreach($_POST as $key=>$value){ foreach($_POST as $key=>$value){
@@ -36,7 +36,7 @@ include "root.php";
function __construct($global_settings) { function __construct($global_settings) {
if(is_null($global_settings)){ if(is_null($global_settings)){
require_once "resources/classes/global_settings.php"; require_once "core/install/resources/classes/global_settings.php";
$global_settings = new global_settings(); $global_settings = new global_settings();
}elseif(!is_a($global_settings, 'global_settings')){ }elseif(!is_a($global_settings, 'global_settings')){
throw new Exception('The parameter $global_settings must be a global_settings object (or a subclass of)'); throw new Exception('The parameter $global_settings must be a global_settings object (or a subclass of)');
@@ -411,17 +411,16 @@ include "root.php";
unset($tmp); unset($tmp);
fclose($fout); fclose($fout);
} }
}
protected function restart_switch() {
protected function restart_switch() { $esl = new EventSocket;
global $errstr; if(!$esl->connect($this->global_settings->switch_event_host(), $this->global_settings->switch_event_port(), $this->global_settings->switch_event_password())) {
$esl = new EventSocket; throw new Exception("Failed to connect to switch");
if (!$esl->connect($this->event_host, $this->event_port, $this->event_password)) { }
throw new Exception("Failed to connect to switch: $errstr"); if (!$esl->request('api fsctl shutdown restart elegant')){
throw new Exception("Failed to send switch restart");
}
$esl->reset_fp();
} }
if (!$esl->request('api fsctl shutdown restart elegant')){
throw new Exception("Failed to send switch restart: $errstr");
}
$esl->reset_fp();
} }
?> ?>