diff --git a/resources/classes/install.php b/resources/classes/install.php
index b3e7560678..b8bb4f5ca7 100644
--- a/resources/classes/install.php
+++ b/resources/classes/install.php
@@ -37,38 +37,42 @@ include "root.php";
//$option '-n' --no-clobber
function recursive_copy($src, $dst, $option = '') {
-
- $dir = opendir($src);
- if (!$dir) {
- if (!mkdir($src, 0755, true)) {
- throw new Exception("recursive_copy() source directory '".$src."' does not exist.");
- }
+ if (file_exists('/bin/cp')) {
+ exec ('cp -R $option '.$src_dir.' '.$dst_dir);
}
- 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 {
+ $dir = opendir($src);
+ if (!$dir) {
+ if (!mkdir($src, 0755, true)) {
+ throw new Exception("recursive_copy() source directory '".$src."' does not exist.");
}
- else {
- //copy only missing files -n --no-clobber
- if ($option == '-n') {
- if (!file_exists($dst.'/'.$file)) {
- copy($src.'/'.$file, $dst.'/'.$file);
- //echo "copy(".$src."/".$file.", ".$dst."/".$file.");
\n";
+ }
+ 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 {
+ //copy only missing files -n --no-clobber
+ if ($option == '-n') {
+ if (!file_exists($dst.'/'.$file)) {
+ copy($src.'/'.$file, $dst.'/'.$file);
+ //echo "copy(".$src."/".$file.", ".$dst."/".$file.");
\n";
+ }
}
- }
- else {
- copy($src.'/'.$file, $dst.'/'.$file);
- }
+ else {
+ copy($src.'/'.$file, $dst.'/'.$file);
+ }
+ }
}
}
+ closedir($dir);
}
- closedir($dir);
}
function recursive_delete($dir) {
diff --git a/resources/install.php b/resources/install.php
index 7aa0f52cfe..c1786e62cf 100644
--- a/resources/install.php
+++ b/resources/install.php
@@ -1279,8 +1279,6 @@ if ($_POST["install_step"] == "3" && count($_POST) > 0 && strlen($_POST["persist
$install->switch_conf_dir = $switch_conf_dir;
$install->switch_scripts_dir = $switch_scripts_dir;
$install->switch_sounds_dir = $switch_sounds_dir;
- $install->recursive_delete($switch_conf_dir);
- clearstatcache();
$install->copy_conf();
$install->copy();