Bug #105217
openRecyclerGarbageCollectionTask does not work recursively and stops at first sight
0%
Description
The RecyclerGarbageCollectionTask
from ext:scheduler
to cleanup file storage recycle folders (_recycler_
, ROLE_RECYCLER
) does not detect these recycle folders recursively, but only on first level (of the file storage root). Having them in sub-folders is totally possible (when using file mounts on subfolders, for example). And it also stops at first sight (there can validly be multiple recyclers, however).
$rootLevelFolder->getSubfolders()
(which is used by the task to find the recycler folders) does allow setting an argument $recursive = true
.
Updated by S P about 2 months ago · Edited
Got some time to test this out. Two changes needed:
The inner loop must be (note the true
argument at the end):
foreach ($rootLevelFolder->getSubfolders(0, 0, Folder::FILTER_MODE_NO_FILTERS, true) as $subFolder) {
(not sure about the filters, I just disabled them, because inside the loop the folders are selected for recycler folders anyways)
And the break
inside the inner loop must be removed, so that it actually loops over all folders.
These both steps let the task cleanup all recycle bins, just like one expects from this task.
Or to put it all together, this is how the loop looks now in the patched RecyclerGarbageCollectionTask in my project:
foreach ($storageRepository->findAll() as $storage) {
$rootLevelFolder = $storage->getRootLevelFolder(false);
foreach ($rootLevelFolder->getSubfolders(0, 0, Folder::FILTER_MODE_NO_FILTERS, true) as $subFolder) {
if ($subFolder->getRole() === $subFolder::ROLE_RECYCLER) {
$recyclerFolders[] = $subFolder;
}
}
}
Updated by S P about 2 months ago
- Subject changed from RecyclerGarbageCollectionTask does not work recursively to RecyclerGarbageCollectionTask does not work recursively and stops at first sight
- Description updated (diff)
Updated by Sébastien Delcroix about 2 months ago · Edited
Could you please also test your changes with _recycler_
folders nested inside other _recycler_
folders if it crashes ?
Updated by Gerrit Code Review about 2 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86502
Updated by Gerrit Code Review about 1 month ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86502