Update functions.php
This commit is contained in:
parent
f1b3af3bb8
commit
d478f94bd2
|
|
@ -159,47 +159,50 @@
|
||||||
|
|
||||||
if (!function_exists('recursive_copy')) {
|
if (!function_exists('recursive_copy')) {
|
||||||
if (file_exists('/bin/cp')) {
|
if (file_exists('/bin/cp')) {
|
||||||
function recursive_copy($src, $dst, $options = '') {
|
function recursive_copy($source, $destination, $options = '') {
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') {
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') {
|
||||||
//copy -R recursive, preserve attributes for SUN
|
//copy -R recursive, preserve attributes for SUN
|
||||||
$cmd = 'cp -Rp '.$src.'/* '.$dst;
|
$cmd = 'cp -Rp '.$source.'/* '.$destination;
|
||||||
} else {
|
} else {
|
||||||
//copy -R recursive, -L follow symbolic links, -p preserve attributes for other Posix systemss
|
//copy -R recursive, -L follow symbolic links, -p preserve attributes for other Posix systemss
|
||||||
$cmd = 'cp -RLp '.$options.' '.$src.'/* '.$dst;
|
$cmd = 'cp -RLp '.$options.' '.$source.'/* '.$destination;
|
||||||
}
|
}
|
||||||
//$this->write_debug($cmd);
|
|
||||||
exec ($cmd);
|
exec ($cmd);
|
||||||
}
|
}
|
||||||
} elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
}
|
||||||
function recursive_copy($src, $dst, $options = '') {
|
elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||||
$src = normalize_path_to_os($src);
|
function recursive_copy($source, $destination, $options = '') {
|
||||||
$dst = normalize_path_to_os($dst);
|
$source = normalize_path_to_os($source);
|
||||||
exec("xcopy /E /Y \"$src\" \"$dst\"");
|
$destination = normalize_path_to_os($destination);
|
||||||
|
exec("xcopy /E /Y \"$source\" \"$destination\"");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
function recursive_copy($src, $dst, $options = '') {
|
else {
|
||||||
$dir = opendir($src);
|
|
||||||
|
function recursive_copy($source, $destination, $options = '') {
|
||||||
|
$dir = opendir($source);
|
||||||
if (!$dir) {
|
if (!$dir) {
|
||||||
throw new Exception("recursive_copy() source directory '".$src."' does not exist.");
|
throw new Exception("recursive_copy() source directory '".$source."' does not exist.");
|
||||||
}
|
}
|
||||||
if (!is_dir($dst)) {
|
if (!is_dir($destination)) {
|
||||||
if (!mkdir($dst,02770,true)) {
|
if (!mkdir($destination,02770,true)) {
|
||||||
throw new Exception("recursive_copy() failed to create destination directory '".$dst."'");
|
throw new Exception("recursive_copy() failed to create destination directory '".$destination."'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while(false !== ( $file = readdir($dir)) ) {
|
while(false !== ( $file = readdir($dir)) ) {
|
||||||
if (( $file != '.' ) && ( $file != '..' )) {
|
if (( $file != '.' ) && ( $file != '..' )) {
|
||||||
if ( is_dir($src . '/' . $file) ) {
|
if ( is_dir($source . '/' . $file) ) {
|
||||||
recursive_copy($src . '/' . $file,$dst . '/' . $file);
|
recursive_copy($source . '/' . $file,$destination . '/' . $file);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
copy($src . '/' . $file,$dst . '/' . $file);
|
copy($source . '/' . $file,$destination . '/' . $file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($dir);
|
closedir($dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('recursive_delete')) {
|
if (!function_exists('recursive_delete')) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue