Change the path in the php files from includes/install to resources/install dir.
This commit is contained in:
parent
896fdb37b2
commit
a308535e4b
|
|
@ -93,7 +93,7 @@ else {
|
|||
//create the sqlite database
|
||||
if ($db_dest_type == "sqlite") {
|
||||
//sqlite database will be created when the config.php is loaded and only if the database file does not exist
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sql/sqlite.sql';
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/sqlite.sql';
|
||||
$file_contents = file_get_contents($filename);
|
||||
unset($filename);
|
||||
try {
|
||||
|
|
@ -133,7 +133,7 @@ else {
|
|||
|
||||
//create the postgres database
|
||||
if ($db_dest_type == "pgsql") {
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sql/pgsql.sql';
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/pgsql.sql';
|
||||
$file_contents = file_get_contents($filename);
|
||||
|
||||
//if $db_create_username provided, attempt to create new PG role and database
|
||||
|
|
@ -201,7 +201,7 @@ else {
|
|||
|
||||
//create the mysql database
|
||||
if ($db_dest_type == "mysql") {
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sql/mysql.sql';
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/mysql.sql';
|
||||
$file_contents = file_get_contents($filename);
|
||||
|
||||
//database connection
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
//copy the files and directories from includes/install
|
||||
require_once "includes/classes/install.php";
|
||||
//copy the files and directories from resources/install
|
||||
require_once "resources/classes/install.php";
|
||||
$install = new install;
|
||||
$install->domain_uuid = $domain_uuid;
|
||||
$install->domain_name = $domain;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,201 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2010
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
|
||||
//define the install class
|
||||
class install {
|
||||
|
||||
var $result;
|
||||
var $domain_uuid;
|
||||
var $domain;
|
||||
var $switch_conf_dir;
|
||||
var $switch_scripts_dir;
|
||||
var $switch_sounds_dir;
|
||||
|
||||
function recursive_copy($src, $dst) {
|
||||
$dir = opendir($src);
|
||||
if (!$dir) {
|
||||
if (!mkdir($src, 0755, true)) {
|
||||
throw new Exception("recursive_copy() source directory '".$src."' does not exist.");
|
||||
}
|
||||
}
|
||||
if (!is_dir($dst)) {
|
||||
if (!mkdir($dst, 0755, true)) {
|
||||
//throw new Exception("recursive_copy() failed to create destination directory '".$dst."'");
|
||||
}
|
||||
}
|
||||
while(false !== ($file = readdir($dir))) {
|
||||
if (($file != '.') && ($file != '..')) {
|
||||
if (is_dir($src.'/'.$file)) {
|
||||
$this->recursive_copy($src.'/'.$file, $dst.'/'.$file);
|
||||
}
|
||||
else {
|
||||
if (!file_exists($dst.'/'.$file)) {
|
||||
//echo "copy(".$src."/".$file.", ".$dst."/".$file.");<br />\n";
|
||||
copy($src.'/'.$file, $dst.'/'.$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
}
|
||||
|
||||
function recursive_delete($dir) {
|
||||
if (strlen($dir) > 0) {
|
||||
foreach (glob($dir) as $file) {
|
||||
if (is_dir($file)) {
|
||||
$this->recursive_delete("$file/*");
|
||||
rmdir($file);
|
||||
//echo "rm dir: ".$file."\n";
|
||||
} else {
|
||||
//echo "delete file: ".$file."\n";
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
function copy() {
|
||||
$this->copy_scripts();
|
||||
$this->copy_sounds();
|
||||
$this->copy_swf();
|
||||
$this->copy_phrases();
|
||||
}
|
||||
|
||||
function copy_conf() {
|
||||
clearstatcache();
|
||||
$src_dir = $this->switch_conf_dir;
|
||||
$dst_dir = $this->switch_conf_dir.'.orig';
|
||||
if ($src_dir != "/conf") {
|
||||
mkdir($src_dir, 0755, true);
|
||||
}
|
||||
if (is_readable($src_dir)) {
|
||||
//make a backup copy of the conf directory
|
||||
if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") {
|
||||
$this->recursive_copy($src_dir, $dst_dir);
|
||||
$this->recursive_delete($this->switch_conf_dir);
|
||||
}
|
||||
else {
|
||||
exec ('mv '.$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)) {
|
||||
//throw new Exception("Failed to create the switch conf directory '".$this->switch_conf_dir."'. ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function copy_scripts() {
|
||||
clearstatcache();
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/scripts';
|
||||
$dst_dir = $this->switch_scripts_dir;
|
||||
if (is_readable($this->switch_scripts_dir)) {
|
||||
$this->recursive_copy($src_dir, $dst_dir);
|
||||
unset($src_dir, $dst_dir);
|
||||
}
|
||||
}
|
||||
|
||||
function copy_sounds() {
|
||||
clearstatcache();
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sounds/en/us/callie/custom/8000';
|
||||
$dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/8000';
|
||||
if (is_readable($this->switch_sounds_dir)) {
|
||||
if ($handle = opendir($src_dir)) {
|
||||
$i = 0;
|
||||
$files = array();
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != ".." && is_file($src_dir.'/'.$file)) {
|
||||
if (!file_exists($dst_dir.'/'.$file) ) {
|
||||
//copy the file if it does not exist in the destination directory
|
||||
if (copy($src_dir.'/'.$file, $dst_dir.'/'.$file)) {
|
||||
$this->result['copy']['sounds']['8000'][] = "copied from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
|
||||
}
|
||||
else {
|
||||
$this->result['copy']['sounds']['8000'][] = "copy failed from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sounds/en/us/callie/custom/16000';
|
||||
$dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/16000';
|
||||
if ($handle = opendir($src_dir)) {
|
||||
$i = 0;
|
||||
$files = array();
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != ".." && is_file($src_dir.'/'.$file)) {
|
||||
if (!file_exists($dst_dir.'/'.$file) ) {
|
||||
//copy the file if it does not exist in the destination directory
|
||||
if (copy($src_dir.'/'.$file, $dst_dir.'/'.$file)) {
|
||||
$this->result['copy']['sounds']['16000'][] = "copied from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
|
||||
}
|
||||
else {
|
||||
$this->result['copy']['sounds']['16000'][] = "copy failed from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function copy_swf() {
|
||||
clearstatcache();
|
||||
$file = "slim.swf";
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/htdocs';
|
||||
$dst_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/recordings';
|
||||
if (copy($src_dir.'/'.$file, $dst_dir.'/'.$file)) {
|
||||
$this->result['copy']['swf'][] = "copied from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
|
||||
}
|
||||
else {
|
||||
$this->result['copy']['swf'][] = "copy failed from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
|
||||
}
|
||||
}
|
||||
|
||||
function copy_phrases() {
|
||||
clearstatcache();
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/includes/templates/conf/lang";
|
||||
$dst_dir = $this->switch_conf_dir."/lang";
|
||||
if (is_readable($this->switch_conf_dir)) {
|
||||
$this->recursive_copy($src_dir, $dst_dir);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//how to use the class
|
||||
//include "resources/classes/install.php";
|
||||
//$install = new install;
|
||||
//$install->domain_uuid = $domain_uuid;
|
||||
//$install->switch_conf_dir = $switch_conf_dir;
|
||||
//$install->switch_scripts_dir = $switch_scripts_dir;
|
||||
//$install->switch_sounds_dir = $switch_sounds_dir;
|
||||
//$install->copy();
|
||||
//print_r($install->result);
|
||||
?>
|
||||
|
|
@ -112,7 +112,7 @@ include "root.php";
|
|||
|
||||
function copy_scripts() {
|
||||
clearstatcache();
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/scripts';
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts';
|
||||
$dst_dir = $this->switch_scripts_dir;
|
||||
if (is_readable($this->switch_scripts_dir)) {
|
||||
$this->recursive_copy($src_dir, $dst_dir);
|
||||
|
|
@ -122,7 +122,7 @@ include "root.php";
|
|||
|
||||
function copy_sounds() {
|
||||
clearstatcache();
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sounds/en/us/callie/custom/8000';
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sounds/en/us/callie/custom/8000';
|
||||
$dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/8000';
|
||||
if (is_readable($this->switch_sounds_dir)) {
|
||||
if ($handle = opendir($src_dir)) {
|
||||
|
|
@ -143,7 +143,7 @@ include "root.php";
|
|||
}
|
||||
}
|
||||
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sounds/en/us/callie/custom/16000';
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sounds/en/us/callie/custom/16000';
|
||||
$dst_dir = $this->switch_sounds_dir.'/en/us/callie/custom/16000';
|
||||
if ($handle = opendir($src_dir)) {
|
||||
$i = 0;
|
||||
|
|
@ -168,7 +168,7 @@ include "root.php";
|
|||
function copy_swf() {
|
||||
clearstatcache();
|
||||
$file = "slim.swf";
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/htdocs';
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/htdocs';
|
||||
$dst_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/recordings';
|
||||
if (copy($src_dir.'/'.$file, $dst_dir.'/'.$file)) {
|
||||
$this->result['copy']['swf'][] = "copied from ".$src_dir."/".$file." to ".$dst_dir."/".$file."<br />\n";
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
|
|||
$schema->exec();
|
||||
|
||||
//get the contents of the sql file
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sql/sqlite.sql';
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/sqlite.sql';
|
||||
$file_contents = file_get_contents($filename);
|
||||
unset($filename);
|
||||
|
||||
|
|
@ -581,7 +581,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
|
|||
$schema->exec();
|
||||
|
||||
//get the contents of the sql file
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sql/pgsql.sql';
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/pgsql.sql';
|
||||
$file_contents = file_get_contents($filename);
|
||||
|
||||
//replace \r\n with \n then explode on \n
|
||||
|
|
@ -749,7 +749,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
|
|||
|
||||
//add the defaults data into the database
|
||||
//get the contents of the sql file
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sql/mysql.sql';
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/mysql.sql';
|
||||
$file_contents = file_get_contents($filename);
|
||||
|
||||
//replace \r\n with \n then explode on \n
|
||||
|
|
@ -1246,8 +1246,8 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
|
|||
if (!is_readable($switch_recordings_dir.'') && $switch_scripts_dir != "/recordings") { mkdir($switch_recordings_dir.'',0777,true); }
|
||||
}
|
||||
|
||||
//copy the files and directories from includes/install
|
||||
require_once "includes/classes/install.php";
|
||||
//copy the files and directories from resources/install
|
||||
require_once "resources/classes/install.php";
|
||||
$install = new install;
|
||||
$install->domain_uuid = $_SESSION["domain_uuid"];
|
||||
$install->domain = $domain_name;
|
||||
|
|
@ -1554,7 +1554,7 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
|
|||
if (strlen($db_port) == 0) { $db_port = '3306'; }
|
||||
//if (strlen($db_name) == 0) { $db_name = 'fusionpbx'; }
|
||||
|
||||
//echo "However if preferred the database can be created manually with the <a href='". echo PROJECT_PATH; ."/includes/install/sql/mysql.sql' target='_blank'>mysql.sql</a> script. ";
|
||||
//echo "However if preferred the database can be created manually with the <a href='". echo PROJECT_PATH; ."/resources/install/sql/mysql.sql' target='_blank'>mysql.sql</a> script. ";
|
||||
echo "<div id='page' align='center'>\n";
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue