From 2575f64fade12f67f3b7db02cb0a660306e6ae1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Tue, 14 Jul 2015 15:12:27 +0200 Subject: [PATCH] don't move files in cache twice, fixes renaming for objectstores --- lib/private/files/cache/updater.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php index 1e180e7993a4..2de0c8fe0679 100644 --- a/lib/private/files/cache/updater.php +++ b/lib/private/files/cache/updater.php @@ -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)) {