Skip to content

fix(theme): activate the required plugins in a fresh process on a first install - #584

Merged
ogorzalka merged 2 commits into
developfrom
fix/plugin-activation-shortinit
Nov 5, 2026
Merged

ogorzalka merged 2 commits into
developfrom
fix/plugin-activation-shortinit

Conversation

@ogorzalka

Copy link
Copy Markdown
Member

Problem

On a first install, `pollora new` runs `pollora:make:theme` in the process that just installed WordPress. That process only has WordPress partly loaded (`SHORTINIT`): `wp-settings.php` returns before `$wp_plugin_paths` is set and before `plugins_loaded`. Answering yes to "Activate the WordPress plugin ...?" (always the case with the E-commerce template, which requires WooCommerce) calls `activate_plugin()`, which crashes in `plugin_basename()` with `arsort(): Argument #1 ($array) must be of type array, null given`. The install stops before the theme build and the theme activation.

Closes Pollora/pollora#274

Change

  • New command `pollora:plugin:activate {plugins*}`: activates plugins (paths relative to the plugins directory) and refuses to run when WordPress is not fully loaded.
  • `MakeThemeCommand::activateWordPressPlugins()`: when `plugins_loaded` has not fired, hands the activation to a fresh `php artisan pollora:plugin:activate` process, where WordPress loads completely and the activation hooks run. If that process fails, it prints `wp plugin activate ` and the install carries on.
  • The prompt is unchanged, and the in-process activation is unchanged once WordPress is fully loaded.

Tests

Feature tests for both paths of `MakeThemeCommand` and for `PluginActivateCommand`. Pint, PHPStan and Rector are clean.

Not covered: the real `pollora new --ddev` run with the E-commerce template (the sub-process itself is not exercised by the tests). `DatabaseConfigTest` and `MissingBuildNotice` fail in my DDEV environment; they do not touch this change.

…st install

A first install runs pollora:make:theme with WordPress only partly loaded
(SHORTINIT): activate_plugin() crashed in plugin_basename() and the install
stopped before the theme build. The activation now runs in its own process
through the new pollora:plugin:activate command, with WordPress fully loaded.
@ogorzalka
ogorzalka merged commit b4a41f9 into develop Nov 5, 2026
19 of 20 checks passed
@ogorzalka
ogorzalka deleted the fix/plugin-activation-shortinit branch November 5, 2026 22:04
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