Skip to content

Remove unreachable scaffolding and clean options on uninstall - #142

Merged
erseco merged 2 commits into
feature/extraction-helpersfrom
feature/remove-dead-code
Sep 26, 2026
Merged

erseco merged 2 commits into
feature/extraction-helpersfrom
feature/remove-dead-code

Conversation

@erseco

@erseco erseco commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #141.

Remove unreachable scaffolding

  • ExeLearning_Admin_Upload: an admin_post_exelearning_upload handler for a form that is never rendered, so its nonce is never issued.
  • ExeLearning_Filters: wrote the literal 'elp file metadata' into every .elpx attachment's metadata, which also surfaces in REST media_details. Nothing reads it. On REST-created attachments, which have no metadata, it triggered PHP 8.1+'s false-to-array deprecation.
  • Empty boilerplate: ExeLearning_Hooks, ExeLearning_Post_Types (both still hooked on init), ExeLearning::run() and load_dependencies().
  • ExeLearning_Elp_List_Table: hard-coded sample rows, never instantiated.
  • REST_API::cleanup_old_extraction() and its private recursive delete, reachable only through reflection in tests.

Uninstall

uninstall.php deletes the plugin's five options (exelearning_db_version, exelearning_proxy_assets, exelearning_styles_registry, exelearning_styles_block_import, exelearning_disabled_styles), on every site of a network. It passes number => 0 to get_sites(), because WP_Site_Query otherwise stops at 100 sites. Uploaded packages, their extractions and uploaded styles are user content and are kept.

Verification

  • PHPUnit OK (910 tests), with a new UninstallTest.
  • PHPCS clean.
  • Catalogs regenerated with composer make-translations: only obsolete strings removed, no untranslated msgids.

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Test in WordPress Playground

Test the plugin with the code from this branch:

Preview in WordPress Playground

ℹ️ The eXeLearning editor is fetched from the shared release and unpacked into the plugin when the playground boots, so the first load may take a few extra seconds. ELP upload, shortcode, Gutenberg block and preview work normally.

@codecov-commenter

codecov-commenter commented Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.40%. Comparing base (93abef9) to head (f5cd2ff).

Files with missing lines Patch % Lines
uninstall.php 0.00% 19 Missing ⚠️
exelearning.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                       Coverage Diff                        @@
##             feature/extraction-helpers     #142      +/-   ##
================================================================
- Coverage                         96.86%   96.40%   -0.46%     
+ Complexity                          855      827      -28     
================================================================
  Files                                39       35       -4     
  Lines                              4308     4233      -75     
================================================================
- Hits                               4173     4081      -92     
- Misses                              135      152      +17     
Flag Coverage Δ
javascript 95.71% <ø> (ø)
php 96.63% <0.00%> (-0.60%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
includes/class-exelearning-rest-api.php 99.71% <ø> (-0.02%) ⬇️
includes/class-exelearning.php 100.00% <ø> (+2.77%) ⬆️
exelearning.php 0.00% <0.00%> (ø)
uninstall.php 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erseco
erseco force-pushed the feature/remove-dead-code branch from 68f2c38 to a4d55d2 Compare September 26, 2026 07:20
@erseco
erseco added this pull request to stack #144 September 26, 2026 07:38
@erseco
erseco force-pushed the feature/remove-dead-code branch from a4d55d2 to 56c793b Compare September 26, 2026 07:43
@erseco
erseco force-pushed the feature/remove-dead-code branch from 56c793b to 2cd6a18 Compare September 26, 2026 08:01
Delete code that no request can reach or that does nothing:
- ExeLearning_Admin_Upload: an admin_post handler for a form that is never
  rendered, so its nonce is never issued.
- ExeLearning_Filters: wrote the literal 'elp file metadata' into every .elpx
  attachment's metadata (and REST media_details); nothing reads it, and on a
  REST-created attachment with no metadata it triggered PHP 8.1+'s false to
  array deprecation.
- ExeLearning_Hooks, ExeLearning_Post_Types and ExeLearning::run() /
  load_dependencies(): empty boilerplate, two of them still hooked on init.
- ExeLearning_Elp_List_Table: a list table with hard-coded sample rows that is
  never instantiated.
- REST_API::cleanup_old_extraction() and its private recursive delete, only
  reached through reflection in tests.

uninstall.php now deletes the plugin's five options, on every site of a
network. Uploaded packages, their extractions and uploaded styles are user
content and stay.
get_sites() returns at most 100 sites unless number is set, so networks with
more sites kept the plugin's options on the rest. Ask for all of them.
@erseco
erseco force-pushed the feature/remove-dead-code branch from 2cd6a18 to f5cd2ff Compare September 26, 2026 08:29
@erseco
erseco merged commit 1e88e18 into main Sep 26, 2026
5 checks passed
@erseco
erseco deleted the feature/remove-dead-code branch September 26, 2026 08:47
erseco added a commit that referenced this pull request Sep 26, 2026
The standalone editor page called ini_set( 'display_errors', '0' ) twice and
error_reporting( 0 ), changing the site's PHP runtime configuration. The
output buffer it already starts is enough: send_and_exit() discards anything
printed before the document, so the three calls are removed and a test now
asserts the settings are left untouched.

REST create loaded wp-admin/includes/media.php and image.php without using
any function from them; they are dropped. wp-admin/includes/file.php stays in
both REST handlers, because wp_handle_upload() is not loaded in REST requests,
and is now required immediately before that call.

The admin-post upload handler the review also cited was removed in #142.
erseco added a commit that referenced this pull request Sep 26, 2026
The standalone editor page called ini_set( 'display_errors', '0' ) twice and
error_reporting( 0 ), changing the site's PHP runtime configuration. The
output buffer it already starts is enough: send_and_exit() discards anything
printed before the document, so the three calls are removed and a test now
asserts the settings are left untouched.

REST create loaded wp-admin/includes/media.php and image.php without using
any function from them; they are dropped. wp-admin/includes/file.php stays in
both REST handlers, because wp_handle_upload() is not loaded in REST requests,
and is now required immediately before that call.

The admin-post upload handler the review also cited was removed in #142.
erseco added a commit that referenced this pull request Sep 26, 2026
…es (#124)

The standalone editor page called ini_set( 'display_errors', '0' ) twice and
error_reporting( 0 ), changing the site's PHP runtime configuration. The
output buffer it already starts is enough: send_and_exit() discards anything
printed before the document, so the three calls are removed and a test now
asserts the settings are left untouched.

REST create loaded wp-admin/includes/media.php and image.php without using
any function from them; they are dropped. wp-admin/includes/file.php stays in
both REST handlers, because wp_handle_upload() is not loaded in REST requests,
and is now required immediately before that call.

The admin-post upload handler the review also cited was removed in #142.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants