Skip to content

Multisite stranding guard [2/4]: Answer whether a plugin is active for the whole network - #47

Open
d4mation wants to merge 1 commit into
32-host-basename-configfrom
33-checker-network-active
Open

Multisite stranding guard [2/4]: Answer whether a plugin is active for the whole network#47
d4mation wants to merge 1 commit into
32-host-basename-configfrom
33-checker-network-active

Conversation

@d4mation

@d4mation d4mation commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

What: Add Checker_Interface::is_network_active() and its Plugin\Checker implementation, wrapping is_plugin_active_for_network().

Usage:

$checker->is_network_active( 'give-recurring/give-recurring.php' ); // false off a network

Why this way:

Interface method only — no Provider change. Checker is bound by class name, so an added interface method needs no constructor wiring; the container builds it exactly as before. The four Checker_Interface test doubles gain the method, which is the whole ripple of the contract addition.

Network scope, deliberately not folded into is_active(). is_active() ORs the network check into its answer and means "the standalone's code runs this request"; the stranding guard needs a different question — "deactivating it reaches every site" — so the two stay separate. is_plugin_active_for_network() returns false off a network, so callers need no is_multisite() guard, which is what lets the guard skip one.

Stack created with GitHub Stacks CLIGive Feedback 💬

Summary by CodeRabbit

  • New Features

    • Added support for checking whether a plugin is activated network-wide.
    • Network activation checks return a clear true/false result and work consistently in multisite and non-multisite environments.
  • Documentation

    • Updated plugin activation status documentation to describe network-specific behavior.
  • Tests

    • Added coverage for network activation results and verification behavior.

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Enterprise

Run ID: 66e68566-fb67-481b-9b0f-725bd22d000b

📥 Commits

Reviewing files that changed from the base of the PR and between f97357d and 14384ba.

📒 Files selected for processing (7)
  • CLAUDE.md
  • src/Plugin/Checker.php
  • src/Plugin/Contracts/Checker_Interface.php
  • tests/unit/Boot/SchedulerTest.php
  • tests/unit/Conflict/DetectorTest.php
  • tests/unit/Plugin/CheckerTest.php
  • tests/unit/Scenario/HostTest.php

Included review availability: Your plan provides up to 12 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The plugin checker now exposes is_network_active() through its interface and implementation. The method delegates to WordPress network-activation status checks. Unit tests, test doubles, and documentation cover the new behavior.

Changes

Network activation status

Layer / File(s) Summary
Checker network activation API
src/Plugin/Contracts/Checker_Interface.php, src/Plugin/Checker.php, tests/unit/Plugin/CheckerTest.php
Adds the is_network_active() contract and implementation. Tests cover true and false results, basename forwarding, and exclusive use of is_plugin_active_for_network().
Interface integration and documentation
tests/unit/Boot/SchedulerTest.php, tests/unit/Conflict/DetectorTest.php, tests/unit/Scenario/HostTest.php, CLAUDE.md
Updates checker test doubles and documentation for network activation reporting.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 14384

The PR adds a narrowly scoped network-active check and its related test updates; no actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Checker
  participant WordPressPluginFunctions
  participant NetworkActivationFunction
  Checker->>WordPressPluginFunctions: load plugin functions
  Checker->>NetworkActivationFunction: check plugin basename
  NetworkActivationFunction-->>Checker: return network activation status
Loading

Suggested reviewers: nikolaystrikhar

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 90.48% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 6 files. (1 skipped: 1 unsupported.)
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes adding a check for whether a plugin is active across the whole network.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 33-checker-network-active

Comment @coderabbitai help to get the list of available commands.

@d4mation
d4mation marked this pull request as draft August 21, 2026 14:15
@d4mation
d4mation force-pushed the 33-checker-network-active branch from 7127ff9 to f1569c2 Compare August 21, 2026 14:32
@d4mation
d4mation force-pushed the 33-checker-network-active branch from f1569c2 to 481ea2d Compare August 21, 2026 14:36
@d4mation
d4mation force-pushed the 33-checker-network-active branch from 481ea2d to 14384ba Compare August 21, 2026 14:49
@d4mation d4mation changed the title Answer whether a plugin is active for the whole network Multisite stranding guard [2/4]: Answer whether a plugin is active for the whole network Aug 21, 2026
@d4mation
d4mation marked this pull request as ready for review August 21, 2026 15:05
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