Generated with the help of an LLM.

Problem/Motivation

DrupalApplication::bootstrap() always creates a \Drupal\Core\DrupalKernel. A database update command needs \Drupal\Core\Update\UpdateKernel. That kernel forces a container rebuild, adds UpdateServiceProvider and does not cache the container. A command cannot swap the kernel, because the kernel boots before commands are discovered.

Proposed resolution

Read a kernel.class value from the runtime context in DrupalApplication::bootstrap(). Default to DrupalKernel. Throw an InvalidArgumentException when the value is not a class that extends DrupalKernel. Document the context keys on the constructor.

Remaining tasks

Review.

User interface changes

None.

API changes

New optional context key kernel.class for DrupalApplication. No change to existing behavior when the key is absent.

Data model changes

None.

Issue fork drupal-3638095

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

moshe weitzman created an issue. See original summary.

moshe weitzman’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs change record

Think as an API change, and pretty sure this has command has shipped in a release, we will need a CR please.

moshe weitzman’s picture

Which API does it break? Anyone extending DrupalApplication will be unaffected. Its an API addition.

smustgrave’s picture

Yes but even API additions usually need a change record so that others are aware if they want to use it or build on top of it.