Allow to name a version
Done
- [x] Add web UI to name and delete a version
- [x] Create
oc_files_versionstable withid,file_id?,version_id,metadatametadata = JSON - [x] Update version lookup logic to:
- Look into DB
- If nothing, look into FS, then load all info in DB
- [x] Add entry DB when creating new version
- [x] Delete DB entries on file deletion
- [x] Plug into DAV plugin
- [x] Support getting the version label
- [x] Support patching the version label
- [x] Expose endpoint to delete a version
- [x] Remove experimental flag on UI
- [x] Check concurrence issue when initializing entries for a file in the DB - added unique index to prevent duplicate
<fileId, timestamp>tuples - [x] Add version labeling capability
- [x] Add config switch to disable capability
- [x] Propagate capability to web UI
- [x] Limit UI functionality
- [x] Disable cleanup of named version in
files_versions/lib/Storage.php - [x] Create new interface for nameable version backend
- [x] Check that it does not explode with
files_versions_S3andgroupfoldersimplementation as Carl raise some concerns
TODO
- [ ] Write documentation about labeling and deleting version config switch
Follow up
- [ ] Use COPY instead of MOVE when restoring version, so that it stays in the history (if not already the case)
- [ ] Load versions sidebar tab when clicking on the tab
- [ ] Save author of file creation and modification
- [ ] Implement deletion and labeling in
files_versions_S3andgroupfolders
Screenshots
| Context | Screenshot |
|---|---|
| List of version with the actions menu opened for the current version | ![]() |
| List of version with the actions menu opened for a previous version | ![]() |
| Name editor when the version do have a name | ![]() |
| Name editor when the version does not have a name | ![]() |
| Restore notification for un-named version | ![]() |
| Restore notification for named version | ![]() |
| Restore notification for initial version | ![]() |
Screencast
Screencast from 2022-11-21 17-36-10.webm
Need https://github.com/nextcloud/server/pull/34769
Checkout S3 [...] implementation as Carl raise some concerns
Yeah, since automatic expiration of versions is handled by the S3 platform itself, oc_files_versions will reference non-existing versions. Maybe there's a way to set a flag on objects on S3's side to avoid the expiration for the named versions?
Checkout S3 and group folders implementation as Carl raise some concerns
cc @mejo- as I remember there also was a groupfolder-like version backend in collectives.
regarding S3, this would only be handled in S3 if the app https://github.com/nextcloud/files_versions_s3 idea: we could disable the permanent version feature when this app is enabled to avoid unwanted side effects
we will also need to figure out how to backfill old versions that existed before this feature probably we just do it on-demand because scanning all files would take a while
on-demand would mean that if there are no entries in the table for a given file id, we check on disk and do a one-shot scan to populate the table for said file id
we will also need to figure out how to backfill old versions that existed before this feature
How about we keep the current logic and only use the table to store versions with a name ? Then we just populate the versions with their name.
Something like:
versions = existingLogicToGetVersionsFor(fileId)
namedVersions = newLogicToGetNamedVersionsFor(fileId) // so we just add this line
versions = merge(version, namedVersions) // and this line
return versions
In practice:
https://github.com/nextcloud/server/pull/35160/files#diff-e50e572ada0663901e21009299b02a8627937be7a783ff080c4e29ef550a997aR75-R86
After discussion, let's load all data about a version on demand, ie. when the user opens the sidebar or during expiration. Need to check concurrence issue when initing entries for a file.
Changed base to include https://github.com/nextcloud/server/pull/35080 as discussed
- [x] Server installation is failing. Apparently, having a hook that require
$userFolderis not possible.
- [x] Unit tests are failing now because of hooks not being wired up correctly
@skjnldsv I could need a review on the cypress part, to harmonize it with your initial work. I also tweaked the GH action file. Also, if you have time, a review on the front-end part is always welcome :)
/rebase
some points:
- [x] frontend:
undefinedas name of the version when creating a new file, - [ ] backend: might be interesting to store in the table the
fileIdof the version/backup file
/rebase
hello @artonge Thank you so much for your work on this pull request! This ticket seems to have the tag 'pending documentation'. Is there any chance you could clarify what documentation is missing? Is this for admins or for app developers?
Did the admin one, but forgot the user doc
Admin: https://github.com/nextcloud/documentation/pull/9618 User: https://github.com/nextcloud/documentation/pull/9649






