summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-04-30 16:14:29 +0200
committerVincent Petry <pvince81@owncloud.com>2015-04-30 16:15:18 +0200
commit972e18960597f1412490db8a36c91d4b306b526e (patch)
treefe9c07b5ea33dc692949cde796e17ec4b894aa54 /apps
parent2228faaa39b03e7162451ac6ca38c645a5b141a1 (diff)
downloadnextcloud-server-972e18960597f1412490db8a36c91d4b306b526e.tar.gz
nextcloud-server-972e18960597f1412490db8a36c91d4b306b526e.zip
Use moveFromStorage instead of streamCopy when restoring version
Diffstat (limited to 'apps')
-rw-r--r--apps/files_versions/lib/storage.php15
1 files changed, 1 insertions, 14 deletions
diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php
index 6da22d6459c..4a5b47d2c2b 100644
--- a/apps/files_versions/lib/storage.php
+++ b/apps/files_versions/lib/storage.php
@@ -312,20 +312,7 @@ class Storage {
list($storage1, $internalPath1) = $view->resolvePath($path1);
list($storage2, $internalPath2) = $view->resolvePath($path2);
- if ($storage1 === $storage2) {
- return $storage1->rename($internalPath1, $internalPath2);
- }
- $source = $storage1->fopen($internalPath1, 'r');
- $target = $storage2->fopen($internalPath2, 'w');
- // FIXME: might need to use part file to avoid concurrent writes
- // (this would be an issue anyway when renaming/restoring cross-storage)
- list(, $result) = \OC_Helper::streamCopy($source, $target);
- fclose($source);
- fclose($target);
-
- if ($result !== false) {
- $storage1->unlink($internalPath1);
- }
+ $result = $storage2->moveFromStorage($storage1, $internalPath1, $internalPath2);
return ($result !== false);
}