Commit Graph

89 Commits (0f69648d0ade5b2d8bbf24e1a7bf520b4722e5e5)

Author SHA1 Message Date
Ferdinand Thiessen 0f69648d0a
fix(files_version): use `Storage::writeStream` instead of deprecated `streamCopy` if possible
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-05-16 17:28:24 +07:00
Ferdinand Thiessen 01db539d0a
chore: move streamCopy implementation from `OC_Helper` to `OCP\Files`
The function was already there but called the legacy version.
So moved the implementation and migrated all usages of it.
Sadly the interface was slightly different so adjusted it to be
compatible with both legacy and the OCP one.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-05-16 13:03:05 +07:00
Louis Chemineau 4561a0a870 fix(files_versions): Do not expire versions newer than min age
The auto expire logic does not take into account the min retention age set by the admin. So versions were eagerly deleted.

Fix https://github.com/nextcloud/server/issues/19791

Signed-off-by: Louis Chemineau <louis@chmn.me>
2025-02-19 12:25:09 +07:00
Côme Chilliet 64863c9d46
chore: Apply new rector configuration to apps folder
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-02-13 11:46:42 +07:00
Louis Chemineau c87db7a960 fix(files_versions): Update `unencrypted_size` during rollback
This prevent restored version of encrypted files from having a wrong reported size. This was blocking download.

Signed-off-by: Louis Chemineau <louis@chmn.me>
2025-01-28 15:28:34 +07:00
Louis Chemineau 5336c92ca5 chore(files_versions): Remove unused $node variable
Signed-off-by: Louis Chemineau <louis@chmn.me>
2025-01-28 15:28:34 +07:00
provokateurin 381077028a
refactor(apps): Use constructor property promotion when possible
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-10-21 12:37:59 +07:00
Côme Chilliet 1580c8612b
chore(apps): Apply new rector configuration to autouse classes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-10-15 10:40:25 +07:00
provokateurin 9836e9b164
chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-19 14:21:20 +07:00
Daniel Kesselberg af6de04e9e
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +07:00
greta 26d22881e5 fix: add a try and catch for delete versioning
Signed-off-by: greta <gretadoci@gmail.com>
2024-07-25 14:46:06 +07:00
carhe 7eac3fe7da fix(files_versions): avoid unintentional skipping of expiration
Signed-off-by: carhe <carstenherrmann@web.de>
2024-07-25 12:29:04 +07:00
Andy Scherzinger afa48a4e0e
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-06-02 20:00:00 +07:00
Louis Chemineau 9361a305ba
chore(files_versions): Use new metadata API for versions
Signed-off-by: Louis Chemineau <louis@chmn.me>
2024-03-13 15:27:06 +07:00
Robin Appelman e7a7b4a401 perf: switch places that always use the first getById result to getFirstNodeById
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-03-04 13:57:31 +07:00
Robin Appelman 6fbf22ef5e
handle storage not available when expiring versions
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-01-24 10:49:38 +07:00
Joas Schilling aa5f037af7
chore: apply changes from Nextcloud coding standards 1.1.1
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2023-11-23 10:36:13 +07:00
Git'Fellow ffeef99abc
fix: Delete ghost versions of non-existing files
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2023-10-28 14:47:19 +07:00
Louis Chemineau cec0b310a5 Move module versions management logic out of main logic
Signed-off-by: Louis Chemineau <louis@chmn.me>
2023-09-07 15:47:59 +07:00
Julius Härtl bbb7172220
fix: Also cleanup version metadata if expiring
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-08-14 19:31:41 +07:00
Louis Chemineau c3475f4dbb Fix initialisation of versions in the DB
Broken after https://github.com/nextcloud/server/pull/36690

Signed-off-by: Louis Chemineau <louis@chmn.me>
2023-05-25 23:43:40 +07:00
Git'Fellow d6eb48c436
Check if version has entity before trying to access it
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2023-05-12 16:00:16 +07:00
Git'Fellow 7cd5cbe6e9
Check if version entity is not null before delete
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2023-05-08 14:24:58 +07:00
Max 337fc110ec
fix: catch ManuallyLockedException and use app context
The files_lock app may throw ManuallyLockedExceptions
when attempting to revert a file that is currently opened.
This would prevent the user from rolling back a opened file.

Text and Richdocuments handle changes of the file while editing.
Allow reverting files even when they are locked by these apps
and let the apps handle the conflict.

Signed-off-by: Max <max@nextcloud.com>
2023-05-03 09:52:36 +07:00
Côme Chilliet 60b7d2117e
Merge pull request #37428 from nextcloud/enh/ignore-non-numeric-versions
Ignore and log non integer versions
2023-04-20 13:33:58 +07:00
Côme Chilliet a6b1d990a4
Check for non-numeric versions, not non-integer
All versions are string

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-05 17:50:45 +07:00
Côme Chilliet 8cc8765089
Ignore and log non integer versions
This avoids being stuck when there is one buggy file version with a
 non-integer version. It allows the expiration process to not crash and
 continue with the other ones.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-05 17:44:14 +07:00
Julius Härtl cf46bd6915
fix: Make sure that rollback hook is triggered on all version backends
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-03-13 10:52:35 +07:00
Louis Chemineau 21cd3b0e0d Handle empty DB while expiring versions
Version on the FS can have no equivalent in the DB if they were created before the version naming feature. This makes sure that we catch the resulting exception and proceed as usual.

Fix https://github.com/nextcloud/server/issues/36541

Signed-off-by: Louis Chemineau <louis@chmn.me>
2023-02-08 13:56:49 +07:00
Louis Chemineau ad469969bf Prevent expiration of named versions
Signed-off-by: Louis Chemineau <louis@chmn.me>
2023-01-26 10:12:23 +07:00
Louis Chemineau 6a2f8bc599 Allow to delete a version through DAV
Signed-off-by: Louis Chemineau <louis@chmn.me>
2023-01-26 10:12:23 +07:00
Côme Chilliet 53cb5b8d07
Handle badly named version files more gracefully and log information
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-10-11 10:10:49 +07:00
Robin Appelman 9587a4a548
use filesystem user instead of file owner for creating version
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-09-09 16:22:40 +07:00
Robin Appelman 7be5788995
always use the default fs owner when storing versions
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-09-06 16:59:48 +07:00
Robin Appelman d5953e5c33
cache internalpath in versions cleanup
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-04-04 15:40:34 +07:00
Robin Appelman 5f101d910b
use search to find versions to expire
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-08-18 16:52:22 +07:00
Carl Schwan 701b57b81d
Remove allmost all deprecation from the files_version app
The remaining deprecations are related to Utils::hooks and I will take a
look at how EventDispatcher works before working on them.

Aside from the deprecations, this patch also does a few minor
improvements around type hinting.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-07-23 10:07:38 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
Christoph Wurst 8196420063
Drop \OCP\User
Inlines and remaining usages and drops the deprecated public API.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-05-21 15:00:34 +07:00
dependabot-preview[bot] eb502c02ff
Bump nextcloud/coding-standard from 0.3.0 to 0.5.0
Bumps [nextcloud/coding-standard](https://github.com/nextcloud/coding-standard) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/nextcloud/coding-standard/releases)
- [Changelog](https://github.com/nextcloud/coding-standard/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nextcloud/coding-standard/compare/v0.3.0...v0.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-02-18 13:31:24 +07:00
Robin Appelman b2fb4d898a
dont stop expiring versions if we cant check if the source file still exists
instead continue assuming it still exists

Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-02-05 15:06:43 +07:00
Christoph Wurst d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +07:00
Morris Jobke 6ce05bc7d7
Return all keys in getAllVersions() instead
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-10-12 22:17:06 +07:00
Christoph Wurst 02fa3253fe
Fix undefined index and consequential damages in versions code
If the user has no space and there are no versions, there won't be an
`all` index in the versions entry. Hence this triggers a warning and
becomes `null`, afterwards `count`, `foreach` and friends will happily
throw even more warnings and errors because they don't want to play with
`null`. Thus adding a fallback to an empty array.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-10-12 22:17:06 +07:00
Christoph Wurst d9015a8c94
Format code to a single space around binary operators
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-10-05 20:25:24 +07:00
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +07:00
Liam JACK b6c76f43a1
Fix #19066 - Array offset error due to empty file versions array
Signed-off-by: Liam JACK <liamjack@users.noreply.github.com>
2020-04-12 15:35:17 +07:00
Christoph Wurst 28f8eb5dba
Add visibility to all constants
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:54:27 +07:00
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +07:00
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 10:35:09 +07:00