Refactor "dex" front controller into existing "drupal" front controller, combining management of both bootstrapping and non-bootstrapping commands.
The changes here could be merged into !8344 (diffs)
Merge request reports
Activity
added 1 commit
- 742d8222 - Fix typo in $context refactor to $this->context
114 115 "includes/bootstrap.inc" 115 116 ] 116 117 }, 118 "bin": [ 119 "bin/dex", 120 "scripts/drupal" Something I forgot earlier;
core/scripts/drupal
is not currently placed invendor/bin
because Drupal Console places itsdrupal
script invendor/bin
. I am uncertain whether Drupal Console will support Drupal 11; they do currently have Drupal 10 support, but only in a development version. This might be an opportunity to convert the core commands to use #AsCommand, and unify the front controller to use the one provided by Core. It would probably be best for now to not put core'sdrupal
invendor/bin
.Was namespace collision issues with Drupal Console an additional unspoken reason for proposing
dex
over the extension of the existingdrupal
script? There are definitely some remaining complexities here.
- core/scripts/drupal 100644 → 100755
9 use Drupal\Core\Command\GenerateTheme; 10 use Drupal\Core\Command\QuickStartCommand; 11 use Drupal\Core\Command\InstallCommand; 12 use Drupal\Core\Command\ServerCommand; 13 use Drupal\Core\Recipe\RecipeCommand; 14 use Symfony\Component\Console\Application; 15 16 if (PHP_SAPI !== 'cli') { 17 return; 18 } 9 declare(strict_types = 1); 19 10 20 $classloader = require_once __DIR__ . '/../../autoload.php'; 11 use Composer\Autoload\ClassLoader; 12 use Drupal\Core\Command\DrupalApplication; 13 use Drupal\Core\DrupalKernel; 9 use Symfony\Component\Console\CommandLoader\ContainerCommandLoader; 10 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; 11 use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass; 12 use Symfony\Component\DependencyInjection\ContainerBuilder; 13 use Symfony\Component\DependencyInjection\Definition; 14 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; 15 use Symfony\Component\DependencyInjection\Reference; 16 17 /** 18 * System compiler pass. 19 * 20 * Inspired by: 21 * - \Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass() 22 * - \Symfony\Bundle\FrameworkBundle\Console\Application::registerCommands() 23 */ 24 final class DexCompilerPass implements CompilerPassInterface { - core/modules/system/src/Command/Example.php 0 → 100644
2 3 declare(strict_types=1); 4 5 namespace Drupal\system\Command; 6 7 use Drupal\Component\Datetime\TimeInterface; 8 use Symfony\Component\Console\Attribute\AsCommand; 9 use Symfony\Component\Console\Command\Command; 10 use Symfony\Component\Console\Input\InputInterface; 11 use Symfony\Component\Console\Output\OutputInterface; 12 use Symfony\Component\Console\Style\SymfonyStyle; 13 14 /** 15 * Example module command. 16 * 17 * Ultimately, I think we should remove this from the MR, but it is