Skip to content
files_versions_s3.patch 2.77 KiB
Newer Older
Hugo Renard's avatar
Hugo Renard committed
diff --git a/lib/Versions/AbstractS3VersionBackend.php b/lib/Versions/AbstractS3VersionBackend.php
index a13e882..4b9d142 100644
--- a/lib/Versions/AbstractS3VersionBackend.php
+++ b/lib/Versions/AbstractS3VersionBackend.php
@@ -48,7 +48,7 @@ abstract class AbstractS3VersionBackend implements IVersionBackend {
 
 	abstract protected function getUrn(FileInfo $file): string;
 
-	abstract protected function postRollback(FileInfo $file);
+	abstract protected function postRollback(FileInfo $file, IVersion $version);
 
 	public function getVersionsForFile(IUser $user, FileInfo $file): array {
 		$s3 = $this->getS3($file);
@@ -68,7 +68,7 @@ abstract class AbstractS3VersionBackend implements IVersionBackend {
 		$s3 = $this->getS3($source);
 		if ($s3) {
 			$this->versionProvider->rollback($s3, $this->getUrn($source), $version->getRevisionId());
-			$this->postRollback($source);
+			$this->postRollback($source, $version);
 			return true;
 		}
 
diff --git a/lib/Versions/ExternalS3VersionsBackend.php b/lib/Versions/ExternalS3VersionsBackend.php
index 1d2ee00..c92e40c 100644
--- a/lib/Versions/ExternalS3VersionsBackend.php
+++ b/lib/Versions/ExternalS3VersionsBackend.php
@@ -26,6 +26,7 @@ namespace OCA\FilesVersionsS3\Versions;
 use OC\Files\ObjectStore\S3ConnectionTrait;
 use OC\Files\Storage\Wrapper\Jail;
 use OCA\Files_External\Lib\Storage\AmazonS3;
+use OCA\Files_Versions\Versions\IVersion;
 use OCP\Files\FileInfo;
 use OCP\Files\Storage\IStorage;
 
@@ -59,7 +60,7 @@ class ExternalS3VersionsBackend extends AbstractS3VersionBackend {
 		return $path;
 	}
 
-	protected function postRollback(FileInfo $file) {
+	protected function postRollback(FileInfo $file, IVersion $version) {
 		$file->getStorage()->getUpdater()->update($file->getInternalPath());
 	}
 }
diff --git a/lib/Versions/PrimaryS3VersionsBackend.php b/lib/Versions/PrimaryS3VersionsBackend.php
index 7331676..c4eeabc 100644
--- a/lib/Versions/PrimaryS3VersionsBackend.php
+++ b/lib/Versions/PrimaryS3VersionsBackend.php
@@ -26,6 +26,7 @@ namespace OCA\FilesVersionsS3\Versions;
 use OC\Files\ObjectStore\ObjectStoreStorage;
 use OC\Files\ObjectStore\S3;
 use OC\Files\ObjectStore\S3ConnectionTrait;
+use OCA\Files_Versions\Versions\IVersion;
 use OCP\Files\FileInfo;
 use OCP\Files\Storage\IStorage;
 
@@ -62,11 +63,12 @@ class PrimaryS3VersionsBackend extends AbstractS3VersionBackend {
 		return $storage->getURN($file->getId());
 	}
 
-	protected function postRollback(FileInfo $file) {
+	protected function postRollback(FileInfo $file, IVersion $version) {
 		$cache = $file->getStorage()->getCache();
 		$cache->update($file->getId(), [
 			'mtime' => time(),
-			'etag'  => $file->getStorage()->getETag($file->getInternalPath())
+			'etag'  => $file->getStorage()->getETag($file->getInternalPath()),
+			'size'  => $version->getSize(),
 		]);
 	}
 }