Share one recursive delete and validate hashes before deleting - #141
Merged
Merged
Conversation
Contributor
Test in WordPress PlaygroundTest the plugin with the code from this branch:
|
erseco
force-pushed
the
feature/extraction-helpers
branch
from
September 26, 2026 07:20
7ed63a7 to
6af4445
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/make-up-offline #141 +/- ##
=============================================================
- Coverage 96.87% 96.86% -0.02%
+ Complexity 864 855 -9
=============================================================
Files 39 39
Lines 4324 4308 -16
=============================================================
- Hits 4189 4173 -16
Misses 135 135
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
erseco
added this pull request to stack #144
September 26, 2026 07:38
erseco
force-pushed
the
feature/extraction-helpers
branch
from
September 26, 2026 07:43
6af4445 to
2509397
Compare
erseco
force-pushed
the
feature/extraction-helpers
branch
from
September 26, 2026 08:01
2509397 to
0cc18b2
Compare
The upload handler and the reprocessor each carried a private copy of the recursive delete already public on ExeLearning_Styles_Service; use that one, and have it stop on an unreadable directory instead of passing scandir()'s false to array_diff(). Deleting an attachment removed whatever folder its _exelearning_extracted meta named, and cleanup_by_hash() whatever hash it was given, without checking that the value is an extraction hash; '..' resolved to uploads/ itself. Both now act only on a well-formed 40-character hash, which is all the plugin ever writes.
erseco
force-pushed
the
feature/extraction-helpers
branch
from
September 26, 2026 08:29
0cc18b2 to
93abef9
Compare
erseco
added a commit
that referenced
this pull request
Sep 26, 2026
…locks (#146) Since #141 the upload handler, the reprocessor and most tests deleted extraction folders through ExeLearning_Styles_Service::recursive_delete(), which made shared filesystem cleanup look like a styles concern. Move it, unchanged, to a small ExeLearning_Filesystem class and update every caller; its two tests move to FilesystemTest. Also bring comments in line with the code: file-service, upload-handler, upload-block and editor docblocks said .elp although only .elpx packages are accepted; drop a boilerplate 'optionally unlink the original' note; and fix a REST docblock that still compared against the removed cleanup_old_extraction().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #140.
One recursive delete, and hash-validated deletes
ExeLearning_Styles_Servicealready exposes publicly. They now call that one.scandir()'sfalsetoarray_diff(), which is a TypeError on PHP 8.exelearning_delete_extracted_folder()(ondelete_attachment) andExeLearning_Reprocessor::cleanup_by_hash()deleted whatever folder the stored value or argument named. A_exelearning_extractedvalue of..resolved touploads/itself.ExeLearning_Content_Hash_Aliases::is_valid_hash()), which is all the plugin ever writes.The REST controller's own copy is removed with the rest of its dead code in the next PR.
Tests
..) never deletes the extraction root.OK (950 tests).