| @@ 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 |
|
| @@ 551-571 (lines=21) @@ | ||
| 548 | * @param bool $preserveMtime |
|
| 549 | * @return bool |
|
| 550 | */ |
|
| 551 | public function moveFromStorage(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = true) { |
|
| 552 | if ($sourceStorage === $this) { |
|
| 553 | return $this->rename($sourceInternalPath, $targetInternalPath); |
|
| 554 | } |
|
| 555 | ||
| 556 | // TODO clean this up once the underlying moveFromStorage in OC\Files\Storage\Wrapper\Common is fixed: |
|
| 557 | // - call $this->storage->moveFromStorage() instead of $this->copyBetweenStorage |
|
| 558 | // - copy the file cache update from $this->copyBetweenStorage to this method |
|
| 559 | // - copy the copyKeys() call from $this->copyBetweenStorage to this method |
|
| 560 | // - remove $this->copyBetweenStorage |
|
| 561 | ||
| 562 | $result = $this->copyBetweenStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime, true); |
|
| 563 | if ($result) { |
|
| 564 | if ($sourceStorage->is_dir($sourceInternalPath)) { |
|
| 565 | $result &= $sourceStorage->rmdir($sourceInternalPath); |
|
| 566 | } else { |
|
| 567 | $result &= $sourceStorage->unlink($sourceInternalPath); |
|
| 568 | } |
|
| 569 | } |
|
| 570 | return $result; |
|
| 571 | } |
|
| 572 | ||
| 573 | ||
| 574 | /** |
|