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.