diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 8786b273d..97b92460c 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -140,11 +140,14 @@ public function boot() $io->writeln('➤ Registering dynamic services'); } + $configuration = $this->configurationManager->getConfiguration(); + $drupalKernel->addServiceModifier( new DrupalServiceModifier( $this->drupalFinder->getComposerRoot(), 'drupal.command', - 'drupal.generator' + 'drupal.generator', + $configuration ) ); @@ -193,8 +196,6 @@ public function boot() $this->configurationManager ); - $configuration = $this->configurationManager->getConfiguration(); - $container->get('console.translator_manager') ->loadCoreLanguage( $configuration->get('application.language'), diff --git a/src/Bootstrap/DrupalCompilerPass.php b/src/Bootstrap/DrupalCompilerPass.php index bb8c4c1cf..b9d052ac1 100644 --- a/src/Bootstrap/DrupalCompilerPass.php +++ b/src/Bootstrap/DrupalCompilerPass.php @@ -2,6 +2,8 @@ namespace Drupal\Console\Bootstrap; +use Dflydev\DotAccessConfiguration\ConfigurationInterface; +use Drupal\Console\Override\ConfigSubscriber; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Drupal\Console\Utils\TranslatorManager; @@ -12,6 +14,18 @@ */ class DrupalCompilerPass implements CompilerPassInterface { + protected $configuration; + + /** + * DrupalCompilerPass constructor. + * + * @param ConfigurationInterface $configuration + */ + public function __construct(ConfigurationInterface $configuration) + { + $this->configuration = $configuration; + } + /** * @inheritdoc */ @@ -28,6 +42,16 @@ public function process(ContainerBuilder $container) ->getDefinition('console.translator_manager') ->setClass(TranslatorManager::class); + $skipValidateSiteUuid = $this->configuration + ->get('application.overrides.config.skip-validate-site-uuid'); + + if ($skipValidateSiteUuid) { + // override system.config_subscriber + $container + ->getDefinition('system.config_subscriber') + ->setClass(ConfigSubscriber::class); + } + // Set console.invalid_commands service $container ->get('console.key_value_storage') diff --git a/src/Bootstrap/DrupalServiceModifier.php b/src/Bootstrap/DrupalServiceModifier.php index 9c563a5be..37d46213e 100644 --- a/src/Bootstrap/DrupalServiceModifier.php +++ b/src/Bootstrap/DrupalServiceModifier.php @@ -4,6 +4,7 @@ use Drupal\Core\DependencyInjection\ServiceModifierInterface; use Drupal\Core\DependencyInjection\ContainerBuilder; +use Dflydev\DotAccessConfiguration\ConfigurationInterface; /** * Class DrupalServiceModifier @@ -27,21 +28,26 @@ class DrupalServiceModifier implements ServiceModifierInterface */ protected $generatorTag; + protected $configuration; + /** * DrupalServiceModifier constructor. * - * @param string $root - * @param string $serviceTag - * @param string $generatorTag + * @param string $root + * @param string $serviceTag + * @param string $generatorTag + * @param ConfigurationInterface $configuration */ public function __construct( $root = null, $serviceTag, - $generatorTag + $generatorTag, + $configuration ) { $this->root = $root; $this->commandTag = $serviceTag; $this->generatorTag = $generatorTag; + $this->configuration = $configuration; } /** @@ -50,15 +56,7 @@ public function __construct( public function alter(ContainerBuilder $container) { $container->addCompilerPass( - new DrupalCompilerPass() + new DrupalCompilerPass($this->configuration) ); - - // $container->addCompilerPass( - // new FindCommandsCompilerPass($this->commandTag) - // ); - // - // $container->addCompilerPass( - // new FindGeneratorsCompilerPass($this->generatorTag) - // ); } } diff --git a/src/Override/ConfigSubscriber.php b/src/Override/ConfigSubscriber.php new file mode 100644 index 000000000..2452f01d6 --- /dev/null +++ b/src/Override/ConfigSubscriber.php @@ -0,0 +1,26 @@ +stopPropagation(); + return true; + } +} diff --git a/src/Override/StorageComparer.php b/src/Override/StorageComparer.php deleted file mode 100644 index 10f8a82e6..000000000 --- a/src/Override/StorageComparer.php +++ /dev/null @@ -1,15 +0,0 @@ -