Handle files in Filesystem::copyThenRemove, fixes #3287
parent
2cb64c8a72
commit
2c237fdfdf
|
@ -234,6 +234,13 @@ class Filesystem
|
||||||
*/
|
*/
|
||||||
public function copyThenRemove($source, $target)
|
public function copyThenRemove($source, $target)
|
||||||
{
|
{
|
||||||
|
if (!is_dir($source)) {
|
||||||
|
copy($source, $target);
|
||||||
|
$this->unlink($source);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
|
$it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
|
||||||
$ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
|
$ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
|
||||||
$this->ensureDirectoryExists($target);
|
$this->ensureDirectoryExists($target);
|
||||||
|
|
Loading…
Reference in New Issue