Skip to content

22: Redirect only where a standalone really did go away - #36

Open
nikolaystrikhar wants to merge 1 commit into
21-packaging-hygienefrom
22-conflict-redirect-loop
Open

22: Redirect only where a standalone really did go away#36
nikolaystrikhar wants to merge 1 commit into
21-packaging-hygienefrom
22-conflict-redirect-loop

Conversation

@nikolaystrikhar

Copy link
Copy Markdown
Contributor

What: Conflict\Resolver's DEACTIVATE branch re-asks Conflict\Detector after deactivating, so the plugins_loaded priority 5 step only reports success — and only redirects — when the standalone is genuinely gone.

Usage:

// A site that puts the standalone back now gets the merge notice,
// where before it got a redirect loop out of wp-admin.
add_filter( 'option_active_plugins', $forces_the_standalone_active );

Why this way:

Deactivating is not the same event as being deactivated. The branch returned true the moment deactivate() returned. Three realistic sites disagree with that: one filtering option_active_plugins, one that rebound Deactivator_Interface to something that no-ops, one whose rebound Checker_Interface means by "active" something deactivate_plugins() never touches.

The redirect is what made it unrecoverable. Every admin GET resolved, redirected to itself and repeated until the browser gave up, and because each request exits before all_admin_notices the notice explaining it was never drawn. Suppressing the redirect leaves the notice to render on a page that actually loads.

The detector is already a constructor argument, so the second ask adds no dependency and stays inside the per-sub-plugin try.

The DEACTIVATE branch returned true the moment deactivate() returned, and
resolve_all() reads that as licence to redirect and exit. Nothing re-asked
whether the standalone was actually gone.

Where it is not -- a site filtering option_active_plugins, a rebound
Deactivator_Interface that no-ops, a rebound Checker_Interface meaning
something else by active -- every admin GET deactivates, redirects to itself
and repeats until the browser gives up, with the whole of wp-admin out of
reach. The merge notice explaining it is never drawn either, because each of
those requests exits before all_admin_notices.

Asking the detector again costs one call on a branch that is already the
expensive one, and the answer is the only thing the redirect was ever
entitled to act on.
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.

1 participant