Update scripts.php
This commit is contained in:
parent
81f7d44547
commit
8b5c8bd055
|
|
@ -97,31 +97,32 @@ if (!class_exists('scripts')) {
|
||||||
*/
|
*/
|
||||||
public function copy_files() {
|
public function copy_files() {
|
||||||
if (is_array($_SESSION['switch']['scripts'])) {
|
if (is_array($_SESSION['switch']['scripts'])) {
|
||||||
$dst_dir = $_SESSION['switch']['scripts']['dir'];
|
$destination_directory = $_SESSION['switch']['scripts']['dir'];
|
||||||
if (file_exists($dst_dir)) {
|
if (file_exists($destination_directory)) {
|
||||||
//get the source directory
|
//get the source directory
|
||||||
if (file_exists('/usr/share/examples/fusionpbx/scripts')) {
|
if (file_exists('/usr/share/examples/fusionpbx/scripts')) {
|
||||||
$src_dir = '/usr/share/examples/fusionpbx/scripts';
|
$source_directory = '/usr/share/examples/fusionpbx/scripts';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts';
|
$source_directory = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts';
|
||||||
}
|
}
|
||||||
if (is_readable($dst_dir)) {
|
if (is_readable($source_directory)) {
|
||||||
recursive_copy($src_dir,$dst_dir);
|
//copy the main scripts
|
||||||
unset($src_dir);
|
recursive_copy($source_directory,$destination_directory);
|
||||||
|
unset($source_directory);
|
||||||
// Copy the app/*/resource/install/scripts
|
|
||||||
|
//copy the app/*/resource/install/scripts
|
||||||
$app_scripts = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'app/*/resource/install/scripts');
|
$app_scripts = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'app/*/resource/install/scripts');
|
||||||
foreach ($app_scripts as $app_script){
|
foreach ($app_scripts as $app_script){
|
||||||
recursive_copy($app_script, $dst_dir);
|
recursive_copy($app_script, $destination_directory);
|
||||||
}
|
}
|
||||||
unset($app_scripts);
|
unset($app_scripts);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Exception("Cannot read from '$src_dir' to get the scripts");
|
throw new Exception("Cannot read from '$source_directory' to get the scripts");
|
||||||
}
|
}
|
||||||
chmod($dst_dir, 0775);
|
chmod($destination_directory, 0775);
|
||||||
unset($dst_dir);
|
unset($destination_directory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -340,4 +341,4 @@ if (!class_exists('scripts')) {
|
||||||
$obj->write_config();
|
$obj->write_config();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue