Skip to content
Corex

SchemaSelfHeal

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

Repairs the current site’s schema only from admin or cron. This deliberately excludes every WP-CLI bootstrap: commands such as wp plugin list, wp cron event run, and wp option get must not write schema, while explicit tooling already has wp corex migrate. FR-035 forbids front-end schema writes; wp_initialize_site covers new sites and admin/cron heal upgrades unattended. WordPress transients are site-scoped, so the lock coordinates per site rather than blocking the whole network. The lock is a mutex held for the duration of the run, not a throttle between runs — the TTL only bounds a crashed request that never reached the finally. The lock is taken only by a request that has found the site behind. Every admin page, every admin-ajax.php call (an open admin screen makes one on a timer) and every cron run comes through here, and nearly all of them find the site current: that costs them one read of the registered components’ versions and no write. The runner reads the versions again once the lock is held, so a request that looked while another was finishing the same migration does not run it a second time (DECISIONS #360).

__construct(SiteMigrationRunner $runner, SiteContext $site, MultisiteContext $multisite, EventDispatcher $events)

Section titled “__construct(SiteMigrationRunner $runner, SiteContext $site, MultisiteContext $multisite, EventDispatcher $events)”