Skip to content

Webdav PUT small file lock must be shared during hooks - #16912

Merged
DeepDiver1975 merged 1 commit into
masterfrom
webdav-smalltransferlockfix
Jun 15, 2015
Merged

DeepDiver1975 merged 1 commit into
masterfrom
webdav-smalltransferlockfix

Conversation

@PVince81

Copy link
Copy Markdown
Contributor

Fixed code path for Webdav PUT of small files to use shared locks during
hook execution, and exclusive during the file operation

This makes it possible for versions to be copied by accessing the file
in a post_write hook.

Fixes #16900

Please review @icewind1991 @DeepDiver1975 @nickvergessen
Note that I had to change the hook type from exclusive back to shared to run the post hooks.

Locking during post hooks will also be done for other code paths here: #16829 (comment)

I added a unit test. Ideally I'd have wanted to also check the locks during the file operation, but that would require extraordinary gymnastics, so I left it for now. Still, the current test would fail without the fix applied.

Fixed code path for Webdav PUT of small files to use shared locks during
hook execution, and exclusive during the file operation

This makes it possible for versions to be copied by accessing the file
in a post_write hook.
@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@ghost

ghost commented Jun 12, 2015

Copy link
Copy Markdown

🚀 Test PASSed.🚀
chuck

Comment thread tests/lib/testcase.php

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this here in testcase.php instead of your test file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it could be useful in other places.

Insist and I'll move it away.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a base class for unit tests, if you want to make a helper class do it in a new file ;)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also missing typehint for the view

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll move it to the test class.

@icewind1991

Copy link
Copy Markdown
Contributor

👍 looks good

@DeepDiver1975 DeepDiver1975 added this to the 8.1-current milestone Jun 15, 2015
@DeepDiver1975

Copy link
Copy Markdown
Contributor

👍

DeepDiver1975 added a commit that referenced this pull request Jun 15, 2015
Webdav PUT small file lock must be shared during hooks
@DeepDiver1975
DeepDiver1975 merged commit b6165b6 into master Jun 15, 2015
@DeepDiver1975
DeepDiver1975 deleted the webdav-smalltransferlockfix branch June 15, 2015 09:31
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 12, 2019
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.

Cannot run versions hook, file is locked

5 participants