Skip to content

Attempt to fix version preview deletion - #33188

Closed
PVince81 wants to merge 1 commit into
masterfrom
fix-version-preview-deletion
Closed

PVince81 wants to merge 1 commit into
masterfrom
fix-version-preview-deletion

Conversation

@PVince81

Copy link
Copy Markdown
Contributor

Description

See #32346 for analysis

Related Issue

Fixes #32346

Motivation and Context

Fix something that never worked before: #32346 (comment)

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • Backport (if applicable set "backport-request" label and remove when the backport was done)
  • Actually make this work
  • Fix/add unit tests
  • Acceptance tests if possible

@PVince81

Copy link
Copy Markdown
Contributor Author

looks like there's a new argument $versionId to the Preview constructor.

so the way I see it we need to:

  1. add a specific handler for post_delete_versions and prepare_delete_versions
  2. convert "test.txt.v1234566" and extract its file name to find the file id
  3. extract the timestamp from "test.txt.v1234566" and use "/meta/$fileid/versions/$timestamp" to find the matching version node, to verify that it exists
  4. then initialize new Preview() and pass in the timestamp as version id

In theory, we could also rewrite the constructor of Preview() to understand whenever the $node given as input is an instance of IVersionedNode and extract the timestamp from there for $this->versionId

@PVince81

Copy link
Copy Markdown
Contributor Author

or have a subclass VersionPreview with the version specific logic. Version related hooks could be wired up to that.

@PVince81

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 any preference for the proposed approaches ? ^

2 similar comments
@PVince81

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 any preference for the proposed approaches ? ^

@PVince81

Copy link
Copy Markdown
Contributor Author

@DeepDiver1975 any preference for the proposed approaches ? ^

@PVince81

Copy link
Copy Markdown
Contributor Author

in the meantime, here's an attempt at mitigation: #34118

this would prevent the exception but would also leave some stray previews

@PVince81

PVince81 commented Feb 5, 2019

Copy link
Copy Markdown
Contributor Author

closing in favor of #34283 from @VicDeo

@PVince81 PVince81 closed this Feb 5, 2019
@PVince81
PVince81 deleted the fix-version-preview-deletion branch February 5, 2019 15:59
@lock lock Bot locked as resolved and limited conversation to collaborators Feb 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[10.0.9]Trying to get owner from an erased file

3 participants