| @@ 587-601 (lines=15) @@ | ||
| 584 | * @param string $targetInternalPath |
|
| 585 | * @return bool |
|
| 586 | */ |
|
| 587 | public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { |
|
| 588 | if ($sourceStorage === $this) { |
|
| 589 | return $this->rename($sourceInternalPath, $targetInternalPath); |
|
| 590 | } |
|
| 591 | ||
| 592 | $result = $this->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, true); |
|
| 593 | if ($result) { |
|
| 594 | if ($sourceStorage->is_dir($sourceInternalPath)) { |
|
| 595 | $result &= $sourceStorage->rmdir($sourceInternalPath); |
|
| 596 | } else { |
|
| 597 | $result &= $sourceStorage->unlink($sourceInternalPath); |
|
| 598 | } |
|
| 599 | } |
|
| 600 | return $result; |
|
| 601 | } |
|
| 602 | ||
| 603 | /** |
|
| 604 | * @inheritdoc |
|
| @@ 566-586 (lines=21) @@ | ||
| 563 | * @param bool $preserveMtime |
|
| 564 | * @return bool |
|
| 565 | */ |
|
| 566 | public function moveFromStorage(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = true) { |
|
| 567 | if ($sourceStorage === $this) { |
|
| 568 | return $this->rename($sourceInternalPath, $targetInternalPath); |
|
| 569 | } |
|
| 570 | ||
| 571 | // TODO clean this up once the underlying moveFromStorage in OC\Files\Storage\Wrapper\Common is fixed: |
|
| 572 | // - call $this->storage->moveFromStorage() instead of $this->copyBetweenStorage |
|
| 573 | // - copy the file cache update from $this->copyBetweenStorage to this method |
|
| 574 | // - copy the copyKeys() call from $this->copyBetweenStorage to this method |
|
| 575 | // - remove $this->copyBetweenStorage |
|
| 576 | ||
| 577 | $result = $this->copyBetweenStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime, true); |
|
| 578 | if ($result) { |
|
| 579 | if ($sourceStorage->is_dir($sourceInternalPath)) { |
|
| 580 | $result &= $sourceStorage->rmdir($sourceInternalPath); |
|
| 581 | } else { |
|
| 582 | $result &= $sourceStorage->unlink($sourceInternalPath); |
|
| 583 | } |
|
| 584 | } |
|
| 585 | return $result; |
|
| 586 | } |
|
| 587 | ||
| 588 | ||
| 589 | /** |
|