Allow ServerCommand to start a server before drupal installation

Created on 18 January 2024, over 1 year ago

Problem/Motivation

The ServerCommand doesn't work when site is not installed yet. Even with the --suppress-login flag.

$ php core/scripts/drupal server --suppress-login
Drupal development server started: <http://127.0.0.1:8888>
This server is not meant for production use.
Error: Class "Drupal\user\Entity\User" not found in core/lib/Drupal/Core/Command/ServerCommand.php on line 191 #0 core/lib/Drupal/Core/Command/ServerCommand.php(222): Drupal\Core\Command\ServerCommand->getOneTimeLoginUrl()
#1 core/lib/Drupal/Core/Command/ServerCommand.php(83): Drupal\Core\Command\ServerCommand->start()
#2 vendor/symfony/console/Command/Command.php(326): Drupal\Core\Command\ServerCommand->execute()
#3 vendor/symfony/console/Application.php(1078): Symfony\Component\Console\Command\Command->run()
#4 vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#5 vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#6 core/scripts/drupal(28): Symfony\Component\Console\Application->run()
#7 {main}
Error: Class "Drupal\user\Entity\User" not found in Drupal\Core\Command\ServerCommand->getOneTimeLoginUrl() (line 191 of core/lib/Drupal/Core/Command/ServerCommand.php).

Steps to reproduce

Assuming drupal site is not installed, run php core/scripts/drupal server either with or without the --suppress-login flag.

Proposed resolution

Check for the --suppress-login flag, - if it's set, then do not create a one-time login URL.

Additionally, if the flag is not set, probably, the command could check whether a site is installed or not. And if not, also do not create a one-time login URL, but print a message about that.

Merge request link

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
OtherΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΊπŸ‡¦Ukraine pingwin4eg Zaporizhia πŸ‡ΊπŸ‡¦

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024