Skip to content
Corex

SiteScopeManager

Corex\Multisite\SiteScopeManager · class · Core layer

Treats switches and restores identically because WordPress emits switch_blog for both directions with the same signature. Acting only on a changed current id is symmetric, idempotent, and immune to an unbalanced WordPress switch stack.

__construct(MultisiteContext $multisite, SiteContext $site, EventDispatcher $events, ListenerProvider $listeners)

Section titled “__construct(MultisiteContext $multisite, SiteContext $site, EventDispatcher $events, ListenerProvider $listeners)”

Self-gated on the install shape rather than trusting the caller to check, so a single-site request can never acquire a switch_blog callback however this is wired (spec FR-004, SC-008). Priority zero is deliberate: every future CoreX switch_blog listener must use priority 10 or later so it observes post-invalidation state.

onSwitchBlog(int $newSiteId, int $previousSiteId, string $context): void

Section titled “onSwitchBlog(int $newSiteId, int $previousSiteId, string $context): void”

run(int $siteId, Closure $callback): mixed

Section titled “run(int $siteId, Closure $callback): mixed”