Permalink
Browse files

[config:*] Add configuration to stop site uuid config import/export e…

…rror. (#3806)
  • Loading branch information...
jmolivas committed Feb 23, 2018
1 parent 85a6948 commit e66605e46cee38bf8d099f305745cea548116546
@@ -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'),
@@ -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')
@@ -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)
// );
}
}
@@ -0,0 +1,26 @@
<?php
namespace Drupal\Console\Override;
use Drupal\system\SystemConfigSubscriber;
use Drupal\Core\Config\ConfigImporterEvent;
use Drupal\Core\Config\ConfigEvents;
/**
* Class ConfigSubscriber
*
* @package Drupal\Console\Override
*/
class ConfigSubscriber extends SystemConfigSubscriber
{
/**
* @param \Drupal\Core\Config\ConfigImporterEvent $event
* @return bool
*/
public function onConfigImporterValidateSiteUUID(ConfigImporterEvent $event)
{
$event->stopPropagation();
return true;
}
}

This file was deleted.

Oops, something went wrong.

0 comments on commit e66605e

Please sign in to comment.