summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-06-23 10:42:45 +0200
committerGitHub <noreply@github.com>2016-06-23 10:42:45 +0200
commitbba6470b8854e19c8ec82b88a3f29b26111200b8 (patch)
tree461b7149a94bb624d4377c2dc5c368889868d4e5
parentec387a604dea6f10345432bbfdd2dd13bf0fd53c (diff)
parentd3537ae33f1415b3615a8c9878f14b17ec05c4fb (diff)
downloadnextcloud-server-bba6470b8854e19c8ec82b88a3f29b26111200b8.tar.gz
nextcloud-server-bba6470b8854e19c8ec82b88a3f29b26111200b8.zip
Merge pull request #25230 from owncloud/stable8.1-enc-revertversionsize
[stable8.1] Rollback version must also adjust cached size
-rw-r--r--apps/files_versions/lib/storage.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php
index 815f089d21b..f7072a06697 100644
--- a/apps/files_versions/lib/storage.php
+++ b/apps/files_versions/lib/storage.php
@@ -300,6 +300,17 @@ class Storage {
$versionCreated = true;
}
+ $fileToRestore = 'files_versions' . $filename . '.v' . $revision;
+
+ $oldFileInfo = $users_view->getFileInfo($fileToRestore);
+ $newFileInfo = $files_view->getFileInfo($filename);
+ $cache = $newFileInfo->getStorage()->getCache();
+ $cache->update(
+ $newFileInfo->getId(), [
+ 'size' => $oldFileInfo->getSize()
+ ]
+ );
+
// rollback
if (self::copyFileContents($users_view, 'files_versions' . $filename . '.v' . $revision, 'files' . $filename)) {
$files_view->touch($file, $revision);