|
|
@@ -661,6 +661,7 @@ class Folder
|
|
|
* - `mode` The mode to copy the files/directories with as integer, e.g. 0775.
|
|
|
* - `skip` Files/directories to skip.
|
|
|
* - `scheme` Folder::MERGE, Folder::OVERWRITE, Folder::SKIP
|
|
|
+ * - `recursive` Whether to copy recursively or not (default: true - recursive)
|
|
|
*
|
|
|
* @param array|string $options Either an array of options (see above) or a string of the destination directory.
|
|
|
* @return bool Success.
|
|
|
@@ -680,7 +681,8 @@ class Folder
|
|
|
'from' => $this->path,
|
|
|
'mode' => $this->mode,
|
|
|
'skip' => [],
|
|
|
- 'scheme' => Folder::MERGE
|
|
|
+ 'scheme' => Folder::MERGE,
|
|
|
+ 'recursive' => true
|
|
|
];
|
|
|
|
|
|
$fromDir = $options['from'];
|
|
|
@@ -723,6 +725,10 @@ class Folder
|
|
|
$this->delete($to);
|
|
|
}
|
|
|
|
|
|
+ if (is_dir($from) && $options['recursive'] === false) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
if (is_dir($from) && !file_exists($to)) {
|
|
|
$old = umask(0);
|
|
|
if (mkdir($to, $mode, true)) {
|
|
|
@@ -763,6 +769,7 @@ class Folder
|
|
|
* - `chmod` The mode to copy the files/directories with.
|
|
|
* - `skip` Files/directories to skip.
|
|
|
* - `scheme` Folder::MERGE, Folder::OVERWRITE, Folder::SKIP
|
|
|
+ * - `recursive` Whether to copy recursively or not (default: true - recursive)
|
|
|
*
|
|
|
* @param array|string $options (to, from, chmod, skip, scheme)
|
|
|
* @return bool Success
|
|
|
@@ -774,7 +781,7 @@ class Folder
|
|
|
$to = $options;
|
|
|
$options = (array)$options;
|
|
|
}
|
|
|
- $options += ['to' => $to, 'from' => $this->path, 'mode' => $this->mode, 'skip' => []];
|
|
|
+ $options += ['to' => $to, 'from' => $this->path, 'mode' => $this->mode, 'skip' => [], 'recursive' => true];
|
|
|
|
|
|
if ($this->copy($options)) {
|
|
|
if ($this->delete($options['from'])) {
|