Commit 4ccdb414 authored by catch's avatar catch

Issue #2293773 by Gábor Hojtsy, alexpott, penyaskito: Fixed migrations use...

Issue #2293773 by Gábor Hojtsy, alexpott, penyaskito: Fixed migrations use dots in key names - not allowed in config.
parent 8b72eb1e
......@@ -70,7 +70,7 @@ public static function create(ContainerInterface $container, array $configuratio
public function import(Row $row, array $old_destination_id_values = array()) {
foreach ($row->getRawDestination() as $key => $value) {
if (isset($value) || !empty($this->configuration['store null'])) {
$this->config->set($key, $value);
$this->config->set(str_replace(Row::PROPERTY_SEPARATOR, '.', $key), $value);
}
}
$this->config->save();
......
......@@ -75,7 +75,7 @@ public function getIds() {
*/
protected function updateEntity(EntityInterface $entity, Row $row) {
foreach ($row->getRawDestination() as $property => $value) {
$this->updateEntityProperty($entity, explode('.', $property), $value);
$this->updateEntityProperty($entity, explode(Row::PROPERTY_SEPARATOR, $property), $value);
}
}
......
......@@ -36,6 +36,11 @@ class Row {
*/
protected $destination = array();
/**
* Level separator of destination and source properties.
*/
const PROPERTY_SEPARATOR = '/';
/**
* The mapping between source and destination identifiers.
*
......@@ -119,7 +124,7 @@ public function getSourceIdValues() {
* TRUE if the source has property; FALSE otherwise.
*/
public function hasSourceProperty($property) {
return NestedArray::keyExists($this->source, explode('.', $property));
return NestedArray::keyExists($this->source, explode(static::PROPERTY_SEPARATOR, $property));
}
/**
......@@ -132,7 +137,7 @@ public function hasSourceProperty($property) {
* The found returned property or NULL if not found.
*/
public function getSourceProperty($property) {
$return = NestedArray::getValue($this->source, explode('.', $property), $key_exists);
$return = NestedArray::getValue($this->source, explode(static::PROPERTY_SEPARATOR, $property), $key_exists);
if ($key_exists) {
return $return;
}
......@@ -165,7 +170,7 @@ public function setSourceProperty($property, $data) {
throw new \Exception("The source is frozen and can't be changed any more");
}
else {
NestedArray::setValue($this->source, explode('.', $property), $data, TRUE);
NestedArray::setValue($this->source, explode(static::PROPERTY_SEPARATOR, $property), $data, TRUE);
}
}
......@@ -186,7 +191,7 @@ public function freezeSource() {
* TRUE if the destination property exists.
*/
public function hasDestinationProperty($property) {
return NestedArray::keyExists($this->destination, explode('.', $property));
return NestedArray::keyExists($this->destination, explode(static::PROPERTY_SEPARATOR, $property));
}
/**
......@@ -199,7 +204,7 @@ public function hasDestinationProperty($property) {
*/
public function setDestinationProperty($property, $value) {
$this->rawDestination[$property] = $value;
NestedArray::setValue($this->destination, explode('.', $property), $value, TRUE);
NestedArray::setValue($this->destination, explode(static::PROPERTY_SEPARATOR, $property), $value, TRUE);
}
/**
......@@ -215,10 +220,10 @@ public function getDestination() {
/**
* Returns the raw destination. Rarely necessary.
*
* For example calling setDestination('foo:bar', 'baz') results in
* For example calling setDestination('foo/bar', 'baz') results in
* @code
* $this->destination['foo']['bar'] = 'baz';
* $this->rawDestination['foo.bar'] = 'baz';
* $this->rawDestination['foo/bar'] = 'baz';
* @encode
*
* @return array
......@@ -238,7 +243,7 @@ public function getRawDestination() {
* The destination value.
*/
public function getDestinationProperty($property) {
return NestedArray::getValue($this->destination, explode('.', $property));
return NestedArray::getValue($this->destination, explode(static::PROPERTY_SEPARATOR, $property));
}
/**
......
......@@ -248,8 +248,8 @@ public function testDestination() {
public function testMultipleDestination() {
$row = new Row($this->testValues, $this->testSourceIds);
// Set some deep nested values.
$row->setDestinationProperty('image.alt', 'alt text');
$row->setDestinationProperty('image.fid', 3);
$row->setDestinationProperty('image/alt', 'alt text');
$row->setDestinationProperty('image/fid', 3);
$this->assertTrue($row->hasDestinationProperty('image'));
$this->assertFalse($row->hasDestinationProperty('alt'));
......@@ -258,8 +258,8 @@ public function testMultipleDestination() {
$destination = $row->getDestination();
$this->assertEquals('alt text', $destination['image']['alt']);
$this->assertEquals(3, $destination['image']['fid']);
$this->assertEquals('alt text', $row->getDestinationProperty('image.alt'));
$this->assertEquals(3, $row->getDestinationProperty('image.fid'));
$this->assertEquals('alt text', $row->getDestinationProperty('image/alt'));
$this->assertEquals(3, $row->getDestinationProperty('image/fid'));
}
}
......@@ -14,10 +14,10 @@ process:
fetcher: aggregator_fetcher
parser: aggregator_parser
processors: aggregator_processors
'items.allowed_html': aggregator_allowed_html_tags
'items.teaser_length': aggregator_teaser_length
'items.expire': aggregator_clear
'source.list_max': aggregator_summary_items
'items/allowed_html': aggregator_allowed_html_tags
'items/teaser_length': aggregator_teaser_length
'items/expire': aggregator_clear
'source/list_max': aggregator_summary_items
destination:
plugin: config
config_name: aggregator.settings
......@@ -54,8 +54,8 @@ process:
- delta
- settings
- visibility
'settings.visibility.request_path.pages': pages
'settings.visibility.user_role.roles': roles
'settings/visibility/request_path/pages': pages
'settings/visibility/user_role/roles': roles
destination:
plugin: entity:block
migration_dependencies:
......
......@@ -4,9 +4,9 @@ source:
plugin: d6_book
process:
nid: nid
book.bid: bid
book.weight: weight
book.pid:
'book/bid': bid
'book/weight': weight
'book/pid':
-
plugin: skip_process_on_empty
source: plid
......
......@@ -8,7 +8,7 @@ source:
- book_allowed_types
process:
child_type: book_child_type
'block.navigation.mode': book_block_mode
'block/navigation/mode': book_block_mode
allowed_types: book_allowed_types
destination:
plugin: config
......
......@@ -19,9 +19,9 @@ process:
plugin: migration
migration: d6_node
source: nid
entity_type: constants.entity_type
field_name: constants.field_name
comment_type: constants.comment_type
entity_type: 'constants/entity_type'
field_name: 'constants/field_name'
comment_type: 'constants/comment_type'
subject: subject
uid:
-
......@@ -38,8 +38,8 @@ process:
changed: timestamp
status: status #In D6, published=0. We reverse the value in prepareRow.
thread: thread
'comment_body.value': comment
'comment_body.format':
'comment_body/value': comment
'comment_body/format':
plugin: migration
migration: d6_filter_format
source: format
......
......@@ -11,10 +11,10 @@ source:
type: comment_default
weight: 20
process:
entity_type: constants.entity_type
field_name: constants.field_name
view_mode: constants.view_mode
options: constants.options
entity_type: 'constants/entity_type'
field_name: 'constants/field_name'
view_mode: 'constants/view_mode'
options: 'constants/options'
bundle: node_type
destination:
......
......@@ -10,10 +10,10 @@ source:
type: comment_default
weight: 20
process:
entity_type: constants.entity_type
field_name: constants.field_name
form_mode: constants.form_mode
options: constants.options
entity_type: 'constants/entity_type'
field_name: 'constants/field_name'
form_mode: 'constants/form_mode'
options: 'constants/options'
bundle: node_type
destination:
......
......@@ -10,10 +10,10 @@ source:
settings:
content_type: comment
process:
entity_type: constants.entity_type
id: constants.id
name: constants.name
type: constants.type
settings: constants.settings
entity_type: 'constants/entity_type'
id: 'constants/id'
name: 'constants/name'
type: 'constants/type'
settings: 'constants/settings'
destination:
plugin: entity:field_config
......@@ -8,19 +8,19 @@ source:
label: Comment settings
required: true
process:
entity_type: constants.entity_type
field_name: constants.field_name
label: constants.label
required: constants.required
entity_type: 'constants/entity_type'
field_name: 'constants/field_name'
label: 'constants/label'
required: 'constants/required'
bundle: node_type
'default_value.0.status': comment
'settings.default_mode': comment_default_mode
'settings.per_page': comment_default_per_page
'settings.anonymous': comment_anonymous
'settings.subject': comment_subject_field
'settings.form_location': comment_form_location
'settings.preview': comment_preview
'default_value/0/status': comment
'settings/default_mode': comment_default_mode
'settings/per_page': comment_default_per_page
'settings/anonymous': comment_anonymous
'settings/subject': comment_subject_field
'settings/form_location': comment_form_location
'settings/preview': comment_preview
destination:
plugin: entity:field_instance_config
migration_dependencies:
......
......@@ -17,9 +17,9 @@ source:
label: comment
description: comment
process:
target_entity_type_id: constants.entity_type
id: constants.id
label: constants.label
description: constants.description
target_entity_type_id: 'constants/entity_type'
id: 'constants/id'
label: 'constants/label'
description: 'constants/description'
destination:
plugin: entity:comment_type
......@@ -7,7 +7,7 @@ source:
- contact_hourly_threshold
process:
user_default_enabled: contact_default_status
'flood.limit': contact_hourly_threshold
'flood/limit': contact_hourly_threshold
default_category:
plugin: migration
migration: d6_contact_category
......
......@@ -6,13 +6,13 @@ source:
type: basic
process:
id: bid
type: constants.type
type: 'constants/type'
info: info
'body.format':
'body/format':
plugin: migration
migration: d6_filter_format
source: format
'body.value': body
'body/value': body
destination:
plugin: entity:block_content
migration_dependencies:
......
......@@ -14,6 +14,6 @@ process:
date_format_long: long
date_format_short: short
date_format_medium: medium
'pattern.php': value
pattern: value
destination:
plugin: entity:date_format
......@@ -6,9 +6,9 @@ source:
entity_type: node
langcode: und
process:
entity_type: constants.entity_type
entity_type: 'constants/entity_type'
status: active
langcode: constants.langcode
langcode: 'constants/langcode'
name: field_name
type:
-
......
......@@ -21,7 +21,7 @@ process:
- 1
-
plugin: skip_row_on_empty
entity_type: constants.entity_type
entity_type: 'constants/entity_type'
bundle: type_name
view_mode:
-
......@@ -34,15 +34,15 @@ process:
index:
- 1
field_name: field_name
"options.label": label
"options.weight": weight
"options.type":
"options/label": label
"options/weight": weight
"options/type":
-
plugin: static_map
bypass: true
source:
- type
- "display_settings.format"
- 'display_settings/format'
map:
text:
default: text_default
......@@ -164,13 +164,13 @@ process:
default: string
-
plugin: field_type_defaults
"options.settings":
"options/settings":
-
plugin: static_map
bypass: true
source:
- module
- "display_settings.format"
- 'display_settings/format'
map:
number:
us_0:
......@@ -291,7 +291,7 @@ process:
trim_length: 600
-
plugin: field_formatter_settings_defaults
"options.third_party_settings": constants.third_party_settings
"options/third_party_settings": 'constants/third_party_settings'
destination:
plugin: component_entity_display
......
......@@ -20,7 +20,7 @@ process:
- 1
-
plugin: skip_row_on_empty
entity_type: constants.entity_type
entity_type: 'constants/entity_type'
field_name: field_name
bundle: type_name
label: label
......
......@@ -23,11 +23,11 @@ process:
-
plugin: skip_row_on_empty
bundle: type_name
form_mode: constants.form_mode
form_mode: 'constants/form_mode'
field_name: field_name
entity_type: constants.entity_type
"options.weight": weight
"options.type":
entity_type: 'constants/entity_type'
'options/weight': weight
'options/type':
type:
plugin: static_map
bypass: true
......@@ -45,13 +45,13 @@ process:
optionwidgets_onoff: options_onoff
optionwidgets_buttons: options_buttons
optionwidgets_select: options_select
"options.settings":
'options/settings':
-
plugin: field_instance_widget_settings
source:
- widget_type
- widget_settings
"options.third_party_settings": constants.third_party_settings
'options/third_party_settings': 'constants/third_party_settings'
destination:
plugin: component_entity_form_display
......
......@@ -7,9 +7,9 @@ source:
- file_description_length
- file_icon_directory
process:
'description.type': file_description_type
'description.length': file_description_length
'icon.directory': file_icon_directory
'description/type': file_description_type
'description/length': file_description_length
'icon/directory': file_icon_directory
destination:
plugin: config
config_name: file.settings
......@@ -9,11 +9,11 @@ source:
- forum_block_num_0
- forum_block_num_1
process:
'block.active.limit': forum_block_num_0
'block.new.limit': forum_block_num_1
'topics.hot_threshold': forum_hot_topic
'topics.page_limit': forum_per_page
'topics.order': forum_order
'block/active/limit': forum_block_num_0
'block/new/limit': forum_block_num_1
'topics/hot_threshold': forum_hot_topic
'topics/page_limit': forum_per_page
'topics/order': forum_order
destination:
plugin: config
config_name: forum.settings
......@@ -7,7 +7,7 @@ source:
- locale_js_directory
process:
cache_strings: locale_cache_strings
'javascript.directory': locale_js_directory
'javascript/directory': locale_js_directory
destination:
plugin: config
config_name: locale.settings
......@@ -14,11 +14,11 @@ process:
changed: changed
promote: promote
sticky: sticky
body.format:
'body/format':
plugin: migration
migration: d6_filter_format
source: format
body.value: body
'body/value': body
# unmapped d6 fields.
# tnid
......
......@@ -14,11 +14,11 @@ process:
changed: changed
promote: promote
sticky: sticky
body.format:
'body/format':
plugin: migration
migration: d6_filter_format
source: format
body.value: body
'body/value': body
# unmapped d6 fields.
# tnid
......
......@@ -12,7 +12,7 @@ process:
description: description
help: help
title_label: title_label
preview: constants.preview
preview: 'constants/preview'
submitted: submitted
options: options
create_body: has_body
......
......@@ -14,10 +14,10 @@ source:
path: node
plugin: node_search
process:
id: constants.id
path: constants.path
plugin: constants.plugin
configuration.rankings:
id: 'constants/id'
path: 'constants/path'
plugin: 'constants/plugin'
'configuration/rankings':
plugin: d6_search_configuration_rankings
destination:
plugin: entity:search_page
......@@ -9,9 +9,9 @@ source:
- search_tag_weights
- search_and_or_limit
process:
'index.minimum_word_size': minimum_word_size
'index.overlap_cjk': overlap_cjk
'index.cron_limit': search_cron_limit
'index/minimum_word_size': minimum_word_size
'index/overlap_cjk': overlap_cjk
'index/cron_limit': search_cron_limit
destination:
plugin: config
config_name: search.settings
......@@ -10,9 +10,9 @@ source:
- simpletest_verbose
process:
clear_results: simpletest_clear_results
'httpauth.method': simpletest_httpauth_method
'httpauth.password': simpletest_httpauth_password
'httpauth.username': simpletest_httpauth_username
'httpauth/method': simpletest_httpauth_method
'httpauth/password': simpletest_httpauth_password
'httpauth/username': simpletest_httpauth_username
verbose: simpletest_verbose
destination:
plugin: config
......
......@@ -10,12 +10,12 @@ source:
- statistics_block_top_all_num
- statistics_block_top_last_num