diff options
author | Robin Appelman <robin@icewind.nl> | 2019-06-04 13:39:23 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2019-06-04 14:15:20 +0200 |
commit | a0a3f534f7bb4498319e180f0164bbf8b22214fd (patch) | |
tree | 1d344331b1df7716c65c6d217e1139f0922abea5 /apps | |
parent | fd9ff581e2a92f65def3f5d3209c4328fb65416a (diff) | |
download | nextcloud-server-a0a3f534f7bb4498319e180f0164bbf8b22214fd.tar.gz nextcloud-server-a0a3f534f7bb4498319e180f0164bbf8b22214fd.zip |
allow non integer version ids
currently version ids are timestamps, but for storage provided versions
this is not always the case and they might be strings
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps')
6 files changed, 10 insertions, 10 deletions
diff --git a/apps/files_versions/lib/Controller/PreviewController.php b/apps/files_versions/lib/Controller/PreviewController.php index f41250a8971..28d16b8a96b 100644 --- a/apps/files_versions/lib/Controller/PreviewController.php +++ b/apps/files_versions/lib/Controller/PreviewController.php @@ -95,7 +95,7 @@ class PreviewController extends Controller { $user = $this->userSession->getUser(); $userFolder = $this->rootFolder->getUserFolder($user->getUID()); $file = $userFolder->get($file); - $versionFile = $this->versionManager->getVersionFile($user, $file, (int)$version); + $versionFile = $this->versionManager->getVersionFile($user, $file, $version); $preview = $this->previewManager->getPreview($versionFile, $x, $y, true, IPreview::MODE_FILL, $versionFile->getMimetype()); return new FileDisplayResponse($preview, Http::STATUS_OK, ['Content-Type' => $preview->getMimeType()]); } catch (NotFoundException $e) { diff --git a/apps/files_versions/lib/Versions/IVersion.php b/apps/files_versions/lib/Versions/IVersion.php index b6fc95814d8..d12bdc9d0ba 100644 --- a/apps/files_versions/lib/Versions/IVersion.php +++ b/apps/files_versions/lib/Versions/IVersion.php @@ -46,10 +46,10 @@ interface IVersion { /** * Get the id of the revision for the file * - * @return int + * @return int|string * @since 15.0.0 */ - public function getRevisionId(): int; + public function getRevisionId(); /** * Get the timestamp this version was created diff --git a/apps/files_versions/lib/Versions/IVersionBackend.php b/apps/files_versions/lib/Versions/IVersionBackend.php index 913745c9850..055d2eab174 100644 --- a/apps/files_versions/lib/Versions/IVersionBackend.php +++ b/apps/files_versions/lib/Versions/IVersionBackend.php @@ -85,9 +85,9 @@ interface IVersionBackend { * * @param IUser $user * @param FileInfo $sourceFile - * @param int $revision + * @param int|string $revision * @return ISimpleFile * @since 15.0.0 */ - public function getVersionFile(IUser $user, FileInfo $sourceFile, int $revision): File; + public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): File; } diff --git a/apps/files_versions/lib/Versions/LegacyVersionsBackend.php b/apps/files_versions/lib/Versions/LegacyVersionsBackend.php index aceddef29d2..46bd2ea8d46 100644 --- a/apps/files_versions/lib/Versions/LegacyVersionsBackend.php +++ b/apps/files_versions/lib/Versions/LegacyVersionsBackend.php @@ -113,7 +113,7 @@ class LegacyVersionsBackend implements IVersionBackend { return $file->fopen('r'); } - public function getVersionFile(IUser $user, FileInfo $sourceFile, int $revision): File { + public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): File { $userFolder = $this->rootFolder->getUserFolder($user->getUID()); $versionFolder = $this->getVersionFolder($user); /** @var File $file */ diff --git a/apps/files_versions/lib/Versions/Version.php b/apps/files_versions/lib/Versions/Version.php index 5988234db61..3a60dc0731c 100644 --- a/apps/files_versions/lib/Versions/Version.php +++ b/apps/files_versions/lib/Versions/Version.php @@ -29,7 +29,7 @@ class Version implements IVersion { /** @var int */ private $timestamp; - /** @var int */ + /** @var int|string */ private $revisionId; /** @var string */ @@ -55,7 +55,7 @@ class Version implements IVersion { public function __construct( int $timestamp, - int $revisionId, + $revisionId, string $name, int $size, string $mimetype, @@ -83,7 +83,7 @@ class Version implements IVersion { return $this->sourceFileInfo; } - public function getRevisionId(): int { + public function getRevisionId() { return $this->revisionId; } diff --git a/apps/files_versions/lib/Versions/VersionManager.php b/apps/files_versions/lib/Versions/VersionManager.php index 99fa9f62bc8..23cf43ba357 100644 --- a/apps/files_versions/lib/Versions/VersionManager.php +++ b/apps/files_versions/lib/Versions/VersionManager.php @@ -98,7 +98,7 @@ class VersionManager implements IVersionManager { return $backend->read($version); } - public function getVersionFile(IUser $user, FileInfo $sourceFile, int $revision): File { + public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): File { $backend = $this->getBackendForStorage($sourceFile->getStorage()); return $backend->getVersionFile($user, $sourceFile, $revision); } |