1
0
Fork 0

Handle files in Filesystem::copyThenRemove, fixes #3287

pull/3291/merge
Jordi Boggiano 2014-09-22 15:09:55 +01:00
parent 2cb64c8a72
commit 2c237fdfdf
1 changed files with 7 additions and 0 deletions

View File

@ -234,6 +234,13 @@ class Filesystem
*/
public function copyThenRemove($source, $target)
{
if (!is_dir($source)) {
copy($source, $target);
$this->unlink($source);
return;
}
$it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
$ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
$this->ensureDirectoryExists($target);