Skip to content

Commit

Permalink
don't move files in cache twice, fixes renaming for objectstores
Browse files Browse the repository at this point in the history
  • Loading branch information
butonic authored and DeepDiver1975 committed Sep 30, 2015
1 parent 6760969 commit 2575f64
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/private/files/cache/updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,15 @@ public function rename($source, $target) {

if ($sourceStorage && $targetStorage) {
$targetCache = $targetStorage->getCache($sourceInternalPath);
if ($targetCache->inCache($targetInternalPath)) {
$targetCache->remove($targetInternalPath);
}
if ($sourceStorage === $targetStorage) {
$targetCache->move($sourceInternalPath, $targetInternalPath);
} else {
$targetCache->moveFromCache($sourceStorage->getCache(), $sourceInternalPath, $targetInternalPath);
if ($sourceStorage->getCache($sourceInternalPath)->inCache($sourceInternalPath)) {
if ($targetCache->inCache($targetInternalPath)) {
$targetCache->remove($targetInternalPath);
}
if ($sourceStorage === $targetStorage) {
$targetCache->move($sourceInternalPath, $targetInternalPath);
} else {
$targetCache->moveFromCache($sourceStorage->getCache(), $sourceInternalPath, $targetInternalPath);
}
}

if (pathinfo($sourceInternalPath, PATHINFO_EXTENSION) !== pathinfo($targetInternalPath, PATHINFO_EXTENSION)) {
Expand Down

0 comments on commit 2575f64

Please sign in to comment.