diff --git a/core/install/install_first_time.php b/core/install/install_first_time.php
index 99f0ab043a..2a4c5ce344 100644
--- a/core/install/install_first_time.php
+++ b/core/install/install_first_time.php
@@ -311,7 +311,7 @@ if(!$install_step) { $install_step = 'select_language'; }
$fusionPBX->install();
$switch->install();
$fusionPBX->app_defaults();
- $detect_switch->restart_switch();
+ $switch_detect->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 ebfccc3de1..d72a42e4bc 100644
--- a/core/install/resources/classes/install_fusionpbx.php
+++ b/core/install/resources/classes/install_fusionpbx.php
@@ -1018,10 +1018,6 @@ include "root.php";
$_SESSION['permissions'] = $prep_statementsub->fetchAll(PDO::FETCH_NAMED);
unset($sql, $prep_statementsub);
-
-
-
-
require_once "resources/classes/schema.php";
global $db, $db_type, $db_name, $db_username, $db_password, $db_host, $db_path, $db_port;
diff --git a/core/upgrade/app_defaults.php b/core/upgrade/app_defaults.php
index a904361bb8..18edf8e23e 100644
--- a/core/upgrade/app_defaults.php
+++ b/core/upgrade/app_defaults.php
@@ -26,17 +26,6 @@
if ($domains_processed == 1) {
- //process if the scripts directory exists
- if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
- //if the resource scripts resource directory does not exist then create it
- if (!is_dir($_SESSION['switch']['scripts']['dir']."/resources")) {
- mkdir($_SESSION['switch']['scripts']['dir']."/resources",0755,true);
- }
-
- //copy the files and directories from resources/install
- $obj = new install_switch;
- $obj->upgrade();
- }
//update the software table
$sql = "select count(*) as num_rows from v_software ";
diff --git a/core/upgrade/upgrade.php b/core/upgrade/upgrade.php
index 0a882c14c1..3698ef8332 100644
--- a/core/upgrade/upgrade.php
+++ b/core/upgrade/upgrade.php
@@ -67,7 +67,10 @@
$obj = new schema;
echo $obj->schema("text");
-//run all app_defaults.php files
+//request the switch to perform upgrade functions
+ $obj = new install_switch;
+ $obj->upgrade();
+
require_once "resources/classes/domains.php";
$domain = new domains;
$domain->upgrade();