Rollback version must also adjust cached size

This commit is contained in:
Vincent Petry 2016-06-22 15:18:19 +02:00
parent 54209abb74
commit 880ff122f1
No known key found for this signature in database
GPG Key ID: AF8F9EFC56562186
1 changed files with 8 additions and 1 deletions

View File

@ -337,9 +337,16 @@ class Storage {
// Restore encrypted version of the old file for the newly restored file // Restore encrypted version of the old file for the newly restored file
// This has to happen manually here since the file is manually copied below // This has to happen manually here since the file is manually copied below
$oldVersion = $users_view->getFileInfo($fileToRestore)->getEncryptedVersion(); $oldVersion = $users_view->getFileInfo($fileToRestore)->getEncryptedVersion();
$oldFileInfo = $users_view->getFileInfo($fileToRestore);
$newFileInfo = $files_view->getFileInfo($filename); $newFileInfo = $files_view->getFileInfo($filename);
$cache = $newFileInfo->getStorage()->getCache(); $cache = $newFileInfo->getStorage()->getCache();
$cache->update($newFileInfo->getId(), ['encrypted' => $oldVersion, 'encryptedVersion' => $oldVersion]); $cache->update(
$newFileInfo->getId(), [
'encrypted' => $oldVersion,
'encryptedVersion' => $oldVersion,
'size' => $oldFileInfo->getSize()
]
);
// rollback // rollback
if (self::copyFileContents($users_view, $fileToRestore, 'files' . $filename)) { if (self::copyFileContents($users_view, $fileToRestore, 'files' . $filename)) {