Skip to content

fix(activate): upgrade the database before activating - #4

Merged
nk-o merged 1 commit into
mainfrom
fix/update-db-after-start
Oct 23, 2026
Merged

nk-o merged 1 commit into
mainfrom
fix/update-db-after-start

Conversation

@nk-o

@nk-o nk-o commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

After a wp-env's WordPress core version is switched (for example 7.1 to 7.2-beta1), the database stays at the old version. wp-admin then redirects to upgrade.php, and the E2E global setup's requestUtils.activateTheme fails with "The theme ... is not installed". nk-activate-plugins now runs wp core update-db --quiet in each container before activating plugins. On a current database it does nothing. A failed upgrade counts as a failed attempt, so the existing retry loop covers a site that is still coming up.

The self-test runs the script against a fake wp-env and checks the call order in both sites. The check fails on the previous script, which never called update-db.

Scripted proof on ghostkit (start on 7.1, switch core to 7.2-beta1 via .wp-env.override.json, restart):

# afterStart = nk-activate-plugins 0.6.0
tests site core: 7.2-beta1 db_version: 61833
GET /wp-admin/ (logged out): 302 .../wp-admin/upgrade.php?_wp_http_referer=%2Fwp-admin%2F
activateTheme(empty-theme): FAILED: The theme "empty-theme" is not installed

# afterStart = this branch's activate-plugin.js, same env restarted
tests site db_version: 64486, dev: 64486
GET /wp-admin/ (logged out): 302 .../wp-login.php?redirect_to=...
activateTheme(empty-theme): OK

Publishing a new version and bumping it in the plugins is a separate step.

After a switch of the WordPress core version, wp-admin redirects to
upgrade.php until the database is upgraded, and the E2E setup's
requestUtils.activateTheme fails with "The theme ... is not
installed". wp core update-db is a no-op on a current database.
@nk-o
nk-o merged commit 3d82bb1 into main Oct 23, 2026
1 check passed
@nk-o
nk-o deleted the fix/update-db-after-start branch October 23, 2026 19:48
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