| @@ 613-631 (lines=19) @@ | ||
| 610 | * @param string $targetInternalPath |
|
| 611 | * @return bool |
|
| 612 | */ |
|
| 613 | public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) { |
|
| 614 | if ($sourceStorage === $this) { |
|
| 615 | return $this->rename($sourceInternalPath, $targetInternalPath); |
|
| 616 | } |
|
| 617 | ||
| 618 | if (!$sourceStorage->isDeletable($sourceInternalPath)) { |
|
| 619 | return false; |
|
| 620 | } |
|
| 621 | ||
| 622 | $result = $this->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, true); |
|
| 623 | if ($result) { |
|
| 624 | if ($sourceStorage->is_dir($sourceInternalPath)) { |
|
| 625 | $result &= $sourceStorage->rmdir($sourceInternalPath); |
|
| 626 | } else { |
|
| 627 | $result &= $sourceStorage->unlink($sourceInternalPath); |
|
| 628 | } |
|
| 629 | } |
|
| 630 | return $result; |
|
| 631 | } |
|
| 632 | ||
| 633 | /** |
|
| 634 | * @inheritdoc |
|
| @@ 598-622 (lines=25) @@ | ||
| 595 | * @param bool $preserveMtime |
|
| 596 | * @return bool |
|
| 597 | */ |
|
| 598 | public function moveFromStorage(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = true) { |
|
| 599 | if ($sourceStorage === $this) { |
|
| 600 | return $this->rename($sourceInternalPath, $targetInternalPath); |
|
| 601 | } |
|
| 602 | ||
| 603 | // TODO clean this up once the underlying moveFromStorage in OC\Files\Storage\Wrapper\Common is fixed: |
|
| 604 | // - call $this->storage->moveFromStorage() instead of $this->copyBetweenStorage |
|
| 605 | // - copy the file cache update from $this->copyBetweenStorage to this method |
|
| 606 | // - copy the copyKeys() call from $this->copyBetweenStorage to this method |
|
| 607 | // - remove $this->copyBetweenStorage |
|
| 608 | ||
| 609 | if (!$sourceStorage->isDeletable($sourceInternalPath)) { |
|
| 610 | return false; |
|
| 611 | } |
|
| 612 | ||
| 613 | $result = $this->copyBetweenStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime, true); |
|
| 614 | if ($result) { |
|
| 615 | if ($sourceStorage->is_dir($sourceInternalPath)) { |
|
| 616 | $result &= $sourceStorage->rmdir($sourceInternalPath); |
|
| 617 | } else { |
|
| 618 | $result &= $sourceStorage->unlink($sourceInternalPath); |
|
| 619 | } |
|
| 620 | } |
|
| 621 | return $result; |
|
| 622 | } |
|
| 623 | ||
| 624 | ||
| 625 | /** |
|