Remove empty directories from the files_versions#40499
Conversation
4d7ad3e to
18842fb
Compare
|
Should we move this forward? |
|
As far as I know, this just needs review and merge. The failing test is due to the missing windows server. |
2ac77af to
ecfa0f8
Compare
DeepDiver1975
left a comment
There was a problem hiding this comment.
Any chance to add some tests to ensure that:
- empty folders are deleted
- non-empty folders are not deleted
THX
Not sure if you mean unit tests or acceptance tests. The behavior to test is in the back-end implementation, so not directly visible to any API call. But we do have the testing app, and that has https://github.com/owncloud/testing/blob/master/lib/ServerFiles.php which allows access to "see" what files and directories exist in the back-end data storage. So, I can add some acceptance tests that check the back-end storage behavior of files_versions. |
I think what is meant here are unit tests in https://github.com/owncloud/core/blob/master/apps/files_versions/tests/VersioningTest.php |
|
Unit tests it would be |
5de7ed8 to
2fb5d51
Compare
|
let's first merge #40531 to limit the rebase effort. THX |
|
#40531 has been merged. Rebase this? |
2fb5d51 to
74a336d
Compare
|
LGTM. @DeepDiver1975 please review again. |
|
Kudos, SonarCloud Quality Gate passed! |
| $this->assertCount(0, $results); | ||
| // empty folder should be deleted | ||
| $results = $this->rootView->getDirectoryContent($this->user . '/files_versions/'); | ||
| $this->assertCount(0, $results); |
There was a problem hiding this comment.
old topic - self::assertCount() but this is all over our code base ....








Description
Empty directories were left inside the files_versions directory. For large installations this is a waste of space because there could be a lot of empty directories that aren't useful in any way.
Related Issue
https://github.com/owncloud/enterprise/issues/5471
Motivation and Context
How Has This Been Tested?
Mostly tested by deleting files from the web UI
<userdir>/files_versions/f1/f2/f3/There should be only the
<userdir>/files_versionsfolder without any directory in it. This is because the "f1/f2/f3" folders were empty.Additional checks done:
<userdir>/files_versionsexists because the rest of the folders were empty.occ versions:cleanupandocc versions:expireworks with the same conditions.Screenshots (if appropriate):
Types of changes
Checklist:
Note:
Existing empty version folder won't be removed unless a version ends up inside any of them. In this case, there won't be any difference and the folder will be removed once the last version is removed from the folder.