Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • project/config_split
  • issue/config_split-3181828
  • issue/config_split-3182186
  • issue/config_split-3183010
  • issue/config_split-3181368
  • issue/config_split-2934170
  • issue/config_split-2967961
  • issue/config_split-3228508
  • issue/config_split-3231541
  • issue/config_split-3191356
  • issue/config_split-3232243
  • issue/config_split-3232667
  • issue/config_split-3236393
  • issue/config_split-3239366
  • issue/config_split-3239693
  • issue/config_split-3279331
  • issue/config_split-3240272
  • issue/config_split-3246688
  • issue/config_split-3246689
  • issue/config_split-3246696
  • issue/config_split-3238855
  • issue/config_split-3247757
  • issue/config_split-2938888
  • issue/config_split-3275363
  • issue/config_split-3276681
  • issue/config_split-3284552
  • issue/config_split-3293759
  • issue/config_split-3298501
  • issue/config_split-3309356
  • issue/config_split-3310931
  • issue/config_split-3328833
  • issue/config_split-3332194
  • issue/config_split-3325721
  • issue/config_split-3034589
  • issue/config_split-3273718
  • issue/config_split-3362191
  • issue/config_split-3298341
  • issue/config_split-3295853
  • issue/config_split-3386425
  • issue/config_split-3395243
  • issue/config_split-3396813
  • issue/config_split-3424108
  • issue/config_split-3426621
  • issue/config_split-3438245
  • issue/config_split-3428560
  • issue/config_split-3435910
  • issue/config_split-3432611
  • issue/config_split-3433305
  • issue/config_split-3479607
  • issue/config_split-3486027
  • issue/config_split-3492375
  • issue/config_split-3495075
  • issue/config_split-3390285
  • issue/config_split-3504053
  • issue/config_split-3505566
  • issue/config_split-3513818
  • issue/config_split-3514034
57 results
Show changes
Commits on Source (4)
Showing
with 70 additions and 63 deletions
......@@ -9,3 +9,4 @@ phplint
Shortcutting
Stackable
stackable
databasename
......@@ -5,6 +5,7 @@ entity.config_split.enable:
_controller: '\Drupal\config_split\Controller\ConfigSplitController::enableEntity'
requirements:
_permission: 'administer configuration split'
_csrf_token: 'TRUE'
entity.config_split.disable:
path: '/admin/config/development/configuration/config-split/{config_split}/disable'
......@@ -12,6 +13,7 @@ entity.config_split.disable:
_controller: '\Drupal\config_split\Controller\ConfigSplitController::disableEntity'
requirements:
_permission: 'administer configuration split'
_csrf_token: 'TRUE'
# Importing or activating the split writes the split config to the active one.
entity.config_split.activate:
......
grumphp:
git_hook_variables:
EXEC_GRUMPHP_COMMAND: ['docker-compose', 'run', '--rm', '--no-deps', 'drupal']
ascii:
succeeded: ~
tasks:
phpcs: ~
phplint: ~
phpunit: ~
# phpstan: ~
......@@ -90,6 +90,8 @@ public function splitActivate($split) {
*
* @param string $split
* The split configuration to deactivate.
* @param array $options
* The options.
*
* @command config-split:deactivate
*
......@@ -102,7 +104,7 @@ public function splitActivate($split) {
* Propose an alias at:
* https://www.drupal.org/project/config_split/issues/3181368
*/
public function splitDeactivate($split, $options = ['override' => FALSE]) {
public function splitDeactivate($split, array $options = ['override' => FALSE]) {
return $this->cliService->ioDeactivate($split, $this->io(), 'dt', FALSE, $options['override']) ? DrushCommands::EXIT_SUCCESS : DrushCommands::EXIT_FAILURE;
}
......
......@@ -52,7 +52,7 @@ protected static function eventDispatcher() {
/**
* {@inheritdoc}
*/
public function dispatch(object $event, string $eventName = NULL): object {
public function dispatch(object $event, ?string $eventName = NULL): object {
// Do nothing, just return the event.
return $event;
}
......
......@@ -47,7 +47,7 @@ public function __construct(StateInterface $state, CacheTagsInvalidatorInterface
* @param bool|null $active
* The state, null to reset.
*/
public function setSplitOverride(string $name, bool $active = NULL) {
public function setSplitOverride(string $name, ?bool $active = NULL) {
$name = self::fixName($name);
$overrides = $this->state->get('config_split_override_state', []);
if ($active === NULL) {
......
......@@ -79,7 +79,7 @@ public function __construct(
ConfigSplitManager $manager,
StorageInterface $activeStorage,
StorageInterface $syncStorage,
StatusOverride $statusOverride
StatusOverride $statusOverride,
) {
$this->manager = $manager;
$this->activeStorage = $activeStorage;
......
......@@ -108,7 +108,7 @@ public function __construct(
StorageInterface $sync,
StorageInterface $export,
Connection $connection,
ConfigPatchMerge $patchMerge
ConfigPatchMerge $patchMerge,
) {
$this->factory = $factory;
$this->sync = $sync;
......@@ -130,7 +130,7 @@ public function __construct(
* @return \Drupal\Core\Config\ImmutableConfig|null
* The split config.
*/
public function getSplitConfig(string $name, StorageInterface $storage = NULL): ?ImmutableConfig {
public function getSplitConfig(string $name, ?StorageInterface $storage = NULL): ?ImmutableConfig {
if (strpos($name, 'config_split.config_split.') !== 0) {
$name = 'config_split.config_split.' . $name;
}
......@@ -181,7 +181,7 @@ public function getSplitEntity(string $name): ?ConfigSplitEntity {
* @return string[]
* The split names from the active storage and the given storage.
*/
public function listAll(StorageInterface $storage = NULL): array {
public function listAll(?StorageInterface $storage = NULL): array {
$names = [];
if ($storage instanceof StorageInterface && $this->factory instanceof ConfigFactory) {
$factory = EphemeralConfigFactory::fromService($this->factory, $storage);
......@@ -202,7 +202,7 @@ public function listAll(StorageInterface $storage = NULL): array {
* @return \Drupal\Core\Config\ImmutableConfig[]
* Loaded splits (with config overrides).
*/
public function loadMultiple(array $names, StorageInterface $storage = NULL): array {
public function loadMultiple(array $names, ?StorageInterface $storage = NULL): array {
$configs = [];
if ($storage instanceof StorageInterface && $this->factory instanceof ConfigFactory) {
$factory = EphemeralConfigFactory::fromService($this->factory, $storage);
......@@ -509,7 +509,7 @@ public function mergeSplit(ImmutableConfig $config, StorageInterface $transformi
* @return \Drupal\Core\Config\StorageInterface|null
* The split storage.
*/
protected function getSplitStorage(ImmutableConfig $config, StorageInterface $transforming = NULL): ?StorageInterface {
protected function getSplitStorage(ImmutableConfig $config, ?StorageInterface $transforming = NULL): ?StorageInterface {
$storage = $config->get('storage');
if ('collection' === $storage) {
if ($transforming instanceof StorageInterface) {
......@@ -564,7 +564,7 @@ protected function getSplitStorage(ImmutableConfig $config, StorageInterface $tr
* @return \Drupal\Core\Config\StorageInterface|null
* The preview storage.
*/
public function getPreviewStorage(ImmutableConfig $config, StorageInterface $transforming = NULL): ?StorageInterface {
public function getPreviewStorage(ImmutableConfig $config, ?StorageInterface $transforming = NULL): ?StorageInterface {
if ('collection' === $config->get('storage')) {
if ($transforming instanceof StorageInterface) {
return new SplitCollectionStorage($transforming, $config->get('id'));
......@@ -975,6 +975,8 @@ protected static function inFilterList($name, array $list) {
*
* @param \Drupal\Core\Config\ImmutableConfig $config
* The split config.
* @param \Drupal\Core\Config\StorageInterface $source
* The source storage.
*
* @return string[]
* The list of config names.
......@@ -1002,15 +1004,15 @@ protected function calculateCompleteSplitList(ImmutableConfig $config, StorageIn
$completeList = array_filter($source->listAll(), function ($name) use ($extensions, $completeList) {
// Filter the list of config objects since they are not included in
// findConfigEntityDependents.
foreach ($extensions as $extension) {
if (strpos($name, $extension . '.') === 0) {
return TRUE;
}
foreach ($extensions as $extension) {
if (strpos($name, $extension . '.') === 0) {
return TRUE;
}
}
// Add the config name to the blacklist if it is in the wildcard list.
return self::inFilterList($name, $completeList);
}
}
);
sort($completeList);
// Finally merge all dependencies of the blacklisted config.
......@@ -1024,6 +1026,8 @@ protected function calculateCompleteSplitList(ImmutableConfig $config, StorageIn
*
* @param \Drupal\Core\Config\ImmutableConfig $config
* The split config.
* @param \Drupal\Core\Config\StorageInterface $source
* The source storage.
*
* @return string[]
* The list of config names.
......@@ -1039,7 +1043,7 @@ protected function calculateConditionalSplitList(ImmutableConfig $config, Storag
$partialList = array_filter($source->listAll(), function ($name) use ($partialList) {
// Add to the partial list if it is in the wildcard list.
return self::inFilterList($name, $partialList);
}
}
);
sort($partialList);
......
......@@ -74,7 +74,7 @@ public function __construct(
EntityTypeManagerInterface $entityTypeManager,
ConfigManagerInterface $configManager,
DiffFormatter $diffFormatter,
ConfigSplitManager $configSplitManager
ConfigSplitManager $configSplitManager,
) {
$this->activeStorage = $activeStorage;
$this->entityTypeManager = $entityTypeManager;
......
......@@ -120,7 +120,7 @@ public function __call($name, $arguments) {
* @return \Drupal\Core\Config\ImmutableConfig[]
* The default priority configs.
*/
protected function getDefaultPrioritySplitConfigs(StorageInterface $storage = NULL): array {
protected function getDefaultPrioritySplitConfigs(?StorageInterface $storage = NULL): array {
$names = $this->manager->listAll($storage);
$explicit = Settings::get('config_split_priorities', []);
if (is_array($explicit)) {
......
......@@ -56,7 +56,7 @@ trait ConfigImportFormTrait {
public function __construct(
StorageInterface $activeStorage,
ConfigSplitManager $configSplitManager,
StatusOverride $statusOverride
StatusOverride $statusOverride,
) {
$this->activeStorage = $activeStorage;
$this->manager = $configSplitManager;
......@@ -82,7 +82,7 @@ protected function buildFormWithStorageComparer(
FormStateInterface $form_state,
StorageComparer $storage_comparer,
array $options,
$validate = TRUE
$validate = TRUE,
) {
$form['actions'] = ['#type' => 'actions'];
$form['actions']['submit'] = [
......@@ -200,7 +200,7 @@ protected function buildFormWithStorageComparer(
/**
* {@inheritdoc}
*/
protected function launchImport(StorageInterface $storage, string $override = NULL) {
protected function launchImport(StorageInterface $storage, ?string $override = NULL) {
$comparer = new StorageComparer($storage, $this->activeStorage);
$config_importer = $this->getConfigImporterFromComparer($comparer);
if ($config_importer->alreadyImporting()) {
......
......@@ -85,7 +85,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
* @param \Drupal\Core\Session\AccountInterface $account
* Run access checks for this account.
* @param string $config_split
* The split name form the route.
* The split name form the route.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
......
......@@ -4,7 +4,8 @@
use Drupal\config_split\Config\StatusOverride;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\Extension\ModuleExtensionList;
use Drupal\Core\Extension\ThemeExtensionList;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Site\Settings;
use Drupal\Core\State\StateInterface;
......@@ -30,11 +31,18 @@ class ConfigSplitEntityForm extends EntityForm {
protected $state;
/**
* Drupal\Core\Extension\ThemeHandler definition.
* The module list.
*
* @var \Drupal\Core\Extension\ThemeHandlerInterface
* @var \Drupal\Core\Extension\ModuleExtensionList
*/
protected $themeHandler;
protected $moduleExtensionList;
/**
* The theme list.
*
* @var \Drupal\Core\Extension\ThemeExtensionList
*/
protected $themeExtensionList;
/**
* The entity being used by this form.
......@@ -50,17 +58,21 @@ class ConfigSplitEntityForm extends EntityForm {
* The split status override service.
* @param \Drupal\Core\State\StateInterface $state
* The drupal state.
* @param \Drupal\Core\Extension\ThemeHandlerInterface $themeHandler
* The theme handler.
* @param \Drupal\Core\Extension\ModuleExtensionList $moduleExtensionList
* The module list.
* @param \Drupal\Core\Extension\ThemeExtensionList $themeExtensionList
* The theme list.
*/
public function __construct(
StatusOverride $statusOverride,
StateInterface $state,
ThemeHandlerInterface $themeHandler
ModuleExtensionList $moduleExtensionList,
ThemeExtensionList $themeExtensionList,
) {
$this->statusOverride = $statusOverride;
$this->state = $state;
$this->themeHandler = $themeHandler;
$this->moduleExtensionList = $moduleExtensionList;
$this->themeExtensionList = $themeExtensionList;
}
/**
......@@ -70,7 +82,8 @@ public static function create(ContainerInterface $container) {
return new static(
$container->get('config_split.status_override'),
$container->get('state'),
$container->get('theme_handler')
$container->get('extension.list.module'),
$container->get('extension.list.theme'),
);
}
......@@ -184,10 +197,10 @@ public function form(array $form, FormStateInterface $form_state) {
recorded in a config patch saved in in the split storage."),
];
$module_handler = $this->moduleHandler;
$module_handler = $this->moduleExtensionList;
$modules = array_map(function ($module) use ($module_handler) {
return $module_handler->getName($module->getName());
}, $module_handler->getModuleList());
}, $module_handler->getList());
// Add the existing ones with the machine name, so they do not get lost.
foreach (array_diff_key($config->get('module'), $modules) as $missing => $weight) {
$modules[$missing] = $missing;
......@@ -214,10 +227,10 @@ public function form(array $form, FormStateInterface $form_state) {
];
// We should probably find a better way for this.
$theme_handler = $this->themeHandler;
$theme_handler = $this->themeExtensionList;
$themes = array_map(function ($theme) use ($theme_handler) {
return $theme_handler->getName($theme->getName());
}, $theme_handler->listInfo());
}, $theme_handler->getList());
$form['complete_fieldset']['theme'] = [
'#type' => $multiselect_type,
'#title' => $this->t('Themes'),
......
......@@ -56,7 +56,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
* @param \Drupal\Core\Session\AccountInterface $account
* Run access checks for this account.
* @param string $config_split
* The split name form the route.
* The split name form the route.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
......
......@@ -68,7 +68,7 @@ protected function setUp(): void {
* @return string[][]
* The different storage types.
*/
public function storageAlternativesProvider(): array {
public static function storageAlternativesProvider(): array {
return [['folder'], ['collection'], ['database']];
}
......@@ -266,8 +266,6 @@ public function testConditionalSplitWithModuleConfig($storage) {
$expectedExport->write($name, $originalSystem);
}
else {
// The option "skip equal" is false, write to both.
// $expectedSplit->write($name, $data);
$expectedExport->write($name, $data);
}
}
......
......@@ -52,7 +52,7 @@ protected function setUp(): void {
*
* @dataProvider sequenceProvider
*/
public function testSequencePatch(string $name, array $configA, array $configB, ConfigPatch $expectedAB = NULL) {
public function testSequencePatch(string $name, array $configA, array $configB, ?ConfigPatch $expectedAB = NULL) {
// Create patches in both directions.
$patchAB = $this->patchMerge->createPatch($configA, $configB, $name);
$patchBA = $this->patchMerge->createPatch($configB, $configA, $name);
......@@ -75,7 +75,7 @@ public function testSequencePatch(string $name, array $configA, array $configB,
/**
* Data provider for complex examples with a real schema.
*/
public function sequenceProvider() {
public static function sequenceProvider() {
$a = [
'nested' => [
[
......@@ -144,7 +144,6 @@ public function sequenceProvider() {
],
]);
// cSpell:enable
yield 'first test' => [
'name' => 'config_split_sequence_test.nested_sequences',
'configA' => $a,
......
......@@ -107,7 +107,6 @@ public function testRoleSplit() {
'removing' => [],
]);
foreach (['test_role', 'test_role_empty'] as $id) {
// The patches look the same for all.
$patch = $storage->createCollection('split.test_split')->read('config_split.patch.user.role.' . $id);
......@@ -121,10 +120,10 @@ public function testRoleSplit() {
}
/**
* Test splitting a role into multiple "feature-splits"
* Test splitting a role into multiple "feature-splits".
*/
public function testRoleMultiSplit() {
// We use shortcut and block to create the "feature-splits"
// We use shortcut and block to create the "feature-splits".
$this->enableModules(['shortcut', 'block']);
// Create a role with permissions from both modules.
......@@ -138,7 +137,6 @@ public function testRoleMultiSplit() {
]);
$role->save();
// Create a split for the shortcut module.
$this->createSplitConfig('feature_shortcut', [
// We use the collection storage so that we can read the patch directly.
......@@ -180,10 +178,9 @@ public function testRoleMultiSplit() {
'removing' => [],
]);
foreach (['feature_shortcut','feature_block'] as $id) {
foreach (['feature_shortcut', 'feature_block'] as $id) {
// Check if the split actually has the expected configs.
$patch = $storage->createCollection('split.'.$id)->read('config_split.patch.user.role.test_role');
$patch = $storage->createCollection('split.' . $id)->read('config_split.patch.user.role.test_role');
self::assertEquals($expectedPatches[$id]->toArray(), $patch);
}
}
......
......@@ -100,7 +100,7 @@ protected function setUp(): void {
* @return string[][]
* The different storage types.
*/
public function storageAlternativesProvider(): array {
public static function storageAlternativesProvider(): array {
return [['folder'], ['collection'], ['database']];
}
......
......@@ -69,7 +69,7 @@ protected function setUp(): void {
* @return string[][]
* The different storage types.
*/
public function storageAlternativesProvider(): array {
public static function storageAlternativesProvider(): array {
return [['folder'], ['collection'], ['database']];
}
......
......@@ -91,7 +91,7 @@ protected function getSplitSourceStorage(Config $config): StorageInterface {
* @return \Drupal\Core\Config\StorageInterface
* The storage.
*/
protected function getSplitPreviewStorage(Config $config, StorageInterface $export = NULL): StorageInterface {
protected function getSplitPreviewStorage(Config $config, ?StorageInterface $export = NULL): StorageInterface {
if ('collection' === $config->get('storage')) {
if ($export === NULL) {
throw new \InvalidArgumentException();
......@@ -179,7 +179,8 @@ protected function validateImport(StorageInterface $storage): void {
$container->get('module_installer'),
$container->get('theme_handler'),
$container->get('string_translation'),
$container->get('extension.list.module')
$container->get('extension.list.module'),
$container->get('extension.list.theme'),
);
$importer->validate();
......