fix(uninstall): remove two_factor_enabled_providers option on uninstall - #903
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
The site-wide enabled providers option added in 0.16 was not included in Two_Factor_Core::uninstall(), so it was left behind in wp_options after uninstalling the plugin. Add a class constant for the option key and include it in the uninstall list. Replace the literal in the main file and settings UI to use the constant. Fixes WordPress#902
179704f to
60628e8
Compare
|
Done. Removed Diff: https://github.com/WordPress/two-factor/pull/903/files |
Change ENABLED_PROVIDERS_OPTION_KEY docblock version from 0.16.1 to 0.17.0 since this constant ships in the 0.17.0 release. Refs WordPress#903
|
@masteradhoc Updated the |
Summary
The
two_factor_enabled_providersoption (added in 0.16) was not being removed when the plugin is uninstalled, leaving an orphaned row inwp_options. This fix adds the option to the uninstall list and centralises the key in a class constant.Fixes #902
Changes
class-two-factor-core.phpBefore:
After:
Why: Mirrors the existing pattern of constants-on-the-class for every other plugin meta/option key and adds the missing option to the uninstall list.
two-factor.phpandsettings/class-two-factor-settings.phpReplaced the literal
'two_factor_enabled_providers'withTwo_Factor_Core::ENABLED_PROVIDERS_OPTION_KEYso the key lives in one place.tests/class-two-factor-core.phpAdded
test_uninstall_removes_enabled_providers_optionto cover the new cleanup path.Testing
Test 1: Automated
npm testnpm run composer -- test -- --filter test_uninstallResult: 185/185 pass (6 uninstall tests pass, including the new one).
Test 2: Manual
wp_options: notwo_factor_enabled_providersrow.