diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php
index 5a772e023e..896ec839fe 100644
--- a/core/install/install_first_time.php
+++ b/core/install/install_first_time.php
@@ -311,8 +311,6 @@ if(!$install_step) { $install_step = 'select_language'; }
//$system->debug = true;
$system->install();
$switch->install();
- $system->app_defaults();
- $detect_switch->restart_switch();
}catch(Exception $e){
echo "\n";
echo "
Failed to install
" . $e->getMessage() . "
\n";
diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php
index 6571f15adf..b35b21f917 100644
--- a/core/install/resources/classes/install_fusionpbx.php
+++ b/core/install/resources/classes/install_fusionpbx.php
@@ -91,8 +91,13 @@ include "root.php";
$this->write_progress("\tRunning requires");
require "resources/require.php";
$this->create_menus();
+ $this->app_defaults();
$this->write_progress("Install complete for FusionPBX");
}
+
+ function upgrade() {
+ $this->app_defaults();
+ }
protected function create_config_php() {
$this->write_progress("\tCreating " . $this->config_php);
@@ -1021,7 +1026,7 @@ include "root.php";
}
}
- public function app_defaults() {
+ protected function app_defaults() {
$this->write_progress("\tRunning app_defaults");
//set needed session settings
diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php
index e2cd95dd00..c0c8215059 100644
--- a/core/install/resources/classes/install_switch.php
+++ b/core/install/resources/classes/install_switch.php
@@ -186,15 +186,17 @@ include "root.php";
$this->copy_conf();
$this->copy_scripts();
$this->create_config_lua();
+ $this->restart_switch();
$this->write_progress("Install completed for switch");
}
function upgrade() {
$this->copy_scripts();
$this->create_config_lua();
+ $this->restart_switch();
}
- function copy_conf() {
+ protected function copy_conf() {
$this->write_progress("\tCopying Config");
//make a backup of the config
if (file_exists($this->global_settings->switch_conf_dir())) {
@@ -249,7 +251,7 @@ include "root.php";
}
- function copy_scripts() {
+ protected function copy_scripts() {
$this->write_progress("\tCopying Scripts");
$script_dir = $this->global_settings->switch_script_dir();
if(strlen($script_dir) == 0) {
@@ -275,7 +277,7 @@ include "root.php";
}
}
- function create_config_lua() {
+ public function create_config_lua() {
$this->write_progress("\tCreating " . $this->config_lua);
global $db;
//get the odbc information
@@ -410,4 +412,16 @@ include "root.php";
fclose($fout);
}
}
+
+ protected function restart_switch() {
+ global $errstr;
+ $esl = new EventSocket;
+ 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: $errstr");
+ }
+ $esl->reset_fp();
+ }
?>
\ No newline at end of file