Skip to content
Corex

SiteMigrationRunner

Corex\Database\Schema\SiteMigrationRunner · class · Core layer

Runs idempotent per-site schema work through SiteScope, preserving partial-create retry semantics and returning failures that ProviderRepository would only log. Prefix handling deliberately stays in Migrator::fullName(): global $wpdb is read per call, so switch_to_blog() already selects the correct site prefix (FR-031, FR-034).

__construct(SchemaMigrator $migrator, SchemaRegistry $schemas, SchemaVersionStore $versions, SiteScope $scope, NetworkContext $network, EventDispatcher $events)

Section titled “__construct(SchemaMigrator $migrator, SchemaRegistry $schemas, SchemaVersionStore $versions, SiteScope $scope, NetworkContext $network, EventDispatcher $events)”

runForSite(int $siteId): SiteMigrationResult

Section titled “runForSite(int $siteId): SiteMigrationResult”

Whether a run would have anything to do: a registered component’s stored version differs from the one it declares. One read, and no write. It answers from what the request has read, which is enough to decide that a site needs no run. A run that follows reads again (see runCurrentSite()).

runForSites(array $siteIds): NetworkMigrationResult

Section titled “runForSites(array $siteIds): NetworkMigrationResult”

Continues after a throwing site and returns that failure, unlike the provider repository’s boot isolation which can only log it (spec 100 FR-031).

runForNetwork(int $batchSize, int $offset): NetworkMigrationResult

Section titled “runForNetwork(int $batchSize, int $offset): NetworkMigrationResult”

Batched network sweep; resume with $result->nextOffset until $result->complete.

pendingSiteIds(int $batchSize, int $offset): array

Section titled “pendingSiteIds(int $batchSize, int $offset): array”