diff --git a/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlSourceTestCase.php b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlSourceTestCase.php index 598db2c..98db38eb 100644 --- a/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlSourceTestCase.php +++ b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlSourceTestCase.php @@ -6,6 +6,7 @@ */ namespace Drupal\migrate\Tests; + use Drupal\Core\Cache\CacheBackendInterface; use Drupal\migrate\Source; diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_action_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_action_settings.yml index d9da486..aa2394d 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_action_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_action_settings.yml @@ -1,4 +1,5 @@ id: d6_action_settings +label: Drupal 6 action configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_aggregator_feed.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_aggregator_feed.yml new file mode 100644 index 0000000..d7366ea --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_aggregator_feed.yml @@ -0,0 +1,20 @@ +id: d6_aggregator_feed +label: Drupal 6 aggregator feeds + +source: + plugin: d6_aggregator_feed + +process: + fid: fid + title: title + url: url + refresh: refresh + checked: checked + link: link + description: description + image: image + etag: etag + modified: modified + +destination: + plugin: entity:aggregator_feed diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_aggregator_item.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_aggregator_item.yml new file mode 100644 index 0000000..2147872 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_aggregator_item.yml @@ -0,0 +1,21 @@ +id: d6_aggregator_item +label: Drupal 6 aggregator items +source: + plugin: d6_aggregator_item +process: + iid: iid + fid: + plugin: migration + migration: d6_aggregator_feed + source: + - fid + title: title + link: link + author: author + description: description + timestamp: timestamp + guid: guid +destination: + plugin: entity:aggregator_item +migration_dependencies: + - d6_aggregator_feed diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_aggregator_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_aggregator_settings.yml index a5f99be..1240261 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_aggregator_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_aggregator_settings.yml @@ -1,4 +1,5 @@ id: d6_aggregator_settings +label: Drupal 6 aggregator configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_block.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_block.yml new file mode 100644 index 0000000..1a9db7a --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_block.yml @@ -0,0 +1,61 @@ +id: d6_block +label: Drupal 6 blocks +source: + plugin: d6_block +process: + id: + # We need something unique, so aggregator, aggregator_1 etc will do. + plugin: dedupe_entity + entity_type: block + field: id + postfix: _ + source: module + plugin: + - + plugin: static_map + bypass: true + source: + - module + - delta + map: + book: + 0: book_navigation + comment: + 0: views_block:comments_recent-block_1 + forum: + 0: forum_active_block + 1: forum_new_block + locale: + 0: language_block + node: + 0: node_syndicate_block + search: + 0: search_form_block + statistics: + 0: statistics_popular_block + system: + 0: system_powered_by_block + user: + 0: user_login_block + 1: system_menu_block:tools + 2: views_block:who_s_new-block_1 + 3: views_block:who_s_online-who_s_online_block + - + plugin: d6_block_plugin_id + region: region + theme: theme + label: title + 'visibility.path.visibility': visibility + 'visibility.path.pages': pages + 'visibility.role.roles': roles + weight: weight + settings: + plugin: d6_block_settings + source: + - @plugin + - delta + - settings +destination: + plugin: entity:block +migration_dependencies: + - d6_menu: false diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_book.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_book.yml new file mode 100644 index 0000000..b746186 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_book.yml @@ -0,0 +1,19 @@ +id: d6_book +label: Drupal 6 books +source: + plugin: d6_book +process: + nid: nid + book.bid: bid + book.weight: weight + book.pid: + - + plugin: skip_process_on_empty + source: plid + - + plugin: migration + migration: d6_book +destination: + plugin: book +migration_dependencies: + - d6_node diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_book_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_book_settings.yml index 9e1097f..0da3a45 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_book_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_book_settings.yml @@ -1,4 +1,5 @@ id: d6_book_settings +label: Drupal 6 book configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_cck_field_revision.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_cck_field_revision.yml new file mode 100644 index 0000000..d165707 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_cck_field_revision.yml @@ -0,0 +1,14 @@ +id: d6_cck_field_revision +label: Drupal 6 field revisions +load: + plugin: drupal_entity + bundle_migration: d6_node_type +source: + plugin: d6_cck_field_revision +process: + vid: vid +destination: + plugin: entity_revision:node +migration_dependencies: + - d6_cck_field_values + - d6_node_revision diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_cck_field_values.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_cck_field_values.yml new file mode 100644 index 0000000..3df7ead --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_cck_field_values.yml @@ -0,0 +1,18 @@ +id: d6_cck_field_values +label: Drupal 6 field values +load: + plugin: drupal_entity + bundle_migration: d6_node_type +source: + plugin: d6_cck_field_values +process: + nid: + plugin: migration + migration: d6_node + source: nid +destination: + plugin: entity:node +migration_dependencies: + - d6_node + - d6_field_formatter_settings + - d6_field_instance_widget_settings diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment.yml new file mode 100644 index 0000000..a9fe824 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment.yml @@ -0,0 +1,51 @@ +id: d6_comment +label: Drupal 6 comments +source: + plugin: d6_comment + constants: + field_id: node__comment + entity_type: node +process: + cid: cid + pid: + - + plugin: skip_process_on_empty + source: pid + - + plugin: migration + migration: d6_comment + entity_id: + plugin: migration + migration: d6_node + source: nid + entity_type: constants.entity_type + field_id: constants.field_id + subject: subject + uid: + - + plugin: skip_process_on_empty + source: uid + - + plugin: migration + migration: d6_user + name: name + mail: mail + homepage: homepage + hostname: hostname + created: timestamp + changed: timestamp + status: status #In D6, published=0. We reverse the value in prepareRow. + thread: thread + 'comment_body.value': comment + 'comment_body.format': + plugin: migration + migration: d6_filter_format + source: format +destination: + plugin: entity:comment +migration_dependencies: + - d6_node + - d6_user + - d6_comment_entity_display + - d6_comment_entity_form_display + - d6_filter_format diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_entity_display.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_entity_display.yml new file mode 100644 index 0000000..49e6405 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_entity_display.yml @@ -0,0 +1,23 @@ +id: d6_comment_entity_display +label: Drupal 6 comment display configuration +source: + plugin: d6_comment_variable + constants: + entity_type: node + field_name: comment + view_mode: default + options: + label: hidden + type: comment_default + weight: 20 +process: + entity_type: constants.entity_type + field_name: constants.field_name + view_mode: constants.view_mode + options: constants.options + + bundle: node_type +destination: + plugin: component_entity_display +migration_dependencies: + - d6_comment_field_instance diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_entity_form_display.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_entity_form_display.yml new file mode 100644 index 0000000..4577104 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_entity_form_display.yml @@ -0,0 +1,22 @@ +id: d6_comment_entity_form_display +label: Drupal 6 comment form display configuration +source: + plugin: d6_comment_variable + constants: + entity_type: node + field_name: comment + form_mode: default + options: + type: comment_default + weight: 20 +process: + entity_type: constants.entity_type + field_name: constants.field_name + form_mode: constants.form_mode + options: constants.options + + bundle: node_type +destination: + plugin: component_entity_form_display +migration_dependencies: + - d6_comment_field_instance diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_field.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_field.yml new file mode 100644 index 0000000..5c4dd3b --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_field.yml @@ -0,0 +1,16 @@ +id: d6_comment_field +label: Drupal 6 comment field configuration +source: + plugin: d6_comment_variable + constants: + entity_type: node + type: comment + id: node.comment + name: comment +process: + entity_type: constants.entity_type + id: constants.id + name: constants.name + type: constants.type +destination: + plugin: entity:field_config diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_field_instance.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_field_instance.yml new file mode 100644 index 0000000..a3f9612 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_field_instance.yml @@ -0,0 +1,28 @@ +id: d6_comment_field_instance +label: Drupal 6 comment field instance configuration +source: + plugin: d6_comment_variable + constants: + entity_type: node + field_name: comment + label: Comment settings + required: true +process: + 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 +destination: + plugin: entity:field_instance_config +migration_dependencies: + - d6_comment_field + - d6_node_type diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_contact_category.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_contact_category.yml new file mode 100644 index 0000000..f4e8a39 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_contact_category.yml @@ -0,0 +1,22 @@ +id: d6_contact_category +label: Drupal 6 contact category configuration + +source: + plugin: d6_contact_category + +process: + id: + - + plugin: machine_name + source: category + - + plugin: dedupe_entity + entity_type: user_role + field: cid + label: category + recipients: recipients + reply: reply + weight: weight + +destination: + plugin: entity:contact_category diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_contact_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_contact_settings.yml index 823944d..08a9dae 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_contact_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_contact_settings.yml @@ -1,4 +1,5 @@ id: d6_contact_settings +label: Drupal 6 contact configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_custom_block.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_custom_block.yml new file mode 100644 index 0000000..8efb510 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_custom_block.yml @@ -0,0 +1,19 @@ +id: d6_custom_block +label: Drupal 6 custom blocks +source: + plugin: d6_box + constants: + type: basic +process: + id: bid + type: constants.type + info: info + 'body.format': + plugin: migration + migration: d6_filter_format + source: format + 'body.value': body +destination: + plugin: entity:custom_block +migration_dependencies: + - d6_filter_format diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_date_formats.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_date_formats.yml new file mode 100644 index 0000000..734149b --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_date_formats.yml @@ -0,0 +1,19 @@ +id: d6_date_formats +label: Drupal 6 date format configuration +source: + plugin: variable_multirow + variables: + - date_format_long + - date_format_medium + - date_format_short +process: + id: + plugin: static_map + source: name + map: + date_format_long: long + date_format_short: short + date_format_medium: medium + 'pattern.php': value +destination: + plugin: entity:date_format diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_dblog_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_dblog_settings.yml index b998cd6..c4710d5 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_dblog_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_dblog_settings.yml @@ -1,4 +1,5 @@ id: d6_dblog_settings +label: Drupal 6 database logging configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_field.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_field.yml new file mode 100644 index 0000000..cb8f5d3 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_field.yml @@ -0,0 +1,83 @@ +id: d6_field +label: Drupal 6 field configuration +source: + plugin: d6_field + constants: + entity_type: node + langcode: und +process: + entity_type: constants.entity_type + status: active + langcode: constants.langcode + name: field_name + type: + - + plugin: static_map + bypass: true + source: + - type + map: + number_integer: integer + number_decimal: decimal + number_float: float + text: text + email: email + link: link + date: datetime + datestamp: datetime + datetime: datetime + fr_phone: telephone + be_phone: telephone + it_phone: telephone + el_phone: telephone + ch_phone: telephone + ca_phone: telephone + cr_phone: telephone + pa_phone: telephone + gb_phone: telephone + ru_phone: telephone + ua_phone: telephone + es_phone: telephone + au_phone: telephone + cs_phone: telephone + hu_phone: telephone + pl_phone: telephone + nl_phone: telephone + se_phone: telephone + za_phone: telephone + il_phone: telephone + nz_phone: telephone + br_phone: telephone + cl_phone: telephone + cn_phone: telephone + hk_phone: telephone + mo_phone: telephone + ph_phone: telephone + sg_phone: telephone + jo_phone: telephone + eg_phone: telephone + pk_phone: telephone + int_phone: telephone + - + plugin: file_image_handler + cardinality: + plugin: static_map + bypass: true + source: multiple + map: + 0: 1 + 1: -1 + settings: + plugin: field_settings + source: + - @type + - global_settings + - widget_settings + +destination: + plugin: entity:field_config +migration_dependencies: + # It is not possible to make this a requirement as d6_field_settings has no + # source id. However it also has no requirements so it will always run so a + # dependency is enough. + - d6_field_settings: false diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_formatter_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_formatter_settings.yml new file mode 100644 index 0000000..d41bc0a --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_formatter_settings.yml @@ -0,0 +1,298 @@ +id: d6_field_formatter_settings +label: Drupal 6 field formatter configuration +source: + plugin: d6_field_instance_per_view_mode + constants: + entity_type: node + +process: + # We skip field types that don't exist because they weren't migrated by the + # field migration. + field_type_exists: + - + plugin: migration + migration: d6_field + source: + - field_name + - + plugin: extract + index: + - 1 + - + plugin: skip_row_on_empty + entity_type: constants.entity_type + bundle: type_name + view_mode: + - + plugin: migration + migration: d6_view_modes + source: + - view_mode + - + plugin: extract + index: + - 1 + field_name: field_name + "options.label": label + "options.weight": weight + "options.type": + - + plugin: static_map + bypass: true + source: + - type + - "display_settings.format" + map: + text: + default: text_default + trimmed: text_trimmed + number_integer: + default: number_integer + us_0: number_integer + be_0: number_integer + fr_0: number_integer + unformatted: number_unformatted + number_float: + default: number_decimal + us_0: number_decimal + us_1: number_decimal + us_2: number_decimal + be_0: number_decimal + be_1: number_decimal + be_2: number_decimal + fr_0: number_decimal + fr_1: number_decimal + fr_2: number_decimal + unformatted: number_unformatted + number_decimal: + default: number_decimal + us_0: number_decimal + us_1: number_decimal + us_2: number_decimal + be_0: number_decimal + be_1: number_decimal + be_2: number_decimal + fr_0: number_decimal + fr_1: number_decimal + fr_2: number_decimal + unformatted: number_unformatted + email: + default: email_mailto + spamspan: email_mailto + contact: email_mailto + plain: string + link: + default: link + plain: link + absolute: link + title_plain: link + url: link + short: link + label: link + separate: link_separate + filefield: + default: file_default + url_plain: file_url_plain + path_plain: file_url_plan #unsure about this? + image_plain: image + image_nodelink: image + image_imagelink: image + fr_phone: + default: string + be_phone: + default: string + it_phone: + default: string + el_phone: + default: string + ch_phone: + default: string + ca_phone: + default: string + cr_phone: + default: string + pa_phone: + default: string + gb_phone: + default: string + ru_phone: + default: string + ua_phone: + default: string + es_phone: + default: string + au_phone: + default: string + cs_phone: + default: string + hu_phone: + default: string + pl_phone: + default: string + nl_phone: + default: string + se_phone: + default: string + za_phone: + default: string + il_phone: + default: string + nz_phone: + default: string + br_phone: + default: string + cl_phone: + default: string + cn_phone: + default: string + hk_phone: + default: string + mo_phone: + default: string + ph_phone: + default: string + sg_phone: + default: string + jo_phone: + default: string + eg_phone: + default: string + pk_phone: + default: string + int_phone: + default: string + - + plugin: field_type_defaults + "options.settings": + - + plugin: static_map + bypass: true + source: + - module + - "display_settings.format" + map: + number: + us_0: + scale: 0 + decimal_separator: . + thousand_separator: ',' + prefix_suffix: true + us_1: + scale: 1 + decimal_separator: . + thousand_separator: ',' + prefix_suffix: true + us_2: + scale: 2 + decimal_separator: . + thousand_separator: ',' + prefix_suffix: true + be_0: + scale: 0 + decimal_separator: ',' + thousand_separator: . + prefix_suffix: true + be_1: + scale: 1 + decimal_separator: ',' + thousand_separator: . + prefix_suffix: true + be_2: + scale: 2 + decimal_separator: ',' + thousand_separator: . + prefix_suffix: true + fr_0: + scale: 0 + decimal_separator: ',' + thousand_separator: ' ' + prefix_suffix: true + fr_1: + scale: 1 + decimal_separator: ',' + thousand_separator: ' ' + prefix_suffix: true + fr_2: + scale: 2 + decimal_separator: ',' + thousand_separator: ' ' + prefix_suffix: true + link: + default: + trim_length: '80' + url_only: 0 + url_plain: 0 + rel: 0 + target: 0 + plain: + trim_length: '80' + url_only: 1 + url_plain: 1 + rel: 0 + target: 0 + absolute: + trim_length: '80' + url_only: 1 + url_plain: 1 + rel: 0 + target: 0 + title_plain: #can't support title as plain text. + trim_length: '80' + url_only: 1 + url_plain: 1 + rel: 0 + target: 0 + url: + trim_length: '80' + url_only: 1 + url_plain: 0 + rel: 0 + target: 0 + short: #can't support hardcoded link text? + trim_length: '80' + url_only: 0 + url_plain: 0 + rel: 0 + target: 0 + label: # can't support label as link text? + trim_length: '80' + url_only: 0 + url_plain: 0 + rel: 0 + target: 0 + separate: + trim_length: '80' + rel: 0 + target: 0 + filefield: + image_plain: + image_style: '' + image_link: '' + image_nodelink: + image_style: '' + image_link: content + image_imagelink: + image_style: '' + image_link: file + date: + default: + format_type: fallback + format_interval: + format_type: fallback + long: + format_type: long + medium: + format_type: medium + short: + format_type: short + text: + trimmed: + trim_length: 600 + - + plugin: field_formatter_settings_defaults + +destination: + plugin: component_entity_display +migration_dependencies: + - d6_field_instance + - d6_view_modes diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_instance.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_instance.yml new file mode 100644 index 0000000..4bda931 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_instance.yml @@ -0,0 +1,48 @@ +id: d6_field_instance +label: Drupal 6 field instance configuration +source: + plugin: d6_field_instance + constants: + entity_type: node + +process: + # We skip field types that don't exist because they weren't migrated by the + # field migration. + field_type_exists: + - + plugin: migration + migration: d6_field + source: + - field_name + - + plugin: extract + index: + - 1 + - + plugin: skip_row_on_empty + entity_type: constants.entity_type + field_name: field_name + bundle: type_name + label: label + description: description + required: required + status: active + settings: + plugin: d6_field_instance_settings + source: + - widget_type + - widget_settings + - global_settings + + default_value_function: '' + default_value: + plugin: d6_field_instance_defaults + source: + - widget_type + - widget_settings + +destination: + plugin: entity:field_instance_config +migration_dependencies: + - d6_node_type + - d6_field diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_instance_widget_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_instance_widget_settings.yml new file mode 100644 index 0000000..aab0a70 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_instance_widget_settings.yml @@ -0,0 +1,57 @@ +id: d6_field_instance_widget_settings +label: Drupal 6 field instance widget configuration +source: + plugin: d6_field_instance_per_form_display + constants: + entity_type: node + form_mode: default + +process: + # We skip field types that don't exist because they weren't migrated by the + # field migration. + field_type_exists: + - + plugin: migration + migration: d6_field + source: + - field_name + - + plugin: extract + index: + - 1 + - + plugin: skip_row_on_empty + bundle: type_name + form_mode: constants.form_mode + field_name: field_name + entity_type: constants.entity_type + "options.weight": weight + "options.type": + type: + plugin: static_map + bypass: true + source: widget_type + map: + text_textfield: text_textfield + number: number + link: link_default + email_textfield: email_default + date_select: datetime_default + date_text: datetime_default + filefield_widget: file_generic + imagefield_widget: image_image + phone_textfield: telephone_default + optionwidgets_onoff: options_onoff + optionwidgets_buttons: options_buttons + optionwidgets_select: options_select + "options.settings": + - + plugin: field_instance_widget_settings + source: + - widget_type + - widget_settings + +destination: + plugin: component_entity_form_display +migration_dependencies: + - d6_field_instance diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_settings.yml index 902e155..a2b42d4 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_settings.yml @@ -1,4 +1,5 @@ id: d6_field_settings +label: Drupal 6 global field configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_file.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_file.yml new file mode 100644 index 0000000..cc39a89 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_file.yml @@ -0,0 +1,19 @@ +id: d6_file +label: Drupal 6 files +source: + plugin: d6_file +process: + fid: fid + filename: filename + uri: + plugin: file_uri + source: + - filepath + - file_directory_path + - is_public + filemime: filemime + filesize: filesize + status: status + changed: timestamp +destination: + plugin: entity:file diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_file_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_file_settings.yml index a088b6c..0b7522e 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_file_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_file_settings.yml @@ -1,4 +1,5 @@ id: d6_file_settings +label: Drupal 6 file configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_filter_format.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_filter_format.yml index 99653b7..88d5c0d 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_filter_format.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_filter_format.yml @@ -1,4 +1,5 @@ id: d6_filter_format +label: Drupal 6 filter format configuration source: plugin: d6_filter_format process: @@ -25,7 +26,7 @@ process: - delta map: filter: - - filter_html_escape + - filter_html - filter_autop - filter_url - filter_htmlcorrector diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_forum_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_forum_settings.yml index 8ed1bd2..b46cca5 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_forum_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_forum_settings.yml @@ -1,4 +1,5 @@ id: d6_forum_settings +label: Drupal 6 forum configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_locale_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_locale_settings.yml index 972aaff..f0a4828 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_locale_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_locale_settings.yml @@ -1,4 +1,5 @@ id: d6_locale_settings +label: Drupal 6 locale configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_menu.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_menu.yml new file mode 100644 index 0000000..e6f534a --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_menu.yml @@ -0,0 +1,10 @@ +id: d6_menu +label: Drupal 6 menus +source: + plugin: d6_menu +process: + id: menu_name + label: title + description: description +destination: + plugin: entity:menu diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_menu_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_menu_settings.yml index 8b03bbe..2f9ee60 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_menu_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_menu_settings.yml @@ -1,4 +1,5 @@ id: d6_menu_settings +label: Drupal 6 menu configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_node.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_node.yml new file mode 100644 index 0000000..6ace5da --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_node.yml @@ -0,0 +1,36 @@ +id: d6_node +label: Drupal 6 nodes +source: + plugin: d6_node +process: + nid: nid + vid: vid + type: type + langcode: language + title: title + uid: uid + status: status + created: created + changed: changed + promote: promote + sticky: sticky + body.format: + plugin: migration + migration: d6_filter_format + source: format + body.value: body + +# unmapped d6 fields. +# tnid +# translate +# moderate +# comment + +destination: + plugin: entity:node +migration_dependencies: + - d6_node_type + - d6_filter_format + - d6_field_instance_widget_settings: false + - d6_field_formatter_settings: false + - d6_node_settings: false diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_revision.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_revision.yml new file mode 100644 index 0000000..c4d4807 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_revision.yml @@ -0,0 +1,32 @@ +id: d6_node_revision +label: Drupal 6 node revisions +source: + plugin: d6_node_revision +process: + nid: nid + vid: vid + type: type + langcode: language + title: title + uid: uid + status: status + created: created + changed: changed + promote: promote + sticky: sticky + body.format: + plugin: migration + migration: d6_filter_format + source: format + body.value: body + +# unmapped d6 fields. +# tnid +# translate +# moderate +# comment + +destination: + plugin: entity_revision:node +migration_dependencies: + - d6_node diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_settings.yml index 27e89b1..372371c 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_settings.yml @@ -1,4 +1,5 @@ id: d6_node_settings +label: Drupal 6 node configuration source: plugin: variable variables: @@ -8,5 +9,5 @@ process: destination: plugin: config config_name: node.settings -dependencies: +migration_dependencies: - d6_node_type diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_type.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_type.yml new file mode 100644 index 0000000..ce4e9e8 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_type.yml @@ -0,0 +1,21 @@ +id: d6_node_type +label: Drupal 6 node type configuration +source: + plugin: d6_node_type + constants: + preview: 1 # DRUPAL_OPTIONAL + create_body: false +process: + type: type + name: name + module: module + description: description + help: help + has_title: has_title + title_label: title_label + preview: constants.preview + submitted: submitted + options: options + create_body: has_body +destination: + plugin: entity:node_type diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_profile_values.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_profile_values.yml new file mode 100644 index 0000000..4f5f1a2 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_profile_values.yml @@ -0,0 +1,18 @@ +id: d6_profile_values +label: Drupal 6 profile values +source: + plugin: d6_profile_field_values +load: + plugin: drupal_entity +process: + uid: + plugin: migration + migration: d6_user + source: uid +destination: + plugin: entity:user +migration_dependencies: + - d6_user + - d6_user_profile_field_instance + - d6_user_profile_entity_display + - d6_user_profile_entity_form_display diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_search_page.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_search_page.yml new file mode 100644 index 0000000..87e1805 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_search_page.yml @@ -0,0 +1,23 @@ +id: d6_search_page +label: Drupal 6 search page configuration +source: + plugin: variable + variables: + - node_rank_comments + - node_rank_promote + - node_rank_recent + - node_rank_relevance + - node_rank_sticky + - node_rank_views + constants: + id: node_search + path: node + plugin: node_search +process: + id: constants.id + path: constants.path + plugin: constants.plugin + configuration.rankings: + plugin: d6_search_configuration_rankings +destination: + plugin: entity:search_page diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_search_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_search_settings.yml index b5c94b4..c86bd68 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_search_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_search_settings.yml @@ -1,4 +1,5 @@ id: d6_search_settings +label: Drupal 6 search configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_simpletest_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_simpletest_settings.yml index f9cd2bb..30b85d9 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_simpletest_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_simpletest_settings.yml @@ -1,4 +1,5 @@ id: d6_simpletest_settings +label: Drupal 6 simpletest configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_statistics_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_statistics_settings.yml index e20849b..9cc1b9c 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_statistics_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_statistics_settings.yml @@ -1,4 +1,5 @@ id: d6_statistics_settings +label: Drupal 6 statistics configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_syslog_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_syslog_settings.yml index 47c3072..50ca4e1 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_syslog_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_syslog_settings.yml @@ -1,4 +1,5 @@ id: d6_syslog_settings +label: Drupal 6 system log configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_cron.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_cron.yml index 73a8b34..1807732 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_cron.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_cron.yml @@ -1,4 +1,5 @@ id: d6_system_cron +label: Drupal 6 cron settings source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_file.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_file.yml index 3c7cd3a..3fdb86f 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_file.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_file.yml @@ -1,4 +1,5 @@ id: d6_system_file +label: Drupal 6 file system configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_filter.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_filter.yml index 2ca5770..b34bea7 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_filter.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_filter.yml @@ -1,4 +1,5 @@ id: d6_system_filter +label: Drupal 6 filter configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_image.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_image.yml index d7caf6a..3aede2f 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_image.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_image.yml @@ -1,4 +1,5 @@ id: d6_system_image +label: Drupal 6 image toolkit configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_image_gd.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_image_gd.yml index f5bebe5..3d62fe8 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_image_gd.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_image_gd.yml @@ -1,4 +1,5 @@ id: d6_system_image_gd +label: Drupal 6 image quality configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_maintenance.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_maintenance.yml index 46e7708..ec8941f 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_maintenance.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_maintenance.yml @@ -1,4 +1,5 @@ id: d6_system_maintenance +label: Drupal 6 maintainence page configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_performance.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_performance.yml index fa83c7f..25bf122 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_performance.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_performance.yml @@ -1,4 +1,5 @@ id: d6_system_performance +label: Drupal 6 performance configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_rss.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_rss.yml index ced4769..0325553 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_rss.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_rss.yml @@ -1,4 +1,5 @@ id: d6_system_rss +label: Drupal 6 RSS configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_site.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_site.yml index 0bfe4e6..f3b5b08 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_site.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_site.yml @@ -1,4 +1,5 @@ id: d6_system_site +label: Drupal 6 site configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_theme.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_theme.yml index 8c1ffd8..65b10cb 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_theme.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_system_theme.yml @@ -1,4 +1,5 @@ id: d6_system_theme +label: Drupal 6 theme configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_taxonomy_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_taxonomy_settings.yml index 78caf05..f5919b4 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_taxonomy_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_taxonomy_settings.yml @@ -1,4 +1,5 @@ id: d6_taxonomy_settings +label: Drupal 6 taxonomy configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_taxonomy_term.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_taxonomy_term.yml new file mode 100644 index 0000000..f57a254 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_taxonomy_term.yml @@ -0,0 +1,25 @@ +id: d6_taxonomy_term +label: Drupal 6 taxonomy terms +source: + plugin: d6_taxonomy_term +process: + tid: tid + vid: + plugin: migration + migration: d6_taxonomy_vocabulary + source: vid + name: name + description: description + weight: weight + parent: + - + plugin: skip_process_on_empty + source: parent + - + plugin: migration + migration: d6_taxonomy_term + changed: timestamp +destination: + plugin: entity:taxonomy_term +migration_dependencies: + - d6_taxonomy_vocabulary diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_taxonomy_vocabulary.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_taxonomy_vocabulary.yml new file mode 100644 index 0000000..d654323 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_taxonomy_vocabulary.yml @@ -0,0 +1,20 @@ +id: d6_taxonomy_vocabulary +label: Drupal 6 taxonomy vocabularies +source: + plugin: d6_taxonomy_vocabulary +process: + vid: + - + plugin: machine_name + source: name + - + plugin: dedupe_entity + entity_type: taxonomy_vocabulary + field: vid + label: name + name: name + description: description + hierarchy: hierarchy + weight: weight +destination: + plugin: entity:taxonomy_vocabulary diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_term_node.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_term_node.yml new file mode 100644 index 0000000..129798f --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_term_node.yml @@ -0,0 +1,19 @@ +id: d6_term_node +label: Drupal 6 term/node relationships +load: + plugin: d6_term_node + +source: + plugin: d6_term_node + +process: + nid: nid + type: type + # The actual field name is dynamic and will be added by the load plugin. + +destination: + plugin: entity:node +migration_dependencies: + - d6_vocabulary_entity_display + - d6_vocabulary_entity_form_display + - d6_node diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_term_node_revision.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_term_node_revision.yml new file mode 100644 index 0000000..a9d1f20 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_term_node_revision.yml @@ -0,0 +1,18 @@ +id: d6_term_node_revision +label: Drupal 6 term/node relationship revisions +load: + plugin: d6_term_node + bundle_migration: d6_vocabulary_field + +source: + plugin: d6_term_node_revision + +process: + vid: vid + # The actual field name is dynamic and will be added by the load plugin. + +destination: + plugin: entity_revision:node +migration_dependencies: + - d6_term_node + - d6_node_revision diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_text_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_text_settings.yml index e2e5fbd..6a4f0a6 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_text_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_text_settings.yml @@ -1,4 +1,5 @@ id: d6_text_settings +label: Drupal 6 teaser length configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_update_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_update_settings.yml index 6004b36..5b34a2e 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_update_settings.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_update_settings.yml @@ -1,4 +1,5 @@ id: d6_update_settings +label: Drupal 6 update configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload.yml new file mode 100644 index 0000000..b831add --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload.yml @@ -0,0 +1,23 @@ +id: d6_upload +label: Drupal 6 file uploads +source: + plugin: d6_upload + +process: + nid: nid + vid: vid + upload: + plugin: iterator + source: upload + process: + target_id: + plugin: migration + migration: d6_file + source: fid + display: list + description: description +destination: + plugin: entity:node +migration_dependencies: + - d6_file + - d6_node diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_entity_display.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_entity_display.yml new file mode 100644 index 0000000..ae727c8 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_entity_display.yml @@ -0,0 +1,24 @@ +id: d6_upload_entity_display +label: Drupal 6 upload display configuration +source: + plugin: d6_upload_instance + constants: + entity_type: node + view_mode: default + name: upload + type: file_default + options: + label: hidden + settings: {} +process: + entity_type: constants.entity_type + bundle: node_type + view_mode: constants.view_mode + field_name: constants.name + type: constants.type + options: constants.options + 'options.type': @type +destination: + plugin: component_entity_display +migration_dependencies: + - d6_upload_field_instance diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_entity_form_display.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_entity_form_display.yml new file mode 100644 index 0000000..43ead27 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_entity_form_display.yml @@ -0,0 +1,26 @@ +id: d6_upload_entity_form_display +label: Drupal 6 upload form display configuration +source: + plugin: d6_upload_instance + constants: + empty: {} + entity_type: node + form_mode: default + name: upload + type: file_generic + options: + label: hidden + settings: + progress_indicator: throbber +process: + entity_type: constants.entity_type + bundle: node_type + field_name: constants.name + form_mode: constants.form_mode + type: constants.type + options: constants.options + 'options.type': @type +destination: + plugin: component_entity_form_display +migration_dependencies: + - d6_upload_field_instance diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_field.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_field.yml new file mode 100644 index 0000000..05cd8e2 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_field.yml @@ -0,0 +1,21 @@ +id: d6_upload_field +label: Drupal 6 upload field configuration +source: + # We do an empty source and a proper destination to have an idmap for + # migration_dependencies. + plugin: empty + provider: upload + constants: + entity_type: node + type: file + name: upload + cardinality: -1 + display_field: true +process: + entity_type: constants.entity_type + name: constants.name + type: constants.type + cardinality: constants.cardinality + settings.display_field: constants.display_field +destination: + plugin: entity:field_config diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_field_instance.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_field_instance.yml new file mode 100644 index 0000000..a25de1f --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_field_instance.yml @@ -0,0 +1,20 @@ +id: d6_upload_field_instance +label: Drupal 6 upload field instance configuration +source: + plugin: d6_upload_instance + constants: + entity_type: node + name: upload + settings: + description_field: 1 +process: + entity_type: constants.entity_type + bundle: node_type + field_name: constants.name + settings: constants.settings + 'settings.file_extensions': file_extensions + 'settings.max_filesize': max_filesize +destination: + plugin: entity:field_instance_config +migration_dependencies: + - d6_upload_field diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_url_alias.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_url_alias.yml new file mode 100644 index 0000000..8286827 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_url_alias.yml @@ -0,0 +1,12 @@ +id: d6_url_alias +label: Drupal 6 URL aliases +source: + plugin: d6_url_alias + +process: + source: src + alias: dst + langcode: language + +destination: + plugin: url_alias diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user.yml new file mode 100644 index 0000000..c1b9f27 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user.yml @@ -0,0 +1,40 @@ +id: d6_user +label: Drupal 6 user accounts +source: + plugin: d6_user +process: + uid: uid + name: name + pass: pass + mail: mail + created: created + access: access + login: login + status: status + timezone: + plugin: user_update_7002 + source: timezone + preferred_langcode: language + init: init + roles: + plugin: migration + migration: d6_user_role + source: roles + signature: signature + signature_format: + plugin: migration + migration: d6_filter_format + source: signature_format + no_stub: 1 + user_picture: + plugin: d6_user_picture + source: uid +destination: + plugin: entity:user + md5_passwords: true +migration_dependencies: + - d6_filter_format + - d6_user_role + - d6_user_picture_entity_display + - d6_user_picture_entity_form_display + - d6_user_picture_file: false diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_mail.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_mail.yml index 75dee05..9716bef 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_mail.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_mail.yml @@ -1,4 +1,5 @@ id: d6_user_mail +label: Drupal 6 user mail configuration source: plugin: variable variables: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_entity_display.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_entity_display.yml new file mode 100644 index 0000000..e87032b --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_entity_display.yml @@ -0,0 +1,27 @@ +id: d6_user_picture_entity_display +label: Drupal 6 user picture display configuration +source: + plugin: d6_user_picture_instance + constants: + entity_type: user + bundle: user + view_mode: default + name: user_picture + type: image + options: + label: hidden + settings: + image_style: '' + image_link: content +process: + entity_type: constants.entity_type + bundle: constants.bundle + view_mode: constants.view_mode + field_name: constants.name + type: constants.type + options: constants.options + options.type: @type +destination: + plugin: component_entity_display +migration_dependencies: + - d6_user_picture_field_instance diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_entity_form_display.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_entity_form_display.yml new file mode 100644 index 0000000..c977440 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_entity_form_display.yml @@ -0,0 +1,27 @@ +id: d6_user_picture_entity_form_display +label: Drupal 6 user picture form display configuration +source: + plugin: d6_user_picture_instance + constants: + entity_type: user + bundle: user + form_mode: default + name: user_picture + type: image_image + options: + label: hidden + settings: + progress_indicator: throbber + preview_image_style: thumbnail +process: + entity_type: constants.entity_type + bundle: constants.bundle + field_name: constants.name + form_mode: constants.form_mode + type: constants.type + options: constants.options + options.type: @type +destination: + plugin: component_entity_form_display +migration_dependencies: + - d6_user_picture_field_instance diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_field.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_field.yml new file mode 100644 index 0000000..ed53dd1 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_field.yml @@ -0,0 +1,18 @@ +id: d6_user_picture_field +label: Drupal 6 user picture field configuration +source: + # We do an empty source and a proper destination to have an idmap for + # dependencies. + plugin: empty + constants: + entity_type: user + type: image + name: user_picture + cardinality: 1 +process: + entity_type: constants.entity_type + name: constants.name + type: constants.type + cardinality: constants.cardinality +destination: + plugin: entity:field_config diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_field_instance.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_field_instance.yml new file mode 100644 index 0000000..e4645e6 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_field_instance.yml @@ -0,0 +1,27 @@ +id: d6_user_picture_field_instance +label: Drupal 6 user picture field instance configuration +source: + plugin: d6_user_picture_instance + constants: + entity_type: user + bundle: user + name: user_picture + settings: + file_extensions: 'png gif jpg jpeg' + alt_field: false + title_field: false + min_resolution: '' + alt_field_required: false + title_field_required: false +process: + entity_type: constants.entity_type + bundle: constants.bundle + field_name: constants.name + settings: constants.settings + 'settings.file_directory': file_directory + 'settings.max_filesize': max_filesize + 'settings.max_resolution': max_resolution +destination: + plugin: entity:field_instance_config +migration_dependencies: + - d6_user_picture_field diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_file.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_file.yml new file mode 100644 index 0000000..687674f --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_picture_file.yml @@ -0,0 +1,19 @@ +id: d6_user_picture_file +label: Drupal 6 user pictures +source: + plugin: d6_user_picture_file + constants: + is_public: true +process: + filename: filename + uri: + plugin: file_uri + source: + - picture + - file_directory_path + - constants.is_public +destination: + plugin: entity:file + source_path_property: picture +migration_dependencies: + - d6_file: false diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_entity_display.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_entity_display.yml new file mode 100644 index 0000000..0e026dc --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_entity_display.yml @@ -0,0 +1,38 @@ +id: d6_user_profile_entity_display +label: Drupal 6 user profile display configuration +source: + plugin: d6_profile_field + constants: + entity_type: user + bundle: user + view_mode: default + options: + label: hidden + settings: {} +process: + entity_type: constants.entity_type + bundle: constants.bundle + view_mode: constants.view_mode + field_name: name + type: + plugin: static_map + source: type + map: + checkbox: list_default + date: datetime_default + list: text_default + selection: list_default + textfield: text_default + textarea: text_default + url: link_default + options: constants.options + 'options.type': @type + hidden: + plugin: static_map + source: visibility + default_value: false + map: + 1: true # PROFILE_PRIVATE + 4: true # PROFILE_HIDDEN +destination: + plugin: component_entity_display diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_entity_form_display.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_entity_form_display.yml new file mode 100644 index 0000000..c74b37f --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_entity_form_display.yml @@ -0,0 +1,43 @@ +id: d6_user_profile_entity_form_display +label: Drupal 6 user profile form display configuration +source: + plugin: d6_profile_field + constants: + empty: {} + entity_type: user + bundle: user + form_mode: default + options: + label: hidden +process: + entity_type: constants.entity_type + bundle: constants.bundle + field_name: name + form_mode: constants.form_mode + type: + plugin: static_map + source: type + map: + checkbox: options_select + date: datetime_default + list: text_textfield + selection: options_select + textfield: text_textfield + textarea: text_textarea + url: link_default + options: constants.options + 'options.type': @type + 'options.settings': + plugin: field_instance_widget_settings + source: + - @type + - constants.empty # we don't have any settings. + hidden: + plugin: static_map + source: visibility + default_value: false + map: + 1: true # PROFILE_PRIVATE + 4: true # PROFILE_HIDDEN +destination: + plugin: component_entity_form_display diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_field.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_field.yml new file mode 100644 index 0000000..fb9217c --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_field.yml @@ -0,0 +1,28 @@ +id: d6_user_profile_field +label: Drupal 6 user profile field configuration +source: + plugin: d6_profile_field + constants: + entity_type: user +process: + entity_type: constants.entity_type + name: name + type: + plugin: static_map + source: type + map: + checkbox: list_integer + date: datetime + list: text + selection: list_text + textfield: text + textarea: text_long + url: link + cardinality: + plugin: static_map + default_value: 1 + source: type + map: + list: -1 +destination: + plugin: entity:field_config diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_field_instance.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_field_instance.yml new file mode 100644 index 0000000..d967473 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_field_instance.yml @@ -0,0 +1,18 @@ +id: d6_user_profile_field_instance +label: Drupal 6 user profile field instance configuration +source: + plugin: d6_profile_field + constants: + entity_type: user + bundle: user +process: + entity_type: constants.entity_type + bundle: constants.bundle + label: title + description: explanation + field_name: name + required: required +destination: + plugin: entity:field_instance_config +migration_dependencies: + - d6_user_profile_field diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_role.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_role.yml index b2372b5..cabd3c0 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_role.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_role.yml @@ -1,4 +1,5 @@ id: d6_user_role +label: Drupal 6 user roles source: plugin: d6_user_role process: diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_view_modes.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_view_modes.yml new file mode 100644 index 0000000..3bc9131 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_view_modes.yml @@ -0,0 +1,38 @@ +id: d6_view_modes +label: Drupal 6 view modes +source: + plugin: d6_view_mode + constants: + targetEntityType: node + status: true + +process: + mode: + plugin: static_map + source: view_mode + map: + 0: normal + 1: preview + 2: search_index + 3: search_result + 4: rss + 5: print + teaser: teaser + full: full + label: + plugin: static_map + source: view_mode + map: + 0: "Normal" + 1: "Preview" + 2: "Search index" + 3: "Search result" + 4: "RSS" + 5: "Print" + teaser: "Teaser" + full: "Full" + targetEntityType: constants.targetEntityType + status: constants.status + +destination: + plugin: entity:view_mode diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_vocabulary_entity_display.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_vocabulary_entity_display.yml new file mode 100644 index 0000000..5c62e04 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_vocabulary_entity_display.yml @@ -0,0 +1,25 @@ +id: d6_vocabulary_entity_display +label: Drupal 6 vocabulary display configuration +source: + plugin: d6_taxonomy_vocabulary_per_type + constants: + entity_type: node + view_mode: default + options: + label: hidden + type: taxonomy_term_reference_link + weight: 20 + +process: + entity_type: constants.entity_type + view_mode: constants.view_mode + options: constants.options + bundle: type + field_name: + plugin: migration + migration: d6_taxonomy_vocabulary + source: vid +destination: + plugin: component_entity_display +migration_dependencies: + - d6_vocabulary_field_instance diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_vocabulary_entity_form_display.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_vocabulary_entity_form_display.yml new file mode 100644 index 0000000..6f82b29 --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_vocabulary_entity_form_display.yml @@ -0,0 +1,23 @@ +id: d6_vocabulary_entity_form_display +label: Drupal 6 vocabulary form display configuration +source: + plugin: d6_taxonomy_vocabulary_per_type + constants: + entity_type: node + form_mode: default + options: + type: options_select + weight: 20 +process: + entity_type: constants.entity_type + form_mode: constants.form_mode + options: constants.options + bundle: type + field_name: + plugin: migration + migration: d6_taxonomy_vocabulary + source: vid +destination: + plugin: component_entity_form_display +migration_dependencies: + - d6_vocabulary_field_instance diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_vocabulary_field.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_vocabulary_field.yml new file mode 100644 index 0000000..d497dbf --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_vocabulary_field.yml @@ -0,0 +1,23 @@ +id: d6_vocabulary_field +label: Drupal 6 vocabulary field configuration +source: + plugin: d6_taxonomy_vocabulary + constants: + entity_type: node + type: taxonomy_term_reference + parent: 0 + cardinality: -1 +process: + entity_type: constants.entity_type + type: constants.type + name: + plugin: migration + migration: d6_taxonomy_vocabulary + source: vid + 'settings.allowed_values.0.vocabulary': @name + 'settings.allowed_values.0.parent': constants.parent + cardinality: constants.cardinality +destination: + plugin: entity:field_config +migration_dependencies: + - d6_taxonomy_vocabulary diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_vocabulary_field_instance.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_vocabulary_field_instance.yml new file mode 100644 index 0000000..c5c763d --- /dev/null +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_vocabulary_field_instance.yml @@ -0,0 +1,20 @@ +id: d6_vocabulary_field_instance +label: Drupal 6 vocabulary field instance configuration +source: + plugin: d6_taxonomy_vocabulary_per_type + constants: + entity_type: node + parent: 0 +process: + entity_type: constants.entity_type + bundle: type + field_name: + plugin: migration + migration: d6_taxonomy_vocabulary + source: vid + 'settings.allowed_values.0.vocabulary': @field_name + 'settings.allowed_values.0.parent': constants.parent +destination: + plugin: entity:field_instance_config +migration_dependencies: + - d6_vocabulary_field diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/load/LoadEntity.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/load/LoadEntity.php index 113d473..a45baac 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/load/LoadEntity.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/load/LoadEntity.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\migrate\Plugin\load\LoadEntity. + * Contains \Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity. */ namespace Drupal\migrate_drupal\Plugin\migrate\load; diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/BlockPluginId.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/BlockPluginId.php new file mode 100644 index 0000000..3f205b2 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/BlockPluginId.php @@ -0,0 +1,100 @@ +customBlockStorage = $storage; + $this->migration = $migration; + $this->processPluginManager = $process_plugin_manager; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { + $entity_manager = $container->get('entity.manager'); + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $migration, + $entity_manager->getDefinition('custom_block') ? $entity_manager->getStorage('custom_block') : NULL, + $container->get('plugin.manager.migrate.process') + ); + } + + /** + * {@inheritdoc} + * + * Set the block plugin id. + */ + public function transform($value, MigrateExecutable $migrate_executable, Row $row, $destination_property) { + if (is_array($value)) { + list($module, $delta) = $value; + switch ($module) { + case 'aggregator': + list($type, $id) = explode('-', $delta); + if ($type == 'category') { + // @TODO skip row. + // throw new MigrateSkipRowException(); + } + $value = 'aggregator_feed_block'; + break; + case 'menu': + $value = "system_menu_block:$delta"; + break; + case 'block': + if ($this->customBlockStorage) { + $block_ids = $this->processPluginManager + ->createInstance('migration', array('migration' => 'd6_custom_block'), $this->migration) + ->transform($delta, $migrate_executable, $row, $destination_property); + $value = 'custom_block:' . $this->customBlockStorage->load($block_ids[0])->uuid(); + } + else { + throw new MigrateSkipRowException(); + } + break; + default: + throw new MigrateSkipRowException(); + } + } + return $value; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/BlockSettings.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/BlockSettings.php new file mode 100644 index 0000000..a804352 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/BlockSettings.php @@ -0,0 +1,57 @@ +getSourceProperty('module') == 'date' ? array('format_type' => 'fallback') : array(); + } + return $value; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FieldIdGenerator.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FieldIdGenerator.php new file mode 100644 index 0000000..6521e83 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FieldIdGenerator.php @@ -0,0 +1,30 @@ + 0, 'optional' => 1, 'required' => 2); + $settings['title'] = $map[$field_settings['title']]; + break; + + case 'filefield_widget': + $settings['file_extensions'] = $widget_settings['file_extensions']; + $settings['file_directory'] = $widget_settings['file_path']; + $settings['description_field'] = $field_settings['description_field']; + $settings['max_filesize'] = $this->convertSizeUnit($widget_settings['max_filesize_per_file']); + break; + + case 'imagefield_widget': + $settings['file_extensions'] = $widget_settings['file_extensions']; + $settings['file_directory'] = 'public://'; + $settings['max_filesize'] = $this->convertSizeUnit($widget_settings['max_filesize_per_file']); + $settings['alt_field'] = $widget_settings['alt']; + $settings['alt_field_required'] = $widget_settings['custom_alt']; + $settings['title_field'] = $widget_settings['title']; + $settings['title_field_required'] = $widget_settings['custom_title']; + $settings['max_resolution'] = $widget_settings['max_resolution']; + $settings['min_resolution'] = $widget_settings['min_resolution']; + break; + + } + return $settings; + } + + /** + * Convert file size strings into their D8 format. + * + * D6 stores file size using a "K" for kilobytes and "M" for megabytes where + * as D8 uses "KB" and "MB" respectively. + * + * @param string $size_string + * The size string, eg 10M + * + * @return string + * The D8 version of the size string. + */ + protected function convertSizeUnit($size_string) { + $size_unit = substr($size_string, strlen($size_string) - 1); + if ($size_unit == "M" || $size_unit == "K") { + return $size_string . "B"; + } + return $size_string; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FieldInstanceWidgetSettings.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FieldInstanceWidgetSettings.php new file mode 100644 index 0000000..4ec140e --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FieldInstanceWidgetSettings.php @@ -0,0 +1,86 @@ +getSettings($widget_type, $widget_settings); + } + + /** + * Merge the default D8 and specified D6 settings for a widget type. + * + * @param string $widget_type + * The widget type. + * @param array $widget_settings + * The widget settings from D6 for this widget. + * + * @return array + * A valid array of settings. + */ + public function getSettings($widget_type, $widget_settings) { + $progress = isset($widget_settings['progress_indicator']) ? $widget_settings['progress_indicator'] : 'throbber'; + $size = isset($widget_settings['size']) ? $widget_settings['size'] : 60; + $rows = isset($widget_settings['rows']) ? $widget_settings['rows'] : 5; + + $settings = array( + 'text_textfield' => array( + 'size' => $size, + 'placeholder' => '', + ), + 'text_textarea' => array( + 'rows' => $rows, + 'placeholder' => '', + ), + 'number' => array( + 'placeholder' => '', + ), + 'email_textfield' => array( + 'placeholder' => '', + ), + 'link' => array( + 'placeholder_uri' => '', + 'placeholder_title' => '', + ), + 'filefield_widget' => array( + 'progress_indicator' => $progress, + ), + 'imagefield_widget' => array( + 'progress_indicator' => $progress, + 'preview_image_style' => 'thumbnail', + ), + 'optionwidgets_onoff' => array( + 'display_label' => FALSE, + ), + 'phone_textfield' => array( + 'placeholder' => '', + ), + ); + + return isset($settings[$widget_type]) ? $settings[$widget_type] : array(); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FieldSettings.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FieldSettings.php new file mode 100644 index 0000000..cf84ef8 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FieldSettings.php @@ -0,0 +1,68 @@ +getSettings($field_type, $global_settings, $widget_settings); + } + + /** + * Merge the default D8 and specified D6 settings. + * + * @param string $field_type + * The field type. + * @param array $global_settings + * The field settings. + * @param array $widget_settings + * The widget settings needed for some settings. + * + * @return array + * A valid array of settings. + */ + public function getSettings($field_type, $global_settings, $widget_settings) { + $image_label = isset($widget_settings['alt']) ? $widget_settings['alt'] : ''; + $title_label = isset($widget_settings['title']) ? $widget_settings['title'] : ''; + $max_length = isset($global_settings['max_length']) ? $global_settings['max_length'] : ''; + $max_length = empty($max_length) ? 255 : $max_length; + + $settings = array( + 'text' => array( + 'max_length' => $max_length, + ), + 'image' => array( + 'column_groups' => array( + 'alt' => array('label' => $image_label), + 'title' => array('label' => $title_label), + ), + ), + 'datetime' => array('datetime_type' => 'datetime'), + ); + + return isset($settings[$field_type]) ? $settings[$field_type] : array(); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FieldTypeDefaults.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FieldTypeDefaults.php new file mode 100644 index 0000000..0deedd0 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FieldTypeDefaults.php @@ -0,0 +1,39 @@ +getSourceProperty('module') == 'date') { + $value = 'datetime_default'; + } + else { + throw new MigrateException(sprintf('Failed to lookup %s in the static map.', var_export($value, TRUE))); + } + } + return $value; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FileImageHandler.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FileImageHandler.php new file mode 100644 index 0000000..b188bee --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FileImageHandler.php @@ -0,0 +1,46 @@ +getSourceProperty('module') == 'filefield') { + $widget_type = $row->getSourceProperty('widget_type'); + $value = $widget_type == "imagefield_widget" ? "image" : "file"; + } + else { + throw new MigrateSkipRowException(); + } + } + + return $value; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FileUri.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FileUri.php new file mode 100644 index 0000000..a3a9a3b --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FileUri.php @@ -0,0 +1,37 @@ +getSourceProperty('rid'); if ($formats = $row->getSourceProperty("filter_permissions:$rid")) { foreach ($formats as $format) { - $new_id = $this->migrationPlugin->transform(array($format), $migrate_executable, $row, $destination_property); + $new_id = $this->migrationPlugin->transform($format, $migrate_executable, $row, $destination_property); if ($new_id) { - $value[] = 'use text format ' . $new_id[0]; + $value[] = 'use text format ' . $new_id; } } } diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/NodeUpdate7008.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/NodeUpdate7008.php index 06014c4..fff00f5 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/NodeUpdate7008.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/NodeUpdate7008.php @@ -31,4 +31,5 @@ public function transform($value, MigrateExecutable $migrate_executable, Row $ro } return $value; } + } diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/SearchConfigurationRankings.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/SearchConfigurationRankings.php new file mode 100644 index 0000000..320e919 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/SearchConfigurationRankings.php @@ -0,0 +1,38 @@ +getSource() as $name => $rank) { + if (substr($name, 0, 10) == 'node_rank_' && $rank) { + $return[substr($name, 10)] = $rank; + } + } + return $return; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FilterFormatPermission.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/UserPicture.php similarity index 58% copy from core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FilterFormatPermission.php copy to core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/UserPicture.php index 07608b6..8b9a900 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/FilterFormatPermission.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/UserPicture.php @@ -2,10 +2,9 @@ /** * @file - * Contains \Drupal\migrate_drupal\Plugin\migrate\Process\d6\FilterFormatRole. + * Contains \Drupal\migrate_drupal\Plugin\migrate\Process\d6\UserPicture. */ - namespace Drupal\migrate_drupal\Plugin\migrate\Process\d6; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; @@ -17,14 +16,13 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Migrate filter format serial to string id in permission name. + * The user picture process plugin. * * @MigrateProcessPlugin( - * id = "filter_format_permission", - * handle_multiples = TRUE + * id = "d6_user_picture" * ) */ -class FilterFormatPermission extends ProcessPluginBase implements ContainerFactoryPluginInterface { +class UserPicture extends ProcessPluginBase implements ContainerFactoryPluginInterface { /** * The migration plugin. @@ -36,7 +34,7 @@ class FilterFormatPermission extends ProcessPluginBase implements ContainerFacto /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, MigrateProcessInterface $migration_plugin) { + public function __construct(array $configuration, $plugin_id, array $plugin_definition, MigrationInterface $migration, MigrateProcessInterface $migration_plugin) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->migration = $migration; $this->migrationPlugin = $migration_plugin; @@ -51,26 +49,15 @@ public static function create(ContainerInterface $container, array $configuratio $plugin_id, $plugin_definition, $migration, - $container->get('plugin.manager.migrate.process')->createInstance('migration', array('migration' => 'd6_filter_format'), $migration) + $container->get('plugin.manager.migrate.process')->createInstance('migration', array('migration' => 'd6_user_picture_file'), $migration) ); } /** * {@inheritdoc} - * - * Migrate filter format serial to string id in permission name. */ public function transform($value, MigrateExecutable $migrate_executable, Row $row, $destination_property) { - $rid = $row->getSourceProperty('rid'); - if ($formats = $row->getSourceProperty("filter_permissions:$rid")) { - foreach ($formats as $format) { - $new_id = $this->migrationPlugin->transform(array($format), $migrate_executable, $row, $destination_property); - if ($new_id) { - $value[] = 'use text format ' . $new_id[0]; - } - } - } - return $value; + return $row->getSourceProperty('picture') ? $this->migrationPlugin->transform($value, $migrate_executable, $row, $destination_property) : NULL; } } diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/UserUpdate7002.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/UserUpdate7002.php new file mode 100644 index 0000000..95db669 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/UserUpdate7002.php @@ -0,0 +1,60 @@ +hasSourceProperty('timezone_name')) { + if (isset(static::$timezones[$row->getSourceProperty('timezone_name')])) { + $timezone = $row->getSourceProperty('timezone_name'); + } + } + if (!$timezone && $row->hasSourceProperty('event_timezone')) { + if (isset(static::$timezones[$row->getSourceProperty('event_timezone')])) { + $timezone = $row->getSourceProperty('event_timezone'); + } + } + + return $timezone; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/UserUpdate8002.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/UserUpdate8002.php index cce55ed..2159084 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/UserUpdate8002.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/process/d6/UserUpdate8002.php @@ -32,4 +32,5 @@ public function transform($value, MigrateExecutable $migrate_executable, Row $ro ); return isset($map[$rid]) ? $map[$rid] : $value; } + } diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/DrupalSqlBase.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/DrupalSqlBase.php index 334dbde..a3c4a17 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/DrupalSqlBase.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/DrupalSqlBase.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\migrate\Plugin\migrate\source\d6\Drupal6SqlBase. + * Contains \Drupal\migrate_drupal\Plugin\migrate\source\Drupal6SqlBase. */ namespace Drupal\migrate_drupal\Plugin\migrate\source; diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/Variable.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/Variable.php index f3938f1..e66b413 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/Variable.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/Variable.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\migrate\Plugin\migrate\source\d6\Variable. + * Contains \Drupal\migrate_drupal\Plugin\migrate\source\Variable. */ namespace Drupal\migrate_drupal\Plugin\migrate\source; @@ -10,7 +10,7 @@ use Drupal\migrate\Entity\MigrationInterface; /** - * Drupal 6 variable source from database. + * Drupal variable source from database. * * This source class always returns a single row and as such is not a good * example for any normal source class returning multiple rows. @@ -67,4 +67,5 @@ public function query() { public function getIds() { return array(); } + } diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/VariableMultiRow.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/VariableMultiRow.php new file mode 100644 index 0000000..7075fca --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/VariableMultiRow.php @@ -0,0 +1,56 @@ +select('variable', 'v') + ->fields('v', array('name', 'value')) + ->condition('name', $this->configuration['variables']); + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'name' => $this->t('Name'), + 'value' => $this->t('Value'), + ); + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + if ($value = $row->getSourceProperty('value')) { + $row->setSourceProperty('value', unserialize($value)); + } + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['name']['type'] = 'string'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Action.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Action.php new file mode 100644 index 0000000..274190b --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Action.php @@ -0,0 +1,59 @@ +database + ->select('actions', 'a') + ->fields('a', array( + 'aid', + 'type', + 'callback', + 'parameters', + 'description', + ) + ); + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'aid' => $this->t('Action ID'), + 'type' => $this->t('Module'), + 'callback' => $this->t('Callback function'), + 'parameters' => $this->t('Action configuration'), + 'description' => $this->t('Action description'), + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['aid']['type'] = 'string'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/AggregatorFeed.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/AggregatorFeed.php new file mode 100644 index 0000000..849599e --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/AggregatorFeed.php @@ -0,0 +1,72 @@ +select('aggregator_feed', 'af') + ->fields('af', array( + 'fid', + 'title', + 'url', + 'refresh', + 'checked', + 'link', + 'description', + 'image', + 'etag', + 'modified', + 'block', + )); + + $query->orderBy('fid'); + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'fid' => $this->t('The feed ID.'), + 'title' => $this->t('Title of the feed.'), + 'url' => $this->t('URL to the feed.'), + 'refresh' => $this->t('Refresh frequency in seconds.'), + 'checked' => $this->t('Last-checked unix timestamp.'), + 'link' => $this->t('Parent website of feed.'), + 'description' => $this->t('Parent website\'s description fo the feed.'), + 'image' => $this->t('An image representing the feed.'), + 'etag' => $this->t('Entity tag HTTP response header.'), + 'modified' => $this->t('When the feed was last modified.'), + 'block' => $this->t("Number of items to display in the feed's block."), + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['fid']['type'] = 'integer'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/AggregatorItem.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/AggregatorItem.php new file mode 100644 index 0000000..7656560 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/AggregatorItem.php @@ -0,0 +1,57 @@ +select('aggregator_item', 'ai') + ->fields('ai', array('iid', 'fid', 'title', 'link', 'author', + 'description', 'timestamp', 'guid')) + ->orderBy('iid'); + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'iid' => $this->t('Primary Key: Unique ID for feed item.'), + 'fid' => $this->t('The {aggregator_feed}.fid to which this item belongs.'), + 'title' => $this->t('Title of the feed item.'), + 'link' => $this->t('Link to the feed item.'), + 'author' => $this->t('Author of the feed item.'), + 'description' => $this->t('Body of the feed item.'), + 'timestamp' => $this->t('Post date of feed item, as a Unix timestamp.'), + 'guid' => $this->t('Unique identifier for the feed item.'), + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['iid']['type'] = 'integer'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Block.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Block.php new file mode 100644 index 0000000..362abdc --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Block.php @@ -0,0 +1,114 @@ +select('blocks', 'b') + ->fields('b', array('bid', 'module', 'delta', 'theme', 'status', 'weight', 'region', 'visibility', 'pages', 'title', 'cache')) + ->orderBy('bid'); + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'bid' => $this->t('The block numeric identifier.'), + 'module' => $this->t('The module providing the block.'), + 'delta' => $this->t('The block\'s delta.'), + 'theme' => $this->t('Which theme the block is placed in.'), + 'status' => $this->t('Whether or not the block is enabled.'), + 'weight' => $this->t('Weight of the block for ordering within regions.'), + 'region' => $this->t('Region the block is placed in.'), + 'visibility' => $this->t('Visibility expression.'), + 'pages' => $this->t('Pages list.'), + 'title' => $this->t('Block title.'), + 'cache' => $this->t('Cache rule.'), + + ); + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $module = $row->getSourceProperty('module'); + $delta = $row->getSourceProperty('delta'); + $roles = $this->select('blocks_roles', 'br') + ->fields('br', array('rid')) + ->condition('module', $module) + ->condition('delta', $delta) + ->execute() + ->fetchCol(); + $row->setSourceProperty('permissions', $roles); + $settings = array(); + // Contrib can use hook_migration_d6_block_prepare_row() to add similar variables + // via $migration->getSource()->variableGet(). + switch ($module) { + case 'aggregator': + list($type, $id) = explode('-', $delta); + if ($type == 'feed') { + $item_count = $this->database->query('SELECT block FROM {aggregator_feed} WHERE fid = :fid', array(':fid' => $id))->fetchField(); + } + else { + $item_count = $this->database->query('SELECT block FROM {aggregator_category} WHERE cid = :cid', array(':cid' => $id))->fetchField(); + } + $settings['aggregator']['item_count'] = $item_count; + break; + case 'book': + $settings['book']['block_mode'] = $this->variableGet('book_block_mode', 'all pages'); + break; + case 'forum': + $settings['forum']['block_num'] = $this->variableGet('forum_block_num_'. $delta, 5); + break; + case 'statistics': + foreach (array('statistics_block_top_day_num', 'statistics_block_top_all_num', 'statistics_block_top_last_num') as $name) { + $settings['statistics'][$name] = $this->variableGet($name, 0); + } + break; + case 'user': + switch ($delta) { + case 2: + $settings['user']['block_whois_new_count'] = $this->variableGet('user_block_whois_new_count', 5); + break; + case 3: + $settings['user']['block_seconds_online'] = $this->variableGet('user_block_seconds_online', 900); + $settings['user']['max_list_count'] = $this->variableGet('user_block_max_list_count', 10); + break; + } + break; + } + $row->setSourceProperty('settings', $settings); + return parent::prepareRow($row); + } + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['module']['type'] = 'string'; + $ids['delta']['type'] = 'string'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Book.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Book.php new file mode 100644 index 0000000..ed02351 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Book.php @@ -0,0 +1,68 @@ +select('book', 'b')->fields('b', array('nid', 'bid')); + $query->join('menu_links', 'ml', 'b.mlid = ml.mlid'); + $ml_fields = array('mlid', 'plid', 'weight', 'has_children', 'depth'); + for ($i = 1; $i <= 9; $i++) { + $field = "p$i"; + $ml_fields[] = $field; + $query->orderBy($field); + } + $query->fields('ml', $ml_fields); + return $query; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['mlid']['type'] = 'integer'; + $ids['mlid']['alias'] = 'ml'; + return $ids; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'nid' => $this->t('Node ID'), + 'bid' => $this->t('Book ID'), + 'mlid' => $this->t('Menu link ID'), + 'plid' => $this->t('Parent link ID'), + 'weight' => $this->t('Weight'), + 'p1' => $this->t('The first mlid in the materialized path.'), + 'p2' => $this->t('The second mlid in the materialized path.'), + 'p3' => $this->t('The third mlid in the materialized path.'), + 'p4' => $this->t('The fourth mlid in the materialized path.'), + 'p5' => $this->t('The fifth mlid in the materialized path.'), + 'p6' => $this->t('The sixth mlid in the materialized path.'), + 'p7' => $this->t('The seventh mlid in the materialized path.'), + 'p8' => $this->t('The eight mlid in the materialized path.'), + 'p9' => $this->t('The nine mlid in the materialized path.'), + ); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Box.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Box.php new file mode 100644 index 0000000..f8eec40 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Box.php @@ -0,0 +1,52 @@ +select('boxes', 'b') + ->fields('b', array('bid', 'body', 'info', 'format')); + $query->orderBy('bid'); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'bid' => $this->t('The numeric identifier of the block/box'), + 'body' => $this->t('The block/box content'), + 'info' => $this->t('Admin title of the block/box.'), + 'format' => $this->t('Input format of the custom block/box content.'), + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['bid']['type'] = 'integer'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CckFieldRevision.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CckFieldRevision.php new file mode 100644 index 0000000..97535e3 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CckFieldRevision.php @@ -0,0 +1,41 @@ + nr.vid'; + + /** + * {@inheritdoc} + */ + public function fields() { + // Use all the node fields plus the vid that identifies the version. + return parent::fields() + array('vid' => t('The primary identifier for this version.')); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['vid']['type'] = 'integer'; + $ids['vid']['alias'] = 'nr'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CckFieldValues.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CckFieldValues.php new file mode 100644 index 0000000..ba93e18 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CckFieldValues.php @@ -0,0 +1,268 @@ +select('node_revisions', 'nr') + ->fields('n', array( + 'nid', + 'type', + )) + ->fields('nr', array( + 'vid', + )) + ->condition('type', $this->configuration['bundle']); + $query->innerJoin('node', 'n', static::JOIN); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $bundle = $row->getSourceProperty('type'); + // Pick up simple CCK fields. + $cck_table = "content_type_$bundle"; + if ($this->tableExists($cck_table)) { + $query = $this->select($cck_table, 'f')->condition('vid', $row->getSourceProperty('vid')); + // The main column for the field should be rendered with the field name, + // not the column name (e.g., field_foo rather than field_foo_value). + $field_info = $this->getSourceFieldInfo($bundle); + foreach ($field_info as $field_name => $info) { + if (isset($info['columns']) && !$info['multiple'] && $info['db_storage']) { + $i = 0; + $data = FALSE; + foreach ($info['columns'] as $display_name => $column_name) { + if ($i++ == 0) { + $query->addField('f', $column_name, $field_name); + } + else { + // The database API won't allow colons in column aliases, so we + // will accept the default alias, and fix up the field names later. + // Remember how to translate the field names. + if ($info['type'] == 'filefield' && + (strpos($display_name, ':list') || strpos($display_name, ':description'))) { + if (!$data) { + //$this->fileDataFields[] = $field_name . '_data'; + $query->addField('f', $field_name . '_data'); + $data = TRUE; + } + } + else { + $query->addField('f', $column_name); + } + } + } + } + } + if ($results = $query->execute()->fetchAssoc()) { + $source = $row->getSource(); + // We diff the results because the extra will be all the field columns. + $new_fields = array_diff($results, $source); + foreach ($new_fields as $key => $value) { + $row->setSourceProperty($key, $value); + } + } + } + + // Handle fields that have their own table. + foreach ($this->getSourceFieldInfo($bundle) as $field_name => $field_info) { + if ($field_info['multiple'] && !$field_info['db_storage']) { + // Select the data. + $table = "content_$field_name"; + $data = $this + ->select($table, 't') + ->fields('t', array('delta') + $field_info['columns']) + ->condition('vid', $row->getSourceProperty('vid')) + ->execute() + ->fetchAllKeyed(); + + // Set it on the row. + $row->setSourceProperty($field_name, $data); + } + } + parent::prepareRow($row); + } + + /** + * Get all the complex field info. + * + * @param string $bundle + * The bundle for which fields we want. + * + * @return array + * An array of field info keyed by field name. + */ + protected function getSourceFieldInfo($bundle) { + if (!isset($this->sourceFieldInfo)) { + $this->sourceFieldInfo = array(); + if ($this->tableExists('content_node_field_instance')) { + // Get each field attached to this type. + $query = $this->select('content_node_field_instance', 'i') + ->fields('i', array( + 'label', + 'widget_settings', + 'field_name', + )) + ->condition('type_name', $bundle); + + $query->innerJoin('content_node_field', 'f', 'i.field_name = f.field_name'); + $query->fields('f', array( + 'field_name', + 'type', + 'db_columns', + 'global_settings', + 'multiple', + 'db_storage') + ); + + $results = $query->execute(); + foreach ($results as $row) { + $field_name = trim($row['field_name']); + $db_columns = $db_columns = !empty($row['db_columns']) ? unserialize($row['db_columns']) : array(); + $columns = array(); + foreach ($db_columns as $column_name => $column_info) { + // Special handling for the stuff packed into filefield's "data" + if ($row['type'] == 'filefield' && $column_name == 'data') { + $widget_settings = unserialize($row['widget_settings']); + $global_settings = unserialize($row['global_settings']); + + if (!empty($widget_settings['custom_alt'])) { + $columns[$field_name . ':alt'] = $field_name . '_alt'; + } + if (!empty($widget_settings['custom_title'])) { + $columns[$field_name . ':title'] = $field_name . '_title'; + } + if (!empty($global_settings['description_field'])) { + $columns[$field_name . ':description'] = $field_name . '_description'; + } + } + else { + $display_name = $field_name . ':' . $column_name; + $column_name = $field_name . '_' . $column_name; + $columns[$display_name] = $column_name; + } + } + $this->sourceFieldInfo[$field_name] = array( + 'label' => $row['label'], + 'type' => $row['type'], + 'columns' => $columns, + 'multiple' => $row['multiple'], + 'db_storage' => $row['db_storage'], + 'bundle' => $bundle, + ); + } + } + } + + return $this->sourceFieldInfo; + } + + /** + * {@inheritdoc} + */ + public function fields() { + $fields = array( + 'nid' => $this->t('Node ID'), + 'type' => $this->t('Type'), + ); + foreach ($this->getSourceFieldInfo($this->configuration['bundle']) as $field_name => $field_data) { + $fields[$field_name] = $field_data['label']; + } + return $fields; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['nid']['type'] = 'integer'; + $ids['nid']['alias'] = 'n'; + return $ids; + } + + /** + * {@inheritdoc} + */ + public function bundleMigrationRequired() { + return TRUE; + } + + /** + * {@inheritdoc} + */ + public function entityTypeId() { + return 'node'; + } + + /** + * Determines whether a specific CCK table exists. + */ + protected function tableExists($table) { + if (!isset($this->tables[$table])) { + $this->tables[$table] = $this->cckSchemaCorrect() && $this->getDatabase()->schema()->tableExists($table); + } + return $this->tables[$table]; + } + + /** + * Determines whether CCK is enabled and is using the right schema. + */ + protected function cckSchemaCorrect() { + if (!isset($this->cckSchemaCorrect)) { + $this->cckSchemaCorrect = $this->moduleExists('content') && $this->getModuleSchemaVersion('content') >= 6001; + } + return $this->cckSchemaCorrect; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Comment.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Comment.php new file mode 100644 index 0000000..96b3802 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Comment.php @@ -0,0 +1,76 @@ +select('comments', 'c') + ->fields('c', array('cid', 'pid', 'nid', 'uid', 'subject', + 'comment', 'hostname', 'timestamp', 'status', 'thread', 'name', + 'mail', 'homepage', 'format')); + $query->orderBy('timestamp'); + return $query; + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row, $keep = TRUE) { + // In D6, status=0 means published, while in D8 means the opposite. + // See https://drupal.org/node/237636 + $row->setSourceProperty('status', !$row->getSourceProperty('status')); + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'cid' => $this->t('Comment ID.'), + 'pid' => $this->t('Parent comment ID. If set to 0, this comment is not a reply to an existing comment.'), + 'nid' => $this->t('The {node}.nid to which this comment is a reply.'), + 'uid' => $this->t('The {users}.uid who authored the comment. If set to 0, this comment was created by an anonymous user.'), + 'subject' => $this->t('The comment title.'), + 'comment' => $this->t('The comment body.'), + 'hostname' => $this->t("The author's host name."), + 'timestamp' => $this->t('The time that the comment was created, or last edited by its author, as a Unix timestamp.'), + 'status' => $this->t('The published status of a comment. (0 = Published, 1 = Not Published)'), + 'format' => $this->t('The {filter_formats}.format of the comment body.'), + 'thread' => $this->t("The vancode representation of the comment's place in a thread."), + 'name' => $this->t("The comment author's name. Uses {users}.name if the user is logged in, otherwise uses the value typed into the comment form."), + 'mail' => $this->t("The comment author's e-mail address from the comment form, if user is anonymous, and the 'Anonymous users may/must leave their contact information' setting is turned on."), + 'homepage' => $this->t("The comment author's home page address from the comment form, if user is anonymous, and the 'Anonymous users may/must leave their contact information' setting is turned on."), + 'type' => $this->t("The {node}.type to which this comment is a reply.") + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['cid']['type'] = 'integer'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CommentVariable.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CommentVariable.php new file mode 100644 index 0000000..5d0ff0e --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/CommentVariable.php @@ -0,0 +1,107 @@ +getCommentVariables()); + } + + /** + * {@inheritdoc} + */ + public function count() { + return count($this->getCommentVariables()); + } + + /** + * Retrieves the values of the comment variables grouped by node type. + * + * @return array + */ + protected function getCommentVariables() { + $comment_prefixes = array_keys($this->commentPrefixes()); + $variables = array(); + $node_types = $this->getDatabase()->query('SELECT type FROM {node_type}')->fetchCol(); + foreach ($node_types as $node_type) { + foreach ($comment_prefixes as $prefix) { + $variables[] = $prefix . '_' . $node_type; + } + } + $return = array(); + $values = $this->getDatabase()->query('SELECT name, value FROM {variable} WHERE name IN (:name)', array(':name' => $variables))->fetchAllKeyed(); + foreach ($node_types as $node_type) { + foreach ($comment_prefixes as $prefix) { + $name = $prefix . '_' . $node_type; + if (isset($values[$name])) { + $return[$node_type][$prefix] = unserialize($values[$name]); + } + } + } + // The return key will not be used so move it inside the row. This could + // not be done sooner because otherwise empty rows would be created with + // just the node type in it. + foreach ($return as $node_type => $data) { + $return[$node_type]['node_type'] = $node_type; + } + return $return; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return $this->commentPrefixes() + array( + 'node_type' => $this->t('The node type'), + ); + } + + /** + * Comment related data for fields. + */ + protected function commentPrefixes() { + return array( + 'comment' => $this->t('Default comment setting'), + 'comment_default_mode' => $this->t('Default display mode'), + 'comment_default_order' => $this->t('Default display order'), + 'comment_default_per_page' => $this->t('Default comments per page'), + 'comment_controls' => $this->t('Comment controls'), + 'comment_anonymous' => $this->t('Anonymous commenting'), + 'comment_subject_field' => $this->t('Comment subject field'), + 'comment_preview' => $this->t('Preview comment'), + 'comment_form_location' => $this->t('Location of comment submission form'), + ); + } + + /** + * {@inheritdoc} + */ + public function query() { + // Nothing to do here. + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['node_type']['type'] = 'string'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ContactCategory.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ContactCategory.php new file mode 100644 index 0000000..19e2dba --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ContactCategory.php @@ -0,0 +1,62 @@ +select('contact', 'c') + ->fields('c', array( + 'cid', + 'category', + 'recipients', + 'reply', + 'weight', + 'selected', + ) + ); + $query->orderBy('cid'); + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'cid' => $this->t('Primary Key: Unique category ID.'), + 'category' => $this->t('Category name.'), + 'recipients' => $this->t('Comma-separated list of recipient e-mail addresses.'), + 'reply' => $this->t('Text of the auto-reply message.'), + 'weight' => $this->t("The category's weight."), + 'selected' => $this->t('Flag to indicate whether or not category is selected by default. (1 = Yes, 0 = No)'), + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['cid']['type'] = 'integer'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Drupal6SqlBase.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Drupal6SqlBase.php deleted file mode 100644 index f83f669..0000000 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Drupal6SqlBase.php +++ /dev/null @@ -1,82 +0,0 @@ -database - ->select('system', 's') - ->fields('s') - ->execute(); - foreach ($results as $result) { - $system_data[$result['type']][$result['name']] = $result; - } - return $system_data; - } - - /** - * Get a module schema_version value in the source installation. - * - * @param string $module - * Name of module. - * - * @return mixed - * The current module schema version on the origin system table or FALSE if - * not found. - */ - protected function getModuleSchemaVersion($module) { - $system_data = $this->getSystemData(); - return isset($system_data['module'][$module]['schema_version']) ? $system_data['module'][$module]['schema_version'] : FALSE; - } - - /** - * Check to see if a given module is enabled in the source installation. - * - * @param string $module - * Name of module to check. - * - * @return bool - * TRUE if module is enabled on the origin system, FALSE if not. - */ - protected function moduleExists($module) { - return isset($system_data['module'][$module]['status']) ? (bool) $system_data['module'][$module]['status'] : FALSE; - } - - protected function variableGet($name, $default) { - try { - $result = $this->database - ->query('SELECT value FROM {variable} WHERE name = :name', array(':name' => $name)) - ->fetchField(); - } - // The table might not exist. - catch (\Exception $e) { - $result = FALSE; - } - return $result !== FALSE ? unserialize($result) : $default; - } - -} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Field.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Field.php new file mode 100644 index 0000000..542fde2 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Field.php @@ -0,0 +1,93 @@ +select('content_node_field', 'cnf') + ->fields('cnf', array( + 'field_name', + 'type', + 'global_settings', + 'required', + 'multiple', + 'db_storage', + 'module', + 'db_columns', + 'active', + 'locked', + )) + ->fields('cnfi', array( + 'widget_type', + 'widget_settings', + )); + $query->join('content_node_field_instance', 'cnfi', 'cnfi.field_name = cnf.field_name'); + $query->orderBy('field_name'); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'field_name' => $this->t('Field name'), + 'type' => $this->t('Type (text, integer, ....)'), + 'global_settings' => $this->t('Global settings. Shared with every field instance.'), + 'required' => $this->t('Required'), + 'multiple' => $this->t('Multiple'), + 'db_storage' => $this->t('DB storage'), + 'module' => $this->t('Module'), + 'db_columns' => $this->t('DB Columns'), + 'active' => $this->t('Active'), + 'locked' => $this->t('Locked'), + ); + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row, $keep = TRUE) { + // Unserialize data. + $global_settings = unserialize($row->getSourceProperty('global_settings')); + $widget_settings = unserialize($row->getSourceProperty('widget_settings')); + $db_columns = unserialize($row->getSourceProperty('db_columns')); + $row->setSourceProperty('global_settings', $global_settings); + $row->setSourceProperty('widget_settings', $widget_settings); + $row->setSourceProperty('db_columns', $db_columns); + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['field_name'] = array( + 'type' => 'string', + 'alias' => 'cnf', + ); + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FieldInstance.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FieldInstance.php new file mode 100644 index 0000000..e6f4721 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FieldInstance.php @@ -0,0 +1,102 @@ +select('content_node_field_instance', 'cnfi') + ->fields('cnfi', array( + 'field_name', + 'type_name', + 'weight', + 'label', + 'widget_type', + 'widget_settings', + 'display_settings', + 'description', + 'widget_module', + 'widget_active', + 'description', + )) + ->fields('cnf', array( + 'required', + 'active', + 'global_settings', + )); + + $query->join('content_node_field', 'cnf', 'cnf.field_name = cnfi.field_name'); + $query->orderBy('type_name'); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'field_name' => $this->t('The machine name of field.'), + 'type_name' => $this->t('Content type where is used this field.'), + 'weight' => $this->t('Weight.'), + 'label' => $this->t('A name to show.'), + 'widget_type' => $this->t('Widget type.'), + 'widget_settings' => $this->t('Serialize data with widget settings.'), + 'display_settings' => $this->t('Serialize data with display settings.'), + 'description' => $this->t('A description of field.'), + 'widget_module' => $this->t('Module that implements widget.'), + 'widget_active' => $this->t('Status of widget'), + 'module' => $this->t('The module that provides the field.'), + ); + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row, $keep = TRUE) { + // Unserialize data. + $widget_settings = unserialize($row->getSourceProperty('widget_settings')); + $display_settings = unserialize($row->getSourceProperty('display_settings')); + $global_settings = unserialize($row->getSourceProperty('global_settings')); + $row->setSourceProperty('widget_settings', $widget_settings); + $row->setSourceProperty('display_settings', $display_settings); + $row->setSourceProperty('global_settings', $global_settings); + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids = array( + 'field_name' => array( + 'type' => 'string', + 'alias' => 'cnfi', + ), + 'type_name' => array( + 'type' => 'string', + ), + ); + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FieldInstancePerFormDisplay.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FieldInstancePerFormDisplay.php new file mode 100644 index 0000000..056083d --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FieldInstancePerFormDisplay.php @@ -0,0 +1,101 @@ +prepareQuery()->execute(); + while ($field_row = $result->fetchAssoc()) { + $field_row['display_settings'] = unserialize($field_row['display_settings']); + $field_row['widget_settings'] = unserialize($field_row['widget_settings']); + $bundle = $field_row['type_name']; + $field_name = $field_row['field_name']; + + $index = "$bundle.$field_name"; + $rows[$index]['type_name'] = $bundle; + $rows[$index]['widget_active'] = (bool) $field_row['widget_active']; + $rows[$index]['field_name'] = $field_name; + $rows[$index]['type'] = $field_row['type']; + $rows[$index]['module'] = $field_row['module']; + $rows[$index]['weight'] = $field_row['display_settings']['weight']; + $rows[$index]['widget_type'] = $field_row['widget_type']; + $rows[$index]['widget_settings'] = $field_row['widget_settings']; + } + + return new \ArrayIterator($rows); + } + + /** + * {@inheritdoc} + */ + public function query() { + $query = $this->select('content_node_field_instance', 'cnfi') + ->fields('cnfi', array( + 'field_name', + 'type_name', + 'weight', + 'label', + 'widget_type', + 'widget_settings', + 'display_settings', + 'description', + 'widget_module', + 'widget_active', + )) + ->fields('cnf', array( + 'type', + 'module', + )); + $query->join('content_node_field', 'cnf', 'cnfi.field_name = cnf.field_name'); + $query->orderBy('type_name'); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'field_name' => $this->t('The machine name of field.'), + 'type_name' => $this->t('Content type where this field is used.'), + 'weight' => $this->t('Weight.'), + 'label' => $this->t('A name to show.'), + 'widget_type' => $this->t('Widget type.'), + 'widget_settings' => $this->t('Serialize data with widget settings.'), + 'display_settings' => $this->t('Serialize data with display settings.'), + 'description' => $this->t('A description of field.'), + 'widget_module' => $this->t('Module that implements widget.'), + 'widget_active' => $this->t('Status of widget'), + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['type_name']['type'] = 'string'; + $ids['field_name']['type'] = 'string'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FieldInstancePerViewMode.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FieldInstancePerViewMode.php new file mode 100644 index 0000000..cda2398 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FieldInstancePerViewMode.php @@ -0,0 +1,104 @@ +prepareQuery()->execute(); + while ($field_row = $result->fetchAssoc()) { + // These are added to every view mode row. + $field_row['display_settings'] = unserialize($field_row['display_settings']); + $field_row['widget_settings'] = unserialize($field_row['widget_settings']); + $bundle = $field_row['type_name']; + $field_name = $field_row['field_name']; + + foreach ($this->getViewModes() as $view_mode) { + if (isset($field_row['display_settings'][$view_mode]) && !$field_row['display_settings'][$view_mode]['exclude']) { + $index = $view_mode . "." . $bundle . "." . $field_name; + $rows[$index]['entity_type'] = 'node'; + $rows[$index]['view_mode'] = $view_mode; + $rows[$index]['type_name'] = $bundle; + $rows[$index]['field_name'] = $field_name; + $rows[$index]['type'] = $field_row['type']; + $rows[$index]['module'] = $field_row['module']; + $rows[$index]['weight'] = $field_row['display_settings']['weight']; + $rows[$index]['label'] = $field_row['display_settings']['label']['format']; + $rows[$index]['display_settings'] = $field_row['display_settings'][$view_mode]; + $rows[$index]['widget_settings'] = $field_row['widget_settings']; + } + } + } + + return new \ArrayIterator($rows); + } + + /** + * {@inheritdoc} + */ + public function query() { + $query = $this->select('content_node_field_instance', 'cnfi') + ->fields('cnfi', array( + 'field_name', + 'type_name', + 'weight', + 'label', + 'display_settings', + 'widget_settings', + )) + ->fields('cnf', array( + 'type', + 'module', + )); + $query->join('content_node_field', 'cnf', 'cnfi.field_name = cnf.field_name'); + $query->orderBy('type_name'); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'field_name' => $this->t('The machine name of field.'), + 'type_name' => $this->t('Content type where this field is used.'), + 'weight' => $this->t('Weight.'), + 'label' => $this->t('A name to show.'), + 'widget_type' => $this->t('Widget type.'), + 'widget_settings' => $this->t('Serialize data with widget settings.'), + 'display_settings' => $this->t('Serialize data with display settings.'), + 'description' => $this->t('A description of field.'), + 'widget_module' => $this->t('Module that implements widget.'), + 'widget_active' => $this->t('Status of widget'), + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['type_name']['type'] = 'string'; + $ids['view_mode']['type'] = 'string'; + $ids['entity_type']['type'] = 'string'; + $ids['field_name']['type'] = 'string'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/File.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/File.php new file mode 100644 index 0000000..887bdd9 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/File.php @@ -0,0 +1,100 @@ +select('files', 'f')->fields('f', array( + 'fid', + 'uid', + 'filename', + 'filepath', + 'filemime', + 'filesize', + 'status', + 'timestamp', + )); + $query->orderBy('timestamp'); + return $query; + } + + + /** + * {@inheritdoc} + */ + protected function runQuery() { + $conf_path = isset($this->configuration['conf_path']) ? $this->configuration['conf_path'] : 'sites/default'; + $this->filePath = $this->variableGet('file_directory_path', $conf_path . '/files') . '/'; + + // FILE_DOWNLOADS_PUBLIC == 1 and FILE_DOWNLOADS_PRIVATE == 2. + $this->isPublic = $this->variableGet('file_downloads', 1) == 1; + return parent::runQuery(); + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $row->setSourceProperty('file_directory_path', $this->filePath); + $row->setSourceProperty('is_public', $this->isPublic); + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'fid' => $this->t('File ID'), + 'uid' => $this->t('The {users}.uid who added the file. If set to 0, this file was added by an anonymous user.'), + 'filename' => $this->t('File name'), + 'filepath' => $this->t('File path'), + 'filemime' => $this->t('File Mime Type'), + 'status' => $this->t('The published status of a file.'), + 'timestamp' => $this->t('The time that the file was added.'), + 'file_directory_path' => $this->t('The Drupal files path.'), + 'is_public' => $this->t('TRUE if the files directory is public otherwise FALSE.'), + ); + } + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['fid']['type'] = 'integer'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FilterFormat.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FilterFormat.php index 68fe9c3..62c211f 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FilterFormat.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/FilterFormat.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\migrate\Plugin\migrate\source\d6\FilterFormats. + * Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\FilterFormats. */ namespace Drupal\migrate_drupal\Plugin\migrate\source\d6; @@ -96,6 +96,7 @@ public function getIds() { $ids['format']['type'] = 'integer'; return $ids; } + } diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Menu.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Menu.php new file mode 100644 index 0000000..b280b0f --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Menu.php @@ -0,0 +1,50 @@ +select('menu_custom', 'm') + ->fields('m', array('menu_name', 'title', 'description')); + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'menu_name' => $this->t('The menu name. Primary key.'), + 'title' => $this->t('The human-readable name of the menu.'), + 'description' => $this->t('A description of the menu'), + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['menu_name']['type'] = 'string'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Node.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Node.php new file mode 100644 index 0000000..4c0edcd --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Node.php @@ -0,0 +1,108 @@ +select('node_revisions', 'nr') + ->fields('n', array( + 'nid', + 'type', + 'language', + 'status', + 'created', + 'changed', + 'comment', + 'promote', + 'moderate', + 'sticky', + 'tnid', + 'translate', + )) + ->fields('nr', array( + 'vid', + 'uid', + 'title', + 'body', + 'teaser', + 'format', + )); + $query->innerJoin('node', 'n', static::JOIN); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + $fields = array( + 'nid' => $this->t('Node ID'), + 'type' => $this->t('Type'), + 'title' => $this->t('Title'), + 'body' => $this->t('Body'), + 'format' => $this->t('Format'), + 'teaser' => $this->t('Teaser'), + 'uid' => $this->t('Authored by (uid)'), + 'created' => $this->t('Created timestamp'), + 'changed' => $this->t('Modified timestamp'), + 'status' => $this->t('Published'), + 'promote' => $this->t('Promoted to front page'), + 'sticky' => $this->t('Sticky at top of lists'), + 'revision' => $this->t('Create new revision'), + 'log' => $this->t('Revision Log message'), + 'language' => $this->t('Language (fr, en, ...)'), + 'tnid' => $this->t('The translation set id for this node'), + ); + return $fields; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['nid']['type'] = 'integer'; + $ids['nid']['alias'] = 'n'; + return $ids; + } + + /** + * {@inheritdoc} + */ + public function bundleMigrationRequired() { + return FALSE; + } + + /** + * {@inheritdoc} + */ + public function entityTypeId() { + return 'node'; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/NodeRevision.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/NodeRevision.php new file mode 100644 index 0000000..87907d3 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/NodeRevision.php @@ -0,0 +1,41 @@ + nr.vid'; + + /** + * {@inheritdoc} + */ + public function fields() { + // Use all the node fields plus the vid that identifies the version. + return parent::fields() + array('vid' => t('The primary identifier for this version.')); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['vid']['type'] = 'integer'; + $ids['vid']['alias'] = 'nr'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/NodeType.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/NodeType.php new file mode 100644 index 0000000..4120de3 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/NodeType.php @@ -0,0 +1,127 @@ +select('node_type', 't') + ->fields('t', array( + 'type', + 'name', + 'module', + 'description', + 'help', + 'has_title', + 'title_label', + 'has_body', + 'body_label', + 'min_word_count', + 'custom', + 'modified', + 'locked', + 'orig_type', + )) + ->orderBy('t.type'); + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'type' => $this->t('Machine name of the node type.'), + 'name' => $this->t('Human name of the node type.'), + 'module' => $this->t('The module providing the node type.'), + 'description' => $this->t('Description of the node type.'), + 'help' => $this->t('Help text for the node type.'), + 'has_title' => $this->t('Flag indicating the node type has a title.'), + 'title_label' => $this->t('Title label.'), + 'has_body' => $this->t('Flag indicating the node type has a body field.'), + 'body_label' => $this->t('Body label.'), + 'min_word_count' => $this->t('Minimum word count for the body field.'), + 'custom' => $this->t('Flag.'), + 'modified' => $this->t('Flag.'), + 'locked' => $this->t('Flag.'), + 'orig_type' => $this->t('The original type.'), + 'teaser_length' => $this->t('Teaser length'), + ); + } + + /** + * {@inheritdoc} + */ + protected function runQuery() { + $this->teaserLength = $this->variableGet('teaser_length', 600); + $this->nodePreview = $this->variableGet('node_preview', 0); + $this->themeSettings = $this->variableGet('theme_settings', array()); + return parent::runQuery(); + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $row->setSourceProperty('teaser_length', $this->teaserLength); + $row->setSourceProperty('node_preview', $this->nodePreview); + + $type = $row->getSourceProperty('type'); + $options = $this->variableGet('node_options_' . $type, array('promote', 'sticky')); + foreach (array('promote', 'sticky', 'status', 'revision') as $item) { + $options[$item] = isset($options[$item]); + } + $row->setSourceProperty('options', $options); + $submitted = isset($this->themeSettings['toggle_node_info_' . $type]) ? $this->themeSettings['toggle_node_info_' . $type] : FALSE; + $row->setSourceProperty('submitted', $submitted); + + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['type']['type'] = 'string'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ProfileField.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ProfileField.php new file mode 100644 index 0000000..e16fa9e --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ProfileField.php @@ -0,0 +1,75 @@ +select('profile_fields', 'pf') + ->fields('pf', array( + 'fid', + 'title', + 'name', + 'explanation', + 'category', + 'page', + 'type', + 'weight', + 'required', + 'register', + 'visibility', + 'autocomplete', + 'options', + )); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'fid' => $this->t('Primary Key: Unique profile field ID.'), + 'title' => $this->t('Title of the field shown to the end user.'), + 'name' => $this->t('Internal name of the field used in the form HTML and URLs.'), + 'explanation' => $this->t('Explanation of the field to end users.'), + 'category' => $this->t('Profile category that the field will be grouped under.'), + 'page' => $this->t("Title of page used for browsing by the field's value"), + 'type' => $this->t('Type of form field.'), + 'weight' => $this->t('Weight of field in relation to other profile fields.'), + 'required' => $this->t('Whether the user is required to enter a value. (0 = no, 1 = yes)'), + 'register' => $this->t('Whether the field is visible in the user registration form. (1 = yes, 0 = no)'), + 'visibility' => $this->t('The level of visibility for the field. (0 = hidden, 1 = private, 2 = public on profile but not member list pages, 3 = public on profile and list pages)'), + 'autocomplete' => $this->t('Whether form auto-completion is enabled. (0 = disabled, 1 = enabled)'), + 'options' => $this->t('List of options to be used in a list selection field.'), + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['fid']['type'] = 'integer'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ProfileFieldValues.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ProfileFieldValues.php new file mode 100644 index 0000000..790a42f --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ProfileFieldValues.php @@ -0,0 +1,114 @@ +select('profile_values', 'pv') + ->distinct() + ->fields('pv', array('fid', 'uid')); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + // Find profile values for this row. + $query = $this->select('profile_values', 'pv') + ->fields('pv', array('fid', 'value')); + $query->leftJoin('profile_fields', 'pf', 'pf.fid=pv.fid'); + $query->fields('pf', array('name', 'type')); + $query->condition('uid', $row->getSourceProperty('uid')); + $results = $query->execute(); + + foreach ($results as $profile_value) { + // Check special case for date. We need unserialize. + if ($profile_value['type'] == 'date') { + $date = unserialize($profile_value['value']); + $date = date('Y-m-d', mktime(0, 0, 0, $date['month'], $date['day'], $date['year'])); + $row->setSourceProperty($profile_value['name'], array('value' => $date)); + } + elseif ($profile_value['type'] == 'list') { + $row->setSourceProperty($profile_value['name'], explode("\n", $profile_value['value'])); + } + else { + $row->setSourceProperty($profile_value['name'], array($profile_value['value'])); + } + } + + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function fields() { + $fields = array( + 'fid' => $this->t('Unique profile field ID.'), + 'uid' => $this->t('The user Id.'), + 'value' => $this->t('The value for this field..'), + ); + + $query = $this->select('profile_values', 'pv') + ->fields('pv', array('fid', 'value')); + $query->leftJoin('profile_fields', 'pf', 'pf.fid=pv.fid'); + $query->fields('pf', array('name', 'title')); + $results = $query->execute(); + foreach ($results as $profile) { + $fields[$profile['name']] = $this->t($profile['title']); + } + + return $fields; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + return array( + 'uid' => array( + 'type' => 'integer', + 'alias' => 'pv', + ), + ); + } + + /** + * {@inheritdoc} + */ + public function bundleMigrationRequired() { + return FALSE; + } + + /** + * {@inheritdoc} + */ + public function entityTypeId() { + return 'user'; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Role.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Role.php index 1677e33..754d6cd 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Role.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Role.php @@ -2,12 +2,11 @@ /** * @file - * Contains \Drupal\migrate\Plugin\migrate\source\d6\Role. + * Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\Role. */ namespace Drupal\migrate_drupal\Plugin\migrate\source\d6; - use Drupal\migrate\Row; use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; @@ -89,4 +88,5 @@ public function getIds() { $ids['rid']['type'] = 'integer'; return $ids; } + } diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Term.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Term.php new file mode 100644 index 0000000..98aac3d --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Term.php @@ -0,0 +1,78 @@ +select('term_data', 'td') + ->fields('td', array('tid', 'vid', 'name', 'description', 'weight')) + // This works, but we cannot test that, because there is no support for + // distinct() in FakeSelect, yet. + ->distinct(); + if (isset($this->configuration['vocabulary'])) { + $query->condition('vid', $this->configuration['vocabulary'], 'IN'); + } + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'tid' => $this->t('The term ID.'), + 'vid' => $this->t('Existing term VID'), + 'name' => $this->t('The name of the term.'), + 'description' => $this->t('The term description.'), + 'weight' => $this->t('Weight'), + 'parent' => $this->t("The Drupal term IDs of the term's parents."), + ); + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + // Find parents for this row. + $parents = $this->select('term_hierarchy', 'th') + ->fields('th', array('parent', 'tid')) + ->condition('tid', $row->getSourceProperty('tid')) + ->execute() + ->fetchCol(); + $row->setSourceProperty('parent', $parents); + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['tid']['type'] = 'integer'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/TermNode.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/TermNode.php new file mode 100644 index 0000000..1ddf014 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/TermNode.php @@ -0,0 +1,93 @@ +select('term_node', 'tn') + // @todo: working, but not is there support for distinct() in FakeSelect? + ->distinct() + ->fields('tn', array('nid', 'vid')) + ->fields('n', array('type')); + // Because this is an inner join it enforces the current revision. + $query->innerJoin('term_data', 'td', 'td.tid = tn.tid AND td.vid = :vid', array(':vid' => $this->configuration['vid'])); + $query->innerJoin('node', 'n', static::JOIN); + return $query; + + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'nid' => $this->t('The node revision ID.'), + 'vid' => $this->t('The node revision ID.'), + 'tid' => $this->t('The term ID.'), + ); + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + // Select the terms belonging to the revision selected. + $query = $this->select('term_node', 'tn') + ->fields('tn', array('tid')) + ->condition('n.nid', $row->getSourceProperty('nid')); + $query->join('node', 'n', static::JOIN); + $query->innerJoin('term_data', 'td', 'td.tid = tn.tid AND td.vid = :vid', array(':vid' => $this->configuration['vid'])); + $row->setSourceProperty('tid', $query->execute()->fetchCol()); + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['vid']['type'] = 'integer'; + $ids['vid']['alias'] = 'tn'; + return $ids; + } + + /** + * {@inheritdoc} + */ + public function bundleMigrationRequired() { + return TRUE; + } + + /** + * {@inheritdoc} + */ + public function entityTypeId() { + return 'taxonomy_term'; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/TermNodeRevision.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/TermNodeRevision.php new file mode 100644 index 0000000..99acd0e --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/TermNodeRevision.php @@ -0,0 +1,24 @@ +select('upload', 'u') + ->distinct() + ->fields('u', array('nid', 'vid')); + $query->innerJoin('node', 'n', static::JOIN); + return $query; + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $query = $this->select('upload', 'u') + ->fields('u', array('fid', 'description', 'list')) + ->condition('u.nid', $row->getSourceProperty('nid')) + ->orderBy('u.weight'); + $query->innerJoin('node', 'n', static::JOIN); + $row->setSourceProperty('upload', $query->execute()->fetchAll()); + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'fid' => $this->t('The file Id.'), + 'nid' => $this->t('The node Id.'), + 'vid' => $this->t('The version Id.'), + 'description' => $this->t('The file description.'), + 'list' => $this->t('Whether the list should be visible on the node page.'), + 'weight' => $this->t('The file weight.'), + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['vid']['type'] = 'integer'; + $ids['vid']['alias'] = 'u'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UploadInstance.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UploadInstance.php new file mode 100644 index 0000000..6e3db8d --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UploadInstance.php @@ -0,0 +1,87 @@ +getDatabase()->query('SELECT type FROM {node_type}')->fetchCol(); + foreach ($node_types as $node_type) { + $variables[] = $prefix . '_' . $node_type; + } + + $max_filesize = $this->variableGet('upload_uploadsize_default', 1); + $max_filesize = $max_filesize ? $max_filesize . 'MB' : ''; + $file_extensions = $this->variableGet('upload_extensions_default', 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp'); + $return = array(); + $values = $this->getDatabase()->query('SELECT name, value FROM {variable} WHERE name IN (:name)', array(':name' => $variables))->fetchAllKeyed(); + foreach ($node_types as $node_type) { + $name = $prefix . '_' . $node_type; + if (isset($values[$name])) { + $enabled = unserialize($values[$name]); + if ($enabled) { + $return[$node_type]['node_type'] = $node_type; + $return[$node_type]['max_filesize'] = $max_filesize; + $return[$node_type]['file_extensions'] = $file_extensions; + } + } + } + + return new \ArrayIterator($return); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + return array( + 'node_type' => array( + 'type' => 'string', + ), + ); + } + + /** + * {@inheritdoc} + */ + public function query() { + // Nothing needed here. + } + + /** + * {@inheritdoc} + */ + public function checkRequirements() { + return $this->moduleExists('upload'); + } + + /** + * {@inheritdoc + */ + public function fields() { + return array( + 'node_type' => $this->t('Node type'), + 'max_filesize' => $this->t('Max filesize'), + 'file_extensions' => $this->t('File extensions'), + ); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UrlAlias.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UrlAlias.php new file mode 100644 index 0000000..d9b08da --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UrlAlias.php @@ -0,0 +1,51 @@ +select('url_alias', 'ua') + ->fields('ua', array('pid', 'src', 'dst', 'language')); + $query->orderBy('pid'); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'pid' => $this->t('The numeric identifier of the path alias.'), + 'src' => $this->t('The internal path.'), + 'dst' => $this->t('The user set path alias.'), + 'language' => $this->t('The language code of the url alias.'), + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['pid']['type'] = 'integer'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/User.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/User.php new file mode 100644 index 0000000..058f7ed --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/User.php @@ -0,0 +1,147 @@ +select('users', 'u') + ->fields('u', array_keys($this->baseFields())) + ->condition('uid', 1, '>'); + } + + /** + * {@inheritdoc} + */ + public function fields() { + $fields = $this->baseFields(); + + // Add roles field. + $fields['roles'] = $this->t('Roles'); + + // Profile fields. + if ($this->moduleExists('profile')) { + $fields += $this->select('profile_fields', 'pf') + ->fields('pf', array('name', 'title')) + ->execute() + ->fetchAllKeyed(); + } + + return $fields; + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row, $keep = TRUE) { + // User roles. + $roles = $this->select('users_roles', 'ur') + ->fields('ur', array('rid')) + ->condition('ur.uid', $row->getSourceProperty('uid')) + ->execute() + ->fetchCol(); + $row->setSourceProperty('roles', $roles); + + // We are adding here the Event contributed module column. + // @see https://api.drupal.org/api/drupal/modules%21user%21user.install/function/user_update_7002/7 + if ($row->hasSourceProperty('timezone_id') && $row->getSourceProperty('timezone_id')) { + if ($this->getDatabase()->schema()->tableExists('event_timezones')) { + $event_timezone = $this->select('event_timezones', 'e') + ->fields('e', array('name')) + ->condition('e.timezone', $row->getSourceProperty('timezone_id')) + ->execute() + ->fetchField(); + if ($event_timezone) { + $row->setSourceProperty('event_timezone', $event_timezone); + } + } + } + + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + return array( + 'uid' => array( + 'type' => 'integer', + 'alias' => 'u', + ), + ); + } + + /** + * Returns the user base fields to be migrated. + * + * @return array + * Associative array having field name as key and description as value. + */ + protected function baseFields() { + $fields = array( + 'uid' => $this->t('User ID'), + 'name' => $this->t('Username'), + 'pass' => $this->t('Password'), + 'mail' => $this->t('Email address'), + 'signature' => $this->t('Signature'), + 'signature_format' => $this->t('Signature format'), + 'created' => $this->t('Registered timestamp'), + 'access' => $this->t('Last access timestamp'), + 'login' => $this->t('Last login timestamp'), + 'status' => $this->t('Status'), + 'timezone' => $this->t('Timezone'), + 'language' => $this->t('Language'), + 'picture' => $this->t('Picture'), + 'init' => $this->t('Init'), + ); + + // Possible field added by Date contributed module. + // @see https://api.drupal.org/api/drupal/modules%21user%21user.install/function/user_update_7002/7 + if ($this->getDatabase()->schema()->fieldExists('users', 'timezone_name')) { + $fields['timezone_name'] = $this->t('Timezone (Date)'); + } + + // Possible field added by Event contributed module. + // @see https://api.drupal.org/api/drupal/modules%21user%21user.install/function/user_update_7002/7 + if ($this->getDatabase()->schema()->fieldExists('users', 'timezone_id')) { + $fields['timezone_id'] = $this->t('Timezone (Event)'); + } + + return $fields; + } + + /** + * {@inheritdoc} + */ + public function bundleMigrationRequired() { + return FALSE; + } + + /** + * {@inheritdoc} + */ + public function entityTypeId() { + return 'user'; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UserPicture.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UserPicture.php new file mode 100644 index 0000000..9efa99d --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UserPicture.php @@ -0,0 +1,53 @@ +getDatabase() + ->select('users', 'u') + ->condition('picture', '', '<>') + ->fields('u', array('uid', 'access', 'picture')) + ->orderBy('access'); + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'uid' => 'Primary Key: Unique user ID.', + 'access' => 'Timestamp for previous time user accessed the site.', + 'picture' => "Path to the user's uploaded picture.", + ); + } + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['uid']['type'] = 'integer'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UserPictureFile.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UserPictureFile.php new file mode 100644 index 0000000..757472d --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UserPictureFile.php @@ -0,0 +1,74 @@ +select('users', 'u') + ->condition('picture', '', '<>') + ->fields('u', array('uid', 'picture')); + return $query; + } + + /** + * {@inheritdoc} + */ + public function runQuery() { + $conf_path = isset($this->configuration['conf_path']) ? $this->configuration['conf_path'] : 'sites/default'; + $this->filePath = $this->variableGet('file_directory_path', $conf_path . '/files') . '/'; + return parent::runQuery(); + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $row->setSourceProperty('filename', basename($row->getSourceProperty('picture'))); + $row->setSourceProperty('file_directory_path', $this->filePath); + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'picture' => "Path to the user's uploaded picture.", + 'filename' => 'The picture filename.', + ); + } + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['uid']['type'] = 'integer'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UserPictureInstance.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UserPictureInstance.php new file mode 100644 index 0000000..03402ce --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/UserPictureInstance.php @@ -0,0 +1,62 @@ + '', + 'file_directory' => $this->variableGet('user_picture_path', 'pictures'), + 'max_filesize' => $this->variableGet('user_picture_file_size', '30') . 'KB', + 'max_resolution' => $this->variableGet('user_picture_dimensions', '85x85'), + ))); + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'file_directory' => 'The directory to store images..', + 'max_filesize' => 'The maximum allowed file size in KBs.', + 'max_resolution' => "The maximum resolution.", + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['id']['type'] = 'string'; + return $ids; + } + + /** + * {@inheritdoc} + */ + public function query() { + // Nothing to do here. + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ViewMode.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ViewMode.php new file mode 100644 index 0000000..13d6c94 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ViewMode.php @@ -0,0 +1,69 @@ +prepareQuery()->execute(); + while ($field_row = $result->fetchAssoc()) { + $field_row['display_settings'] = unserialize($field_row['display_settings']); + foreach ($this->getViewModes() as $view_mode) { + if (isset($field_row['display_settings'][$view_mode]) && !$field_row['display_settings'][$view_mode]['exclude']) { + if (!isset($rows[$view_mode])) { + $rows[$view_mode]['entity_type'] = 'node'; + $rows[$view_mode]['view_mode'] = $view_mode; + } + } + } + } + + return new \ArrayIterator($rows); + } + + /** + * {@inheritdoc} + */ + public function query() { + $query = $this->select('content_node_field_instance', 'cnfi') + ->fields('cnfi', array( + 'display_settings', + )); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'display_settings' => $this->t('Serialize data with display settings.'), + ); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['view_mode']['type'] = 'string'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ViewModeBase.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ViewModeBase.php new file mode 100644 index 0000000..a32f8ca --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/ViewModeBase.php @@ -0,0 +1,54 @@ +runQuery()); + } + + /** + * Get a list of D6 view modes. + * + * Drupal 6 supported the following view modes. + * NODE_BUILD_NORMAL = 0 + * NODE_BUILD_PREVIEW = 1 + * NODE_BUILD_SEARCH_INDEX = 2 + * NODE_BUILD_SEARCH_RESULT = 3 + * NODE_BUILD_RSS = 4 + * NODE_BUILD_PRINT = 5 + * teaser + * full + * + * @return array + * The view mode names. + */ + public function getViewModes() { + return array( + 0, + 1, + 2, + 3, + 4, + 5, + 'teaser', + 'full', + ); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Vocabulary.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Vocabulary.php new file mode 100644 index 0000000..9e51196 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Vocabulary.php @@ -0,0 +1,44 @@ +select('vocabulary_node_types', 'nt') + ->fields('nt', array('type', 'vid')) + ->condition('vid', $row->getSourceProperty('vid')) + ->execute() + ->fetchCol(); + $row->setSourceProperty('node_types', $node_types); + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['vid']['type'] = 'integer'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/VocabularyBase.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/VocabularyBase.php new file mode 100644 index 0000000..e5f1159 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/VocabularyBase.php @@ -0,0 +1,58 @@ +select('vocabulary', 'v') + ->fields('v', array( + 'vid', + 'name', + 'description', + 'help', + 'relations', + 'hierarchy', + 'multiple', + 'required', + 'tags', + 'module', + 'weight', + )); + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return array( + 'vid' => $this->t('The vocabulary ID.'), + 'name' => $this->t('The name of the vocabulary.'), + 'description' => $this->t('The description of the vocabulary.'), + 'help' => $this->t('Help text to display for the vocabulary.'), + 'relations' => $this->t('Whether or not related terms are enabled within the vocabulary. (0 = disabled, 1 = enabled)'), + 'hierarchy' => $this->t('The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)'), + 'multiple' => $this->t('Whether or not multiple terms from this vocabulary may be assigned to a node. (0 = disabled, 1 = enabled)'), + 'required' => $this->t('Whether or not terms are required for nodes using this vocabulary. (0 = disabled, 1 = enabled)'), + 'tags' => $this->t('Whether or not free tagging is enabled for the vocabulary. (0 = disabled, 1 = enabled)'), + 'weight' => $this->t('The weight of the vocabulary in relation to other vocabularies.'), + 'parents' => $this->t("The Drupal term IDs of the term's parents."), + 'node_types' => $this->t('The names of the node types the vocabulary may be used with.'), + ); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/VocabularyPerType.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/VocabularyPerType.php new file mode 100644 index 0000000..46f3d2d --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/VocabularyPerType.php @@ -0,0 +1,42 @@ +fields('nt', array( + 'type', + )); + $query->join('vocabulary_node_types', 'nt', 'v.vid = nt.vid'); + return $query; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['vid']['type'] = 'integer'; + $ids['vid']['alias'] = 'nt'; + $ids['type']['type'] = 'string'; + return $ids; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorFeed.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorFeed.php new file mode 100644 index 0000000..5d74e0c --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorFeed.php @@ -0,0 +1,129 @@ +createTable('aggregator_feed', array( + 'description' => 'Stores feeds to be parsed by the aggregator.', + 'fields' => array( + 'fid' => array( + 'type' => 'serial', + 'not null' => TRUE, + 'description' => 'Primary Key: Unique feed ID.', + ), + 'title' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'Title of the feed.', + ), + 'url' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'URL to the feed.', + ), + 'refresh' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'How often to check for new feed items, in seconds.', + ), + 'checked' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'Last time feed was checked for new items, as Unix timestamp.', + ), + 'link' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'The parent website of the feed; comes from the <link> element in the feed.', + ), + 'description' => array( + 'type' => 'text', + 'not null' => TRUE, + 'size' => 'big', + 'description' => "The parent website's description; comes from the <description> element in the feed.", + ), + 'image' => array( + 'type' => 'text', + 'not null' => TRUE, + 'size' => 'big', + 'description' => 'An image representing the feed.', + ), + 'etag' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'Entity tag HTTP response header, used for validating cache.', + ), + 'modified' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'When the feed was last modified, as a Unix timestamp.', + ), + 'block' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => "Number of items to display in the feed's block.", + ) + ), + 'primary key' => array('fid'), + 'unique keys' => array( + 'url' => array('url'), + 'title' => array('title'), + ), + )); + + $this->database->insert('aggregator_feed')->fields(array( + 'fid', + 'title', + 'url', + 'refresh', + 'checked', + 'link', + 'description', + 'image', + 'etag', + 'modified', + 'block', + )) + ->values(array( + 'fid' => 5, + 'title' => 'Know Your Meme', + 'url' => 'http://knowyourmeme.com/newsfeed.rss', + 'refresh' => 900, + 'checked' => 1387659487, + 'link' => 'http://knowyourmeme.com', + 'description' => 'New items added to the News Feed', + 'image' => 'http://b.thumbs.redditmedia.com/harEHsUUZVajabtC.png', + 'etag' => '"213cc1365b96c310e92053c5551f0504"', + 'modified' => 0, + 'block' => 5, + )) + ->execute(); + $this->setModuleVersion('aggregator', 6001); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorItem.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorItem.php new file mode 100644 index 0000000..b4f1ad2 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorItem.php @@ -0,0 +1,100 @@ +createTable('aggregator_item', array( + 'description' => 'Stores the individual items imported from feeds.', + 'fields' => array( + 'iid' => array( + 'type' => 'serial', + 'not null' => TRUE, + 'description' => 'Primary Key: Unique ID for feed item.', + ), + 'fid' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {aggregator_feed}.fid to which this item belongs.', + ), + 'title' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'Title of the feed item.', + ), + 'link' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'Link to the feed item.', + ), + 'author' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'Author of the feed item.', + ), + 'description' => array( + 'type' => 'text', + 'not null' => TRUE, + 'size' => 'big', + 'description' => 'Body of the feed item.', + ), + 'timestamp' => array( + 'type' => 'int', + 'not null' => FALSE, + 'description' => 'Post date of feed item, as a Unix timestamp.', + ), + 'guid' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => FALSE, + 'description' => 'Unique identifier for the feed item.', + ), + ), + 'primary key' => array('iid'), + 'indexes' => array('fid' => array('fid')), + )); + + $this->database->insert('aggregator_item')->fields(array( + 'iid', + 'fid', + 'title', + 'link', + 'author', + 'description', + 'timestamp', + 'guid', + )) + ->values(array( + 'iid' => 1, + 'fid' => 5, + 'title' => 'This (three) weeks in Drupal Core - January 10th 2014', + 'link' => 'https://groups.drupal.org/node/395218', + 'author' => 'larowlan', + 'description' => "

What's new with Drupal 8?

", + 'timestamp' => 1389297196, + 'guid' => '395218 at https://groups.drupal.org', + )) + ->execute(); + + $this->setModuleVersion('aggregator', '6001'); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Block.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Block.php new file mode 100644 index 0000000..3144fb7 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Block.php @@ -0,0 +1,311 @@ +createTable('blocks', array( + 'fields' => array( + 'bid' => array( + 'type' => 'serial', + 'not null' => TRUE, + ), + 'module' => array( + 'type' => 'varchar', + 'length' => 64, + 'not null' => TRUE, + 'default' => '', + ), + 'delta' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '0', + ), + 'theme' => array( + 'type' => 'varchar', + 'length' => 64, + 'not null' => TRUE, + 'default' => '', + ), + 'status' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'region' => array( + 'type' => 'varchar', + 'length' => 64, + 'not null' => TRUE, + 'default' => '', + ), + 'custom' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'throttle' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'visibility' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'pages' => array( + 'type' => 'text', + 'not null' => TRUE, + ), + 'title' => array( + 'type' => 'varchar', + 'length' => 64, + 'not null' => TRUE, + 'default' => '', + ), + 'cache' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 1, + 'size' => 'tiny', + ), + ), + 'primary key' => array( + 'bid', + ), + 'unique keys' => array( + 'tmd' => array( + 'theme', + 'module', + 'delta', + ), + ), + 'indexes' => array( + 'list' => array( + 'theme', + 'status', + 'region', + 'weight', + 'module', + ), + ), + )); + $this->createTable('blocks_roles', array( + 'fields' => array( + 'module' => array( + 'type' => 'varchar', + 'length' => 64, + 'not null' => TRUE, + ), + 'delta' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + ), + 'rid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + ), + 'primary key' => array( + 'module', + 'delta', + 'rid', + ), + 'indexes' => array( + 'rid' => array( + 'rid', + ), + ), + 'module' => 'block', + 'name' => 'blocks_roles', + )); + $this->database->insert('blocks')->fields(array( + 'bid', + 'module', + 'delta', + 'theme', + 'status', + 'weight', + 'region', + 'custom', + 'throttle', + 'visibility', + 'pages', + 'title', + 'cache', + )) + ->values(array( + 'bid' => '1', + 'module' => 'user', + 'delta' => '0', + 'theme' => 'garland', + 'status' => '1', + 'weight' => '0', + 'region' => 'left', + 'custom' => '0', + 'throttle' => '0', + 'visibility' => '0', + 'pages' => '', + 'title' => '', + 'cache' => '-1' + )) + ->values(array( + 'bid' => '2', + 'module' => 'user', + 'delta' => '1', + 'theme' => 'garland', + 'status' => '1', + 'weight' => '0', + 'region' => 'left', + 'custom' => '0', + 'throttle' => '0', + 'visibility' => '0', + 'pages' => '', + 'title' => '', + 'cache' => '-1' + )) + ->values(array( + 'bid' => '3', + 'module' => 'system', + 'delta' => '0', + 'theme' => 'garland', + 'status' => '1', + 'weight' => '-5', + 'region' => 'footer', + 'custom' => '0', + 'throttle' => '0', + 'visibility' => '0', + 'pages' => '', + 'title' => '', + 'cache' => '-1' + )) + ->values(array( + 'bid' => '4', + 'module' => 'comment', + 'delta' => '0', + 'theme' => 'garland', + 'status' => '0', + 'weight' => '-6', + 'region' => '', + 'custom' => '0', + 'throttle' => '0', + 'visibility' => '0', + 'pages' => '', + 'title' => '', + 'cache' => '1' + )) + ->values(array( + 'bid' => '5', + 'module' => 'menu', + 'delta' => 'primary-links', + 'theme' => 'garland', + 'status' => '1', + 'weight' => '-5', + 'region' => 'header', + 'custom' => '0', + 'throttle' => '0', + 'visibility' => '0', + 'pages' => '', + 'title' => '', + 'cache' => '-1' + )) + ->values(array( + 'bid' => '6', + 'module' => 'menu', + 'delta' => 'secondary-links', + 'theme' => 'garland', + 'status' => '0', + 'weight' => '-5', + 'region' => '', + 'custom' => '0', + 'throttle' => '0', + 'visibility' => '0', + 'pages' => '', + 'title' => '', + 'cache' => '-1' + )) + ->values(array( + 'bid' => '7', + 'module' => 'node', + 'delta' => '0', + 'theme' => 'garland', + 'status' => '0', + 'weight' => '-4', + 'region' => '', + 'custom' => '0', + 'throttle' => '0', + 'visibility' => '0', + 'pages' => '', + 'title' => '', + 'cache' => '-1' + )) + ->values(array( + 'bid' => '8', + 'module' => 'user', + 'delta' => '2', + 'theme' => 'garland', + 'status' => '0', + 'weight' => '-3', + 'region' => '', + 'custom' => '0', + 'throttle' => '0', + 'visibility' => '0', + 'pages' => '', + 'title' => '', + 'cache' => '1' + )) + ->values(array( + 'bid' => '9', + 'module' => 'user', + 'delta' => '3', + 'theme' => 'garland', + 'status' => '0', + 'weight' => '-1', + 'region' => '', + 'custom' => '0', + 'throttle' => '0', + 'visibility' => '0', + 'pages' => '', + 'title' => '', + 'cache' => '-1' + )) + ->values(array( + 'bid' => '10', + 'module' => 'block', + 'delta' => '1', + 'theme' => 'garland', + 'status' => '1', + 'weight' => '0', + 'region' => 'content', + 'custom' => '0', + 'throttle' => '0', + 'visibility' => '1', + 'pages' => '', + 'title' => 'Static Block', + 'cache' => '-1' + )) + ->execute(); + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Book.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Book.php new file mode 100644 index 0000000..5ab6f92 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Book.php @@ -0,0 +1,436 @@ +createTable('book', array( + 'fields' => array( + 'mlid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'nid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'bid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'primary key' => array( + 'mlid', + ), + 'unique keys' => array( + 'nid' => array( + 'nid', + ), + ), + 'indexes' => array( + 'bid' => array( + 'bid', + ), + ), + 'module' => 'book', + 'name' => 'book', + )); + $this->createTable('menu_links', array( + 'fields' => array( + 'menu_name' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + ), + 'mlid' => array( + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + 'plid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'link_path' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'router_path' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'link_title' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'options' => array( + 'type' => 'text', + 'not null' => FALSE, + ), + 'module' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => 'system', + ), + 'hidden' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'small', + ), + 'external' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'small', + ), + 'has_children' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'small', + ), + 'expanded' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'small', + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'depth' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'small', + ), + 'customized' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'small', + ), + 'p1' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'p2' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'p3' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'p4' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'p5' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'p6' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'p7' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'p8' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'p9' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'updated' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'small', + ), + ), + 'indexes' => array( + 'path_menu' => array( + array( + 'link_path', + 128, + ), + 'menu_name', + ), + 'menu_plid_expand_child' => array( + 'menu_name', + 'plid', + 'expanded', + 'has_children', + ), + 'menu_parents' => array( + 'menu_name', + 'p1', + 'p2', + 'p3', + 'p4', + 'p5', + 'p6', + 'p7', + 'p8', + 'p9', + ), + 'router_path' => array( + array( + 'router_path', + 128, + ), + ), + ), + 'primary key' => array( + 'mlid', + ), + 'module' => 'system', + 'name' => 'menu_links', + )); + $this->database->insert('book')->fields(array( + 'mlid', + 'nid', + 'bid', + )) + ->values(array( + 'mlid' => '1', + 'nid' => '4', + 'bid' => '4', + )) + ->values(array( + 'mlid' => '2', + 'nid' => '5', + 'bid' => '4', + )) + ->values(array( + 'mlid' => '3', + 'nid' => '6', + 'bid' => '4', + )) + ->values(array( + 'mlid' => '4', + 'nid' => '7', + 'bid' => '4', + )) + ->values(array( + 'mlid' => '5', + 'nid' => '8', + 'bid' => '8', + )) + ->execute(); + $this->database->insert('menu_links')->fields(array( + 'menu_name', + 'mlid', + 'plid', + 'link_path', + 'router_path', + 'link_title', + 'options', + 'module', + 'hidden', + 'external', + 'has_children', + 'expanded', + 'weight', + 'depth', + 'customized', + 'p1', + 'p2', + 'p3', + 'p4', + 'p5', + 'p6', + 'p7', + 'p8', + 'p9', + 'updated', + )) + ->values(array( + 'menu_name' => 'book-toc-1', + 'mlid' => '1', + 'plid' => '0', + 'link_path' => 'node/4', + 'router_path' => 'node/%', + 'link_title' => 'Test top book title', + 'options' => 'a:0:{}', + 'module' => 'book', + 'hidden' => '0', + 'external' => '0', + 'has_children' => '1', + 'expanded' => '0', + 'weight' => '-10', + 'depth' => '1', + 'customized' => '0', + 'p1' => '1', + 'p2' => '0', + 'p3' => '0', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + )) + ->values(array( + 'menu_name' => 'book-toc-1', + 'mlid' => '2', + 'plid' => '1', + 'link_path' => 'node/5', + 'router_path' => 'node/%', + 'link_title' => 'Test book title child 1', + 'options' => 'a:0:{}', + 'module' => 'book', + 'hidden' => '0', + 'external' => '0', + 'has_children' => '1', + 'expanded' => '0', + 'weight' => '0', + 'depth' => '2', + 'customized' => '0', + 'p1' => '1', + 'p2' => '2', + 'p3' => '0', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + )) + ->values(array( + 'menu_name' => 'book-toc-1', + 'mlid' => '3', + 'plid' => '2', + 'link_path' => 'node/6', + 'router_path' => 'node/%', + 'link_title' => 'Test book title child 1.1', + 'options' => 'a:0:{}', + 'module' => 'book', + 'hidden' => '0', + 'external' => '0', + 'has_children' => '0', + 'expanded' => '0', + 'weight' => '0', + 'depth' => '3', + 'customized' => '0', + 'p1' => '1', + 'p2' => '2', + 'p3' => '3', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + )) + ->values(array( + 'menu_name' => 'book-toc-1', + 'mlid' => '4', + 'plid' => '2', + 'link_path' => 'node/7', + 'router_path' => 'node/%', + 'link_title' => 'Test book title child 1.2', + 'options' => 'a:0:{}', + 'module' => 'book', + 'hidden' => '0', + 'external' => '0', + 'has_children' => '0', + 'expanded' => '0', + 'weight' => '0', + 'depth' => '3', + 'customized' => '0', + 'p1' => '1', + 'p2' => '2', + 'p3' => '4', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + )) + ->values(array( + 'menu_name' => 'book-toc-2', + 'mlid' => '5', + 'plid' => '0', + 'link_path' => 'node/8', + 'router_path' => 'node/%', + 'link_title' => 'Test top book 2 title', + 'options' => 'a:0:{}', + 'module' => 'book', + 'hidden' => '0', + 'external' => '0', + 'has_children' => '1', + 'expanded' => '0', + 'weight' => '-10', + 'depth' => '1', + 'customized' => '0', + 'p1' => '5', + 'p2' => '0', + 'p3' => '0', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + )) + ->execute(); + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Box.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Box.php new file mode 100644 index 0000000..d042f72 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Box.php @@ -0,0 +1,64 @@ +createTable('boxes', array( + 'description' => 'Stores contents of custom-made blocks.', + 'fields' => array( + 'bid' => array( + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'description' => "The block's {blocks}.bid.", + ), + 'body' => array( + 'type' => 'text', + 'not null' => FALSE, + 'size' => 'big', + 'description' => 'Block contents.', + ), + 'info' => array( + 'type' => 'varchar', + 'length' => 128, + 'not null' => TRUE, + 'default' => '', + 'description' => 'Block description.', + ), + 'format' => array( + 'type' => 'int', + 'size' => 'small', + 'not null' => TRUE, + 'default' => 0, + 'description' => "Block body's {filter_formats}.format; for example, 1 = Filtered HTML.", + ), + ), + 'unique keys' => array('info' => array('info')), + 'primary key' => array('bid'), + )); + + $this->database->insert('boxes')->fields(array( + 'bid', + 'body', + 'info', + 'format', + )) + ->values(array( + 'bid' => '1', + 'body' => '

My custom block body

', + 'info' => 'My block 1', + 'format' => 2, + )) + ->execute(); + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Comment.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Comment.php new file mode 100644 index 0000000..0a938a0 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Comment.php @@ -0,0 +1,189 @@ +createTable('comments', array( + 'description' => 'Stores comments and associated data.', + 'fields' => array( + 'cid' => array( + 'type' => 'serial', + 'not null' => TRUE, + 'description' => 'Primary Key: Unique comment ID.', + ), + 'pid' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {comments}.cid to which this comment is a reply. If set to 0, this comment is not a reply to an existing comment.', + ), + 'nid' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {node}.nid to which this comment is a reply.', + ), + 'uid' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {users}.uid who authored the comment. If set to 0, this comment was created by an anonymous user.', + ), + 'subject' => array( + 'type' => 'varchar', + 'length' => 64, + 'not null' => TRUE, + 'default' => '', + 'description' => 'The comment title.', + ), + 'comment' => array( + 'type' => 'text', + 'not null' => TRUE, + 'size' => 'big', + 'description' => 'The comment body.', + ), + 'hostname' => array( + 'type' => 'varchar', + 'length' => 128, + 'not null' => TRUE, + 'default' => '', + 'description' => "The author's host name.", + ), + 'timestamp' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The time that the comment was created, or last edited by its author, as a Unix timestamp.', + ), + 'status' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'The published status of a comment. (0 = Published, 1 = Not Published)', + ), + 'format' => array( + 'type' => 'int', + 'size' => 'small', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {filter_formats}.format of the comment body.', + ), + 'thread' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'description' => "The vancode representation of the comment's place in a thread.", + ), + 'name' => array( + 'type' => 'varchar', + 'length' => 60, + 'not null' => FALSE, + 'description' => "The comment author's name. Uses {users}.name if the user is logged in, otherwise uses the value typed into the comment form.", + ), + 'mail' => array( + 'type' => 'varchar', + 'length' => 64, + 'not null' => FALSE, + 'description' => "The comment author's e-mail address from the comment form, if user is anonymous, and the 'Anonymous users may/must leave their contact information' setting is turned on.", + ), + 'homepage' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => FALSE, + 'description' => "The comment author's home page address from the comment form, if user is anonymous, and the 'Anonymous users may/must leave their contact information' setting is turned on.", + ), + ), + 'indexes' => array( + 'pid' => array('pid'), + 'nid' => array('nid'), + 'comment_uid' => array('uid'), + 'status' => array('status'), // This index is probably unused + ), + 'primary key' => array('cid'), + )); + $this->database->insert('comments')->fields(array( + 'cid', + 'pid', + 'nid', + 'uid', + 'subject', + 'comment', + 'hostname', + 'timestamp', + 'status', + 'format', + 'thread', + 'name', + 'mail', + 'homepage', + )) + // The comment structure is: + // -1 + // -3 + // --2 + ->values(array( + 'cid' => 1, + 'pid' => 0, + 'nid' => 1, + 'uid' => 0, + 'subject' => 'The first comment.', + 'comment' => 'The first comment body.', + 'hostname' => '127.0.0.1', + 'timestamp' => 1390264918, + 'status' => 0, + 'format' => 1, + 'thread' => '01/', + 'name' => '1st comment author name', + 'mail' => 'comment1@example.com', + 'homepage' => 'http://drupal.org', + )) + ->values(array( + 'cid' => 2, + 'pid' => 3, + 'nid' => 1, + 'uid' => 0, + 'subject' => 'The response to the second comment.', + 'comment' => 'The second comment response body.', + 'hostname' => '127.0.0.1', + 'timestamp' => 1390264938, + 'status' => 0, + 'format' => 1, + 'thread' => '02/01', + 'name' => '3rd comment author name', + 'mail' => 'comment3@example.com', + 'homepage' => 'http://drupal.org', + )) + ->values(array( + 'cid' => 3, + 'pid' => 0, + 'nid' => 1, + 'uid' => 0, + 'subject' => 'The second comment.', + 'comment' => 'The second comment body.', + 'hostname' => '127.0.0.1', + 'timestamp' => 1390264948, + // This comment is unpublished. + 'status' => 1, + 'format' => 1, + 'thread' => '02/', + 'name' => '3rd comment author name', + 'mail' => 'comment3@example.com', + 'homepage' => 'http://drupal.org', + )) + ->execute(); + $this->setModuleVersion('comment', '6001'); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6CommentVariable.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6CommentVariable.php new file mode 100644 index 0000000..9d150f2 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6CommentVariable.php @@ -0,0 +1,238 @@ +createTable('variable'); + $this->createTable('node_type', array( + 'fields' => array( + 'type' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + ), + 'name' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'module' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + ), + 'description' => array( + 'type' => 'text', + 'not null' => TRUE, + 'size' => 'medium', + ), + 'help' => array( + 'type' => 'text', + 'not null' => TRUE, + 'size' => 'medium', + ), + 'has_title' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'size' => 'tiny', + ), + 'title_label' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'has_body' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'size' => 'tiny', + ), + 'body_label' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'min_word_count' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'size' => 'small', + ), + 'custom' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'modified' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'locked' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'orig_type' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + ), + 'primary key' => array( + 'type', + ), + 'module' => 'node', + 'name' => 'node_type', + )); + $this->database->insert('node_type')->fields(array( + 'type', + 'name', + 'module', + 'description', + 'help', + 'has_title', + 'title_label', + 'has_body', + 'body_label', + 'min_word_count', + 'custom', + 'modified', + 'locked', + 'orig_type', + )) + ->values(array( + 'type' => 'page', + 'name' => 'Page', + 'module' => 'node', + 'description' => "A page, similar in form to a story, is a simple method for creating and displaying information that rarely changes, such as an \"About us\" section of a website. By default, a page entry does not allow visitor comments and is not featured on the site's initial home page.", + 'help' => '', + 'has_title' => '1', + 'title_label' => 'Title', + 'has_body' => '1', + 'body_label' => 'Body', + 'min_word_count' => '0', + 'custom' => '1', + 'modified' => '1', + 'locked' => '0', + 'orig_type' => 'page', + )) + ->values(array( + 'type' => 'story', + 'name' => 'Story', + 'module' => 'node', + 'description' => "A story, similar in form to a page, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with a story entry. By default, a story entry is automatically featured on the site's initial home page, and provides the ability to post comments.", + 'help' => '', + 'has_title' => '1', + 'title_label' => 'Title', + 'has_body' => '1', + 'body_label' => 'Body', + 'min_word_count' => '0', + 'custom' => '1', + 'modified' => '1', + 'locked' => '0', + 'orig_type' => 'story', + )) + ->execute(); + $this->database->insert('variable')->fields(array( + 'name', + 'value', + )) + ->values(array( + 'name' => 'comment_anonymous_page', + 'value' => 'i:0;', + )) + ->values(array( + 'name' => 'comment_anonymous_story', + 'value' => 'i:1;', + )) + ->values(array( + 'name' => 'comment_controls_page', + 'value' => 's:1:"3";', + )) + ->values(array( + 'name' => 'comment_controls_story', + 'value' => 's:1:"3";', + )) + ->values(array( + 'name' => 'comment_default_mode_page', + 'value' => 's:1:"4";', + )) + ->values(array( + 'name' => 'comment_default_mode_story', + 'value' => 's:1:"2";', + )) + ->values(array( + 'name' => 'comment_default_order_page', + 'value' => 's:1:"1";', + )) + ->values(array( + 'name' => 'comment_default_order_story', + 'value' => 's:1:"1";', + )) + ->values(array( + 'name' => 'comment_default_per_page_page', + 'value' => 's:2:"50";', + )) + ->values(array( + 'name' => 'comment_default_per_page_story', + 'value' => 's:2:"70";', + )) + ->values(array( + 'name' => 'comment_form_location_page', + 'value' => 's:1:"0";', + )) + ->values(array( + 'name' => 'comment_form_location_story', + 'value' => 's:1:"0";', + )) + ->values(array( + 'name' => 'comment_page', + 'value' => 's:1:"0";', + )) + ->values(array( + 'name' => 'comment_preview_page', + 'value' => 's:1:"1";', + )) + ->values(array( + 'name' => 'comment_preview_story', + 'value' => 's:1:"0";', + )) + ->values(array( + 'name' => 'comment_story', + 'value' => 's:1:"2";', + )) + ->values(array( + 'name' => 'comment_subject_field_page', + 'value' => 's:1:"1";', + )) + ->values(array( + 'name' => 'comment_subject_field_story', + 'value' => 's:1:"0";', + )) + ->execute(); + $this->setModuleVersion('comment', '6001'); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ContactCategory.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ContactCategory.php new file mode 100644 index 0000000..541b6d2 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ContactCategory.php @@ -0,0 +1,81 @@ +createTable('contact', array( + 'description' => 'Contact form category settings.', + 'fields' => array( + 'cid' => array( + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'description' => 'Primary Key: Unique category ID.', + ), + 'category' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'Category name.', + 'translatable' => TRUE, + ), + 'recipients' => array( + 'type' => 'text', + 'not null' => TRUE, + 'size' => 'big', + 'description' => 'Comma-separated list of recipient e-mail addresses.', + ), + 'reply' => array( + 'type' => 'text', + 'not null' => TRUE, + 'size' => 'big', + 'description' => 'Text of the auto-reply message.', + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => "The category's weight.", + ), + 'selected' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'Flag to indicate whether or not category is selected by default. (1 = Yes, 0 = No)', + ), + ), + 'primary key' => array('cid'), + 'unique keys' => array( + 'category' => array('category'), + ), + 'indexes' => array( + 'list' => array('weight', 'category'), + ), + )); + $this->database->insert('contact')->fields(array('cid', 'category', 'recipients', 'reply', 'weight', 'selected')) + ->values(array( + 'cid' => '1', + 'category' => 'Website feedback', + 'recipients' => 'admin@example.com', + 'reply' => '', + 'weight' => '0', + 'selected' => '1', + )) + ->execute(); + $this->setModuleVersion('contact', '6001'); + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6DateFormat.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6DateFormat.php new file mode 100644 index 0000000..c126fee --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6DateFormat.php @@ -0,0 +1,34 @@ +createTable('variable'); + $this->database->insert('variable')->fields(array( + 'name', + 'value', + )) + ->values(array( + 'name' => 'date_format_long', + 'value' => 's:24:"\\L\\O\\N\\G l, F j, Y - H:i";', + )) + ->values(array( + 'name' => 'date_format_medium', + 'value' => 's:27:"\\M\\E\\D\\I\\U\\M D, m/d/Y - H:i";', + )) + ->values(array( + 'name' => 'date_format_short', + 'value' => 's:22:"\\S\\H\\O\\R\\T m/d/Y - H:i";', + )) + ->execute(); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6DumpCommon.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6DumpCommon.php deleted file mode 100644 index f56f3d0..0000000 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6DumpCommon.php +++ /dev/null @@ -1,38 +0,0 @@ -schema()->createTable('variable', array( - 'fields' => array( - 'name' => array( - 'type' => 'varchar', - 'length' => 128, - 'not null' => TRUE, - 'default' => '', - ), - 'value' => array( - 'type' => 'blob', - 'not null' => TRUE, - 'size' => 'big', - 'translatable' => TRUE, - ), - ), - 'primary key' => array( - 'name', - ), - 'module' => 'book', - 'name' => 'variable', - )); - } - -} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php new file mode 100644 index 0000000..9753a38 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php @@ -0,0 +1,853 @@ +createTable('content_node_field_instance', array( + 'description' => 'Table that contains field instance settings.', + 'fields' => array( + 'field_name' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + ), + 'type_name' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'label' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'widget_type' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + ), + 'widget_settings' => array( + 'type' => 'text', + 'size' => 'medium', + 'not null' => TRUE, + 'serialize' => TRUE, + ), + 'display_settings' => array( + 'type' => 'text', + 'size' => 'medium', + 'not null' => TRUE, + 'serialize' => TRUE, + ), + 'description' => array( + 'type' => 'text', + 'size' => 'medium', + 'not null' => TRUE, + ), + 'widget_module' => array( + 'type' => 'varchar', + 'length' => 127, + 'not null' => TRUE, + 'default' => '', + ), + 'widget_active' => array( + 'type' => 'int', + 'size' => 'tiny', + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'primary key' => array('field_name', 'type_name'), + )); + + $this->database->insert('content_node_field_instance')->fields(array( + 'field_name', + 'type_name', + 'weight', + 'label', + 'widget_type', + 'widget_settings', + 'display_settings', + 'description', + )) + ->values(array( + 'field_name' => 'field_test', + 'type_name' => 'story', + 'weight' => 1, + 'label' => 'Text Field', + 'widget_type' => 'text_textfield', + 'widget_settings' => serialize(array( + 'rows' => 5, + 'size' => '60', + 'default_value' => array( + 0 => array( + 'value' => 'text for default value', + '_error_element' => 'default_value_widget][field_test][0][value', + ), + ), + 'default_value_php' => NULL, + )), + 'display_settings' => serialize(array( + 'weight' => 1, + 'parent' => '', + 'label' => array( + 'format' => 'above', + ), + 1 => array( + 'format' => 'default', + 'exclude' => 0, + ), + 'teaser' => array( + 'format' => 'trimmed', + 'exclude' => 0, + ), + 'full' => array( + 'format' => 'default', + 'exclude' => 0, + ), + 4 => array( + 'format' => 'trimmed', + 'exclude' => 0, + ), + 5 => array( + 'format' => 'default', + 'exclude' => 1, + ), + )), + 'description' => 'An example text field.', + )) + ->values(array( + 'field_name' => 'field_test', + 'type_name' => 'article', + 'weight' => 1, + 'label' => 'Text Field', + 'widget_type' => 'text_textfield', + 'widget_settings' => serialize(array( + 'rows' => 5, + 'size' => '60', + 'default_value' => array( + 0 => array( + 'value' => 'text for default value', + '_error_element' => 'default_value_widget][field_test][0][value', + ), + ), + 'default_value_php' => NULL, + )), + 'display_settings' => serialize(array( + 'weight' => 1, + 'parent' => '', + 'label' => array( + 'format' => 'above', + ), + 'teaser' => array( + 'format' => 'trimmed', + 'exclude' => 0, + ), + 'full' => array( + 'format' => 'default', + 'exclude' => 0, + ), + 4 => array( + 'format' => 'trimmed', + 'exclude' => 0, + ), + 5 => array( + 'format' => 'default', + 'exclude' => 1, + ), + )), + 'description' => 'An example textfield.', + )) + ->values(array( + 'field_name' => 'field_test_two', + 'type_name' => 'story', + 'weight' => 2, + 'label' => 'Integer Field', + 'widget_type' => 'number', + 'widget_settings' => 'a:2:{s:13:"default_value";a:1:{i:0;a:2:{s:5:"value";s:0:"";s:14:"_error_element";s:41:"default_value_widget][field_int][0][value";}}s:17:"default_value_php";N;}', + 'display_settings' => serialize(array( + 'weight' => 2, + 'parent' => '', + 'label' => array( + 'format' => 'above', + ), + 'teaser' => array( + 'format' => 'unformatted', + 'exclude' => 0, + ), + 'full' => array( + 'format' => 'us_0', + 'exclude' => 0, + ), + 4 => array( + 'format' => 'unformatted', + 'exclude' => 0, + ), + 5 => array( + 'format' => 'default', + 'exclude' => 1, + ), + )), + 'description' => 'An example integer field.', + )) + ->values(array( + 'field_name' => 'field_test_three', + 'type_name' => 'story', + 'weight' => 3, + 'label' => 'Float Field', + 'widget_type' => 'number', + 'widget_settings' => serialize(array( + 'default_value' => array( + 0 => array( + 'value' => '101', + '_error_element' => 'default_value_widget][field_float][0][value', + ), + ), + 'default_value_php' => NULL, + )), + 'display_settings' => serialize(array( + 'weight' => 3, + 'parent' => '', + 'label' => array( + 'format' => 'above', + ), + 'teaser' => array( + 'format' => 'unformatted', + 'exclude' => 0, + ), + 'full' => array( + 'format' => 'us_2', + 'exclude' => 0, + ), + 4 => array( + 'format' => 'unformatted', + 'exclude' => 0, + ), + 5 => array( + 'format' => 'default', + 'exclude' => 1, + ), + )), + 'description' => 'An example float field.', + )) + ->values(array( + 'field_name' => 'field_test_email', + 'type_name' => 'story', + 'weight' => 4, + 'label' => 'Email Field', + 'widget_type' => 'email_textfield', + 'widget_settings' => serialize(array( + 'size' => '60', + 'default_value' => array( + 0 => array( + 'email' => 'benjy@example.com', + ), + ), + 'default_value_php' => NULL, + )), + 'display_settings' => serialize(array( + 'weight' => 4, + 'parent' => '', + 'label' => array( + 'format' => 'above', + ), + 'teaser' => array( + 'format' => 'default', + 'exclude' => 0, + ), + 'full' => array( + 'format' => 'default', + 'exclude' => 0, + ), + 4 => array( + 'format' => 'default', + 'exclude' => 0, + ), + 5 => array( + 'format' => 'default', + 'exclude' => 1, + ), + )), + 'description' => 'An example email field.', + )) + ->values(array( + 'field_name' => 'field_test_link', + 'type_name' => 'story', + 'weight' => 5, + 'label' => 'Link Field', + 'widget_type' => 'link', + 'widget_settings' => serialize(array( + 'default_value' => array( + 0 => array( + 'title' => 'default link title', + 'url' => 'http://drupal.org', + ), + ), + 'default_value_php' => NULL, + )), + 'display_settings' => serialize(array( + 'weight' => 5, + 'parent' => '', + 'label' => array( + 'format' => 'above', + ), + 'teaser' => array( + 'format' => 'default', + 'exclude' => 0, + ), + 'full' => array( + 'format' => 'absolute', + 'exclude' => 0, + ), + 4 => array( + 'format' => 'default', + 'exclude' => 0, + ), + 5 => array( + 'format' => 'default', + 'exclude' => 1, + ), + )), + 'description' => 'An example link field.', + )) + ->values(array( + 'field_name' => 'field_test_filefield', + 'type_name' => 'story', + 'weight' => 7, + 'label' => 'File Field', + 'widget_type' => 'filefield_widget', + 'widget_settings' => serialize(array( + 'file_extensions' => 'txt pdf doc', + 'file_path' => 'images', + 'progress_indicator' => 'bar', + 'max_filesize_per_file' => '200K', + 'max_filesize_per_node' => '20M', + )), + 'display_settings' => serialize(array( + 'weight' => 7, + 'parent' => '', + 'label' => array( + 'format' => 'above', + ), + 'teaser' => array( + 'format' => 'default', + 'exclude' => 0, + ), + 'full' => array( + 'format' => 'url_plain', + 'exclude' => 0, + ), + 4 => array( + 'format' => 'default', + 'exclude' => 0, + ), + 5 => array( + 'format' => 'default', + 'exclude' => 1, + ), + )), + 'description' => 'An example image field.', + )) + ->values(array( + 'field_name' => 'field_test_imagefield', + 'type_name' => 'story', + 'weight' => 8, + 'label' => 'Image Field', + 'widget_type' => 'imagefield_widget', + 'widget_settings' => serialize(array( + 'file_extensions' => 'png gif jpg jpeg', + 'file_path' => '', + 'progress_indicator' => 'bar', + 'max_filesize_per_file' => '', + 'max_filesize_per_node' => '', + 'max_resolution' => '0', + 'min_resolution' => '0', + 'alt' => 'Test alt', + 'custom_alt' => 0, + 'title' => 'Test title', + 'custom_title' => 0, + 'title_type' => 'textfield', + 'default_image' => NULL, + 'use_default_image' => 0, + )), + 'display_settings' => serialize(array( + 'weight' => 8, + 'parent' => '', + 'label' => array( + 'format' => 'above', + ), + 'teaser' => array( + 'format' => 'image_imagelink', + 'exclude' => 0, + ), + 'full' => array( + 'format' => 'image_plain', + 'exclude' => 0, + ), + 4 => array( + 'format' => 'default', + 'exclude' => 0, + ), + 5 => array( + 'format' => 'default', + 'exclude' => 1, + ), + )), + 'description' => 'An example image field.', + )) + ->values(array( + 'field_name' => 'field_test_phone', + 'type_name' => 'story', + 'weight' => 9, + 'label' => 'Phone Field', + 'widget_type' => 'phone_textfield', + 'widget_settings' => serialize(array( + 'size' => '60', + 'default_value' => array( + 0 => array( + 'value' => '', + '_error_element' => 'default_value_widget][field_phone][0][value', + ), + ), + 'default_value_php' => NULL, + )), + 'display_settings' => serialize(array( + 'weight' => 9, + 'parent' => '', + 'label' => array( + 'format' => 'above', + ), + 'teaser' => array( + 'format' => 'default', + 'exclude' => 0, + ), + 'full' => array( + 'format' => 'default', + 'exclude' => 0, + ), + 4 => array( + 'format' => 'default', + 'exclude' => 0, + ), + 5 => array( + 'format' => 'default', + 'exclude' => 1, + ), + )), + 'description' => 'An example phone field.', + )) + ->values(array( + 'field_name' => 'field_test_date', + 'type_name' => 'story', + 'weight' => 10, + 'label' => 'Date Field', + 'widget_type' => 'date_select', + 'widget_settings' => serialize(array( + 'default_value' => 'blank', + 'default_value_code' => '', + 'default_value2' => 'same', + 'default_value_code2' => '', + 'input_format' => 'm/d/Y - H:i:s', + 'input_format_custom' => '', + 'increment' => '1', + 'text_parts' => array(), + 'year_range' => '-3:+3', + 'label_position' => 'above', + )), + 'display_settings' => serialize(array( + 'weight' => 10, + 'parent' => '', + 'label' => array( + 'format' => 'above', + ), + 'teaser' => array( + 'format' => 'default', + 'exclude' => 0, + ), + 'full' => array( + 'format' => 'long', + 'exclude' => 0, + ), + 4 => array( + 'format' => 'default', + 'exclude' => 0, + ), + 5 => array( + 'format' => 'default', + 'exclude' => 1, + ), + )), + 'description' => 'An example date field.', + )) + ->values(array( + 'field_name' => 'field_test_datestamp', + 'type_name' => 'story', + 'weight' => 11, + 'label' => 'Date Stamp Field', + 'widget_type' => 'date_select', + 'widget_settings' => serialize(array( + 'default_value' => 'blank', + 'default_value_code' => '', + 'default_value2' => 'same', + 'default_value_code2' => '', + 'input_format' => 'm/d/Y - H:i:s', + 'input_format_custom' => '', + 'increment' => '1', + 'text_parts' => array(), + 'year_range' => '-3:+3', + 'label_position' => 'above', + )), + 'display_settings' => serialize(array( + 'weight' => 11, + 'parent' => '', + 'label' => array( + 'format' => 'above', + ), + 'teaser' => array( + 'format' => 'medium', + 'exclude' => 0, + ), + 'full' => array( + 'format' => 'default', + 'exclude' => 0, + ), + 4 => array( + 'format' => 'default', + 'exclude' => 0, + ), + 5 => array( + 'format' => 'default', + 'exclude' => 1, + ), + )), + 'description' => 'An example date stamp field.', + )) + ->values(array( + 'field_name' => 'field_test_datetime', + 'type_name' => 'story', + 'weight' => 12, + 'label' => 'Datetime Field', + 'widget_type' => 'date_select', + 'widget_settings' => serialize(array( + 'default_value' => 'blank', + 'default_value_code' => '', + 'default_value2' => 'same', + 'default_value_code2' => '', + 'input_format' => 'm/d/Y - H:i:s', + 'input_format_custom' => '', + 'increment' => '1', + 'text_parts' => array(), + 'year_range' => '-3:+3', + 'label_position' => 'above', + )), + 'display_settings' => serialize(array( + 'weight' => 12, + 'parent' => '', + 'label' => array( + 'format' => 'above', + ), + 'teaser' => array( + 'format' => 'short', + 'exclude' => 0, + ), + 'full' => array( + 'format' => 'default', + 'exclude' => 0, + ), + 4 => array( + 'format' => 'default', + 'exclude' => 0, + ), + 5 => array( + 'format' => 'default', + 'exclude' => 1, + ), + )), + 'description' => 'An example datetime field.', + )) + ->execute(); + + // Create the field table. + $this->createTable('content_node_field', array( + 'description' => 'Table that contains field instance settings.', + 'fields' => array( + 'field_name' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + ), + 'type' => array( + 'type' => 'varchar', + 'length' => 127, + 'not null' => TRUE, + 'default' => '', + ), + 'global_settings' => array( + 'type' => 'text', + 'size' => 'medium', + 'not null' => TRUE, + 'serialize' => TRUE, + ), + 'required' => array( + 'type' => 'int', + 'size' => 'tiny', + 'not null' => TRUE, + 'default' => 0, + ), + 'multiple' => array( + 'type' => 'int', + 'size' => 'tiny', + 'not null' => TRUE, + 'default' => 0, + ), + 'db_storage' => array( + 'type' => 'int', + 'size' => 'tiny', + 'not null' => TRUE, + 'default' => 1, + ), + 'module' => array( + 'type' => 'varchar', + 'length' => 127, + 'not null' => TRUE, + 'default' => '', + ), + 'db_columns' => array( + 'type' => 'text', + 'size' => 'medium', + 'not null' => TRUE, + 'serialize' => TRUE, + ), + 'active' => array( + 'type' => 'int', + 'size' => 'tiny', + 'not null' => TRUE, + 'default' => 0, + ), + 'locked' => array( + 'type' => 'int', + 'size' => 'tiny', + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'primary key' => array('field_name'), + )); + + $this->database->insert('content_node_field')->fields(array( + 'field_name', + 'module', + 'type', + 'global_settings', + 'multiple', + 'db_storage', + 'db_columns', + 'active', + )) + ->values(array( + 'field_name' => 'field_test', + 'module' => 'text', + 'type' => 'text', + 'global_settings' => 'a:4:{s:15:"text_processing";s:1:"1";s:10:"max_length";s:0:"";s:14:"allowed_values";s:0:"";s:18:"allowed_values_php";s:0:"";}', + 'multiple' => 0, + 'db_storage' => 1, + 'db_columns' => serialize(array( + 'value' => array( + 'type' => 'text', + 'size' => 'big', + 'not null' => FALSE, + 'sortable' => TRUE, + 'views' => TRUE, + ), + )), + 'active' => 1, + )) + ->values(array( + 'field_name' => 'field_test_two', + 'module' => 'number', + 'type' => 'number_integer', + 'global_settings' => 'a:6:{s:6:"prefix";s:4:"pref";s:6:"suffix";s:3:"suf";s:3:"min";i:10;s:3:"max";i:100;s:14:"allowed_values";s:0:"";s:18:"allowed_values_php";s:0:"";}', + 'multiple' => 1, + 'db_storage' => 0, + 'db_columns' => 'a:2:{s:5:"value";a:5:{s:4:"type";s:4:"text";s:4:"size";s:3:"big";s:8:"not null";b:0;s:8:"sortable";b:1;s:5:"views";b:1;}s:6:"format";a:4:{s:4:"type";s:3:"int";s:8:"unsigned";b:1;s:8:"not null";b:0;s:5:"views";b:0;}}', + 'active' => 1, + )) + ->values(array( + 'field_name' => 'field_test_three', + 'module' => 'number', + 'type' => 'number_decimal', + 'global_settings' => '', + 'multiple' => 0, + 'db_storage' => 1, + 'db_columns' => 'a:0:{}', + 'active' => 1, + )) + ->values(array( + 'field_name' => 'field_test_email', + 'module' => 'email', + 'type' => 'email', + 'global_settings' => 'a:0:{}', + 'multiple' => 0, + 'db_storage' => 1, + 'db_columns' => 'a:0:{}', + 'active' => 1, + )) + ->values(array( + 'field_name' => 'field_test_link', + 'module' => 'link', + 'type' => 'link', + 'global_settings' => 'a:7:{s:10:"attributes";a:4:{s:6:"target";s:7:"default";s:3:"rel";s:8:"nofollow";s:5:"class";s:0:"";s:5:"title";s:10:"Link Title";}s:7:"display";a:1:{s:10:"url_cutoff";s:2:"80";}s:3:"url";i:0;s:5:"title";s:8:"required";s:11:"title_value";s:0:"";s:13:"enable_tokens";s:0:"";s:12:"validate_url";i:1;}', + 'multiple' => 0, + 'db_storage' => 1, + 'db_columns' => 'a:0:{}', + 'active' => 1, + )) + ->values(array( + 'field_name' => 'field_test_filefield', + 'module' => 'filefield', + 'type' => 'filefield', + 'global_settings' => 'a:3:{s:10:"list_field";s:1:"0";s:12:"list_default";i:1;s:17:"description_field";s:1:"1";}', + 'multiple' => 0, + 'db_storage' => 1, + 'db_columns' => 'a:0:{}', + 'active' => 1, + )) + ->values(array( + 'field_name' => 'field_test_imagefield', + 'module' => 'filefield', + 'type' => 'filefield', + 'global_settings' => 'a:3:{s:10:"list_field";s:1:"0";s:12:"list_default";i:1;s:17:"description_field";s:1:"0";}', + 'multiple' => 0, + 'db_storage' => 1, + 'db_columns' => 'a:0:{}', + 'active' => 1, + )) + ->values(array( + 'field_name' => 'field_test_phone', + 'module' => 'phone', + 'type' => 'au_phone', + 'global_settings' => 'a:1:{s:5:"value";a:3:{s:4:"type";s:7:"varchar";s:6:"length";i:255;s:8:"not null";b:0;}}', + 'multiple' => 0, + 'db_storage' => 1, + 'db_columns' => 'a:0:{}', + 'active' => 1, + )) + ->values(array( + 'field_name' => 'field_test_date', + 'module' => 'date', + 'type' => 'date', + 'global_settings' => 'a:0:{}', + 'multiple' => 0, + 'db_storage' => 1, + 'db_columns' => 'a:0:{}', + 'active' => 1, + )) + ->values(array( + 'field_name' => 'field_test_datestamp', + 'module' => 'date', + 'type' => 'datestamp', + 'global_settings' => 'a:0:{}', + 'multiple' => 0, + 'db_storage' => 1, + 'db_columns' => 'a:0:{}', + 'active' => 1, + )) + ->values(array( + 'field_name' => 'field_test_datetime', + 'module' => 'date', + 'type' => 'datetime', + 'global_settings' => 'a:0:{}', + 'multiple' => 0, + 'db_storage' => 1, + 'db_columns' => 'a:0:{}', + 'active' => 0, + )) + ->execute(); + + $this->createTable('content_field_test_two', array( + 'description' => 'Table for field_test_two', + 'fields' => array( + 'vid' => array( + 'description' => 'The primary identifier for this version.', + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + 'nid' => array( + 'description' => 'The {node} this version belongs to.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'field_test_two_value' => array( + 'description' => 'Test field column.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'delta' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'field_test_two_format' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'primary key' => array('vid', 'delta'), + )); + $this->database->insert('content_field_test_two')->fields(array( + 'vid', + 'nid', + 'field_test_two_value', + 'delta', + 'field_test_two_format', + )) + ->values(array( + 'vid' => 1, + 'nid' => 1, + 'field_test_two_value' => 10, + 'delta' => 0, + 'field_test_two_format' => 1, + )) + ->values(array( + 'vid' => 1, + 'nid' => 1, + 'field_test_two_value' => 20, + 'delta' => 1, + 'field_test_two_format' => 1, + )) + ->execute(); + $this->setModuleVersion('content', '6001'); + + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6File.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6File.php new file mode 100644 index 0000000..23f0dc6 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6File.php @@ -0,0 +1,129 @@ +createTable('files', array( + 'fields' => array( + 'fid' => array( + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + 'uid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'filename' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'filepath' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'filemime' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'filesize' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'status' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'timestamp' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'indexes' => array( + 'uid' => array( + 'uid', + ), + 'status' => array( + 'status', + ), + 'timestamp' => array( + 'timestamp', + ), + ), + 'primary key' => array( + 'fid', + ), + 'module' => 'system', + 'name' => 'files', + )); + $this->database->insert('files')->fields(array( + 'fid', + 'uid', + 'filename', + 'filepath', + 'filemime', + 'filesize', + 'status', + 'timestamp', + )) + ->values(array( + 'fid' => '1', + 'uid' => '1', + 'filename' => 'Image1.png', + 'filepath' => 'core/modules/simpletest/files/image-1.png', + 'filemime' => 'image/png', + 'filesize' => '39325', + 'status' => '1', + 'timestamp' => '1388880660', + )) + ->values(array( + 'fid' => '2', + 'uid' => '1', + 'filename' => 'Image2.jpg', + 'filepath' => 'core/modules/simpletest/files/image-2.jpg', + 'filemime' => 'image/jpeg', + 'filesize' => '1831', + 'status' => '1', + 'timestamp' => '1388880664', + )) + ->values(array( + 'fid' => '3', + 'uid' => '1', + 'filename' => 'Image-test.gif', + 'filepath' => 'core/modules/simpletest/files/image-test.gif', + 'filemime' => 'image/jpeg', + 'filesize' => '183', + 'status' => '1', + 'timestamp' => '1388880668', + )) + ->execute(); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FilterFormat.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FilterFormat.php index 002e6b8..edfa35a 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FilterFormat.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FilterFormat.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\migrate\Tests\Dump\Drupal6FilterFormats. + * Contains \Drupal\migrate_drupal\Tests\Dump\Drupal6FilterFormats. */ namespace Drupal\migrate_drupal\Tests\Dump; diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Menu.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Menu.php new file mode 100644 index 0000000..01ef84d --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Menu.php @@ -0,0 +1,62 @@ +createTable('menu_custom', array( + 'fields' => array( + 'menu_name' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + ), + 'title' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'description' => array( + 'type' => 'text', + 'not null' => FALSE, + ), + ), + 'primary key' => array( + 'menu_name', + ), + 'module' => 'menu', + 'name' => 'menu_custom', + )); + $this->database->insert('menu_custom')->fields(array('menu_name', 'title', 'description')) + ->values(array( + 'menu_name' => 'navigation', + 'title' => 'Navigation', + 'description' => 'The navigation menu is provided by Drupal and is the main interactive menu for any site. It is usually the only menu that contains personalized links for authenticated users, and is often not even visible to anonymous users.', + )) + ->values(array( + 'menu_name' => 'primary-links', + 'title' => 'Primary links', + 'description' => 'Primary links are often used at the theme layer to show the major sections of a site. A typical representation for primary links would be tabs along the top.', + )) + ->values(array( + 'menu_name' => 'secondary-links', + 'title' => 'Secondary links', + 'description' => 'Secondary links are often used for pages like legal notices, contact details, and other secondary navigation items that play a lesser role than primary links', + )) + ->execute(); + $this->setModuleVersion('menu', '6001'); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Node.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Node.php new file mode 100644 index 0000000..cd31852 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Node.php @@ -0,0 +1,331 @@ +createTable('node', array( + 'description' => 'The base table for nodes.', + 'fields' => array( + 'nid' => array( + 'description' => 'The primary identifier for a node.', + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + 'vid' => array( + 'description' => 'The current {node_revisions}.vid version identifier.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'type' => array( + 'description' => 'The {node_type}.type of this node.', + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + ), + 'language' => array( + 'description' => 'The {languages}.language of this node.', + 'type' => 'varchar', + 'length' => 12, + 'not null' => TRUE, + 'default' => '', + ), + 'title' => array( + 'description' => 'The title of this node, always treated as non-markup plain text.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'uid' => array( + 'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'status' => array( + 'description' => 'Boolean indicating whether the node is published (visible to non-administrators).', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 1, + ), + 'created' => array( + 'description' => 'The Unix timestamp when the node was created.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'changed' => array( + 'description' => 'The Unix timestamp when the node was most recently saved.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'comment' => array( + 'description' => 'Whether comments are allowed on this node: 0 = no, 1 = read only, 2 = read/write.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'promote' => array( + 'description' => 'Boolean indicating whether the node should be displayed on the front page.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'moderate' => array( + 'description' => 'Previously, a boolean indicating whether the node was "in moderation"; mostly no longer used.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'sticky' => array( + 'description' => 'Boolean indicating whether the node should be displayed at the top of lists in which it appears.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'tnid' => array( + 'description' => 'The translation set id for this node, which equals the node id of the source post in each set.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'translate' => array( + 'description' => 'A boolean indicating whether this translation page needs to be updated.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'indexes' => array( + 'node_changed' => array('changed'), + 'node_created' => array('created'), + 'node_moderate' => array('moderate'), + 'node_promote_status' => array('promote', 'status'), + 'node_status_type' => array('status', 'type', 'nid'), + 'node_title_type' => array('title', array('type', 4)), + 'node_type' => array(array('type', 4)), + 'uid' => array('uid'), + 'tnid' => array('tnid'), + 'translate' => array('translate'), + ), + 'unique keys' => array( + 'vid' => array('vid'), + ), + 'primary key' => array('nid'), + )); + $this->database->insert('node')->fields(array( + 'nid', + 'vid', + 'type', + 'language', + 'title', + 'uid', + 'status', + 'created', + 'changed', + 'comment', + 'promote', + 'moderate', + 'sticky', + 'tnid', + 'translate', + )) + ->values(array( + 'nid' => 1, + 'vid' => 1, + 'type' => 'story', + 'language' => '', + 'title' => 'Test title', + 'uid' => 1, + 'status' => 1, + 'created' => 1388271197, + 'changed' => 1390095701, + 'comment' => 0, + 'promote' => 0, + 'moderate' => 0, + 'sticky' => 0, + 'tnid' => 0, + 'translate' => 0, + )) + ->values(array( + 'nid' => 2, + 'vid' => 3, + 'type' => 'story', + 'language' => '', + 'title' => 'Test title 2', + 'uid' => 1, + 'status' => 1, + 'created' => 1388271197, + 'changed' => 1390095701, + 'comment' => 0, + 'promote' => 0, + 'moderate' => 0, + 'sticky' => 0, + 'tnid' => 0, + 'translate' => 0, + )) + ->execute(); + $this->createTable('node_revisions', array( + 'description' => 'Stores information about each saved version of a {node}.', + 'fields' => array( + 'nid' => array( + 'description' => 'The {node} this version belongs to.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'vid' => array( + 'description' => 'The primary identifier for this version.', + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + 'uid' => array( + 'description' => 'The {users}.uid that created this version.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'title' => array( + 'description' => 'The title of this version.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'body' => array( + 'description' => 'The body of this version.', + 'type' => 'text', + 'not null' => TRUE, + 'size' => 'big', + ), + 'teaser' => array( + 'description' => 'The teaser of this version.', + 'type' => 'text', + 'not null' => TRUE, + 'size' => 'big', + ), + 'log' => array( + 'description' => 'The log entry explaining the changes in this version.', + 'type' => 'text', + 'not null' => TRUE, + 'size' => 'big', + ), + 'timestamp' => array( + 'description' => 'A Unix timestamp indicating when this version was created.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'format' => array( + 'description' => "The input format used by this version's body.", + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'indexes' => array( + 'nid' => array('nid'), + 'uid' => array('uid'), + ), + 'primary key' => array('vid'), + )); + + $this->database->insert('node_revisions')->fields( + array( + 'nid', + 'vid', + 'uid', + 'title', + 'body', + 'teaser', + 'log', + 'timestamp', + 'format', + )) + ->values(array( + 'nid' => 1, + 'vid' => 1, + 'uid' => 1, + 'title' => 'Test title', + 'body' => 'test', + 'teaser' => 'test', + 'log' => '', + 'timestamp' => 1390095701, + 'format' => 1, + )) + ->values(array( + 'nid' => 2, + 'vid' => 3, + 'uid' => 1, + 'title' => 'Test title rev 3', + 'body' => 'test rev 3', + 'teaser' => 'test rev 3', + 'log' => '', + 'timestamp' => 1390095701, + 'format' => 1, + )) + ->execute(); + + $this->createTable('content_type_story', array( + 'description' => 'The content type join table.', + 'fields' => array( + 'nid' => array( + 'description' => 'The {node} this version belongs to.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'vid' => array( + 'description' => 'The primary identifier for this version.', + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + 'field_test_value' => array( + 'description' => 'Test field column.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + ), + 'primary key' => array('vid'), + )); + + $this->database->insert('content_type_story')->fields( + array( + 'nid', + 'vid', + 'field_test_value', + )) + ->values(array( + 'nid' => 1, + 'vid' => 1, + 'field_test_value' => 'This is a text field', + )) + ->execute(); + $this->setModuleVersion('content', 6001); + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeBodyInstance.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeBodyInstance.php new file mode 100644 index 0000000..8ec82b5 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeBodyInstance.php @@ -0,0 +1,102 @@ +createTable('variable'); + $this->createTable('node_type'); + $this->database->insert('node_type')->fields(array( + 'type', + 'name', + 'module', + 'description', + 'help', + 'has_title', + 'title_label', + 'has_body', + 'body_label', + 'min_word_count', + 'custom', + 'modified', + 'locked', + 'orig_type' + )) + ->values(array( + 'type' => 'company', + 'name' => 'Company', + 'module' => 'node', + 'description' => 'Company node type', + 'help' => '', + 'has_title' => 1, + 'title_label' => 'Name', + 'has_body' => 1, + 'body_label' => 'Description', + 'min_word_count' => 20, + 'custom' => 0, + 'modified' => 0, + 'locked' => 0, + 'orig_type' => 'company', + )) + ->values(array( + 'type' => 'employee', + 'name' => 'Employee', + 'module' => 'node', + 'description' => 'Employee node type', + 'help' => '', + 'has_title' => 1, + 'title_label' => 'Name', + 'has_body' => 1, + 'body_label' => 'Bio', + 'min_word_count' => 20, + 'custom' => 0, + 'modified' => 0, + 'locked' => 0, + 'orig_type' => 'employee', + )) + ->values(array( + 'type' => 'sponsor', + 'name' => 'Sponsor', + 'module' => 'node', + 'description' => 'Sponsor node type', + 'help' => '', + 'has_title' => 1, + 'title_label' => 'Name', + 'has_body' => 0, + 'body_label' => 'Body', + 'min_word_count' => 0, + 'custom' => 0, + 'modified' => 0, + 'locked' => 0, + 'orig_type' => '', + )) + ->execute(); + $this->database->insert('variable')->fields(array( + 'name', + 'value', + )) + ->values(array( + 'name' => 'teaser_length', + 'value' => 'i:456;', + )) + ->values(array( + 'name' => 'node_preview', + 'value' => 'i:0;', + )) + ->execute(); + + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeRevision.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeRevision.php new file mode 100644 index 0000000..04a4ad5 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeRevision.php @@ -0,0 +1,42 @@ +database->insert('node_revisions')->fields( + array( + 'nid', + 'vid', + 'uid', + 'title', + 'body', + 'teaser', + 'log', + 'timestamp', + 'format', + )) + ->values(array( + 'nid' => 1, + 'vid' => 2, + 'uid' => 1, + 'title' => 'Test title rev 2', + 'body' => 'test rev 2', + 'teaser' => 'test rev 2', + 'log' => '', + 'timestamp' => 1390095701, + 'format' => 1, + )) + ->execute(); + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeType.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeType.php new file mode 100644 index 0000000..87db257 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeType.php @@ -0,0 +1,136 @@ +createTable('node_type'); + $this->database->insert('node_type')->fields( + array( + 'type', + 'name', + 'module', + 'description', + 'help', + 'has_title', + 'title_label', + 'has_body', + 'body_label', + 'min_word_count', + 'custom', + 'modified', + 'locked', + 'orig_type', + )) + ->values(array( + 'type' => 'test_page', + 'name' => 'Migrate test page', + 'module' => 'node', + 'description' => "A page, similar in form to a story, is a simple method for creating and displaying information that rarely changes, such as an \"About us\" section of a website. By default, a page entry does not allow visitor comments and is not featured on the site's initial home page.", + 'help' => '', + 'has_title' => 1, + 'title_label' => 'Title', + 'has_body' => 1, + 'body_label' => 'Body', + 'min_word_count' => 0, + 'custom' => 1, + 'modified' => 1, + 'locked' => 0, + 'orig_type' => 'page', + )) + ->values(array( + 'type' => 'test_story', + 'name' => 'Migrate test story', + 'module' => 'node', + 'description' => "A story, similar in form to a page, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with a story entry. By default, a story entry is automatically featured on the site's initial home page, and provides the ability to post comments.", + 'help' => '', + 'has_title' => 1, + 'title_label' => 'Title', + 'has_body' => 0, + 'body_label' => 'Body', + 'min_word_count' => 0, + 'custom' => 1, + 'modified' => 1, + 'locked' => 0, + 'orig_type' => 'story', + )) + ->execute(); + + $this->database->merge('node_type') + ->key(array('type' => 'story')) + ->fields(array( + 'name' => 'Story', + 'module' => 'node', + 'description' => "A story, similar in form to a page, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with a story entry. By default, a story entry is automatically featured on the site's initial home page, and provides the ability to post comments.", + 'help' => '', + 'has_title' => '1', + 'title_label' => 'Title', + 'has_body' => '1', + 'body_label' => 'Body', + 'min_word_count' => '0', + 'custom' => '1', + 'modified' => '1', + 'locked' => '0', + 'orig_type' => 'story', + )) + ->execute(); + + $this->createTable('variable'); + $this->database->insert('variable')->fields(array( + 'name', + 'value', + )) + ->values(array( + 'name' => 'node_options_migrate_test_page', + 'value' => serialize(array( + 0 => 'status', + 1 => 'promote', + 2 => 'sticky', + )), + )) + ->values(array( + 'name' => 'node_options_migrate_test_story', + 'value' => serialize(array( + 0 => 'status', + 1 => 'promote', + )), + )) + ->values(array( + 'name' => 'theme_settings', + 'value' => serialize(array( + 'toggle_logo' => 1, + 'toggle_name' => 1, + 'toggle_slogan' => 0, + 'toggle_mission' => 1, + 'toggle_node_user_picture' => 0, + 'toggle_comment_user_picture' => 0, + 'toggle_search' => 0, + 'toggle_favicon' => 1, + 'toggle_primary_links' => 1, + 'toggle_secondary_links' => 1, + 'toggle_node_info_test' => 1, + 'toggle_node_info_something' => 1, + 'default_logo' => 1, + 'logo_path' => '', + 'logo_upload' => '', + 'default_favicon' => 1, + 'favicon_path' => '', + 'favicon_upload' => '', + 'toggle_node_info_migrate_test_page' => 1, + 'toggle_node_info_migrate_test_story' => 1, + )), + )) + ->execute(); + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SearchPage.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SearchPage.php new file mode 100644 index 0000000..c0c7298 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SearchPage.php @@ -0,0 +1,51 @@ +createTable('variable'); + $this->database->insert('variable')->fields(array( + 'name', + 'value', + )) + ->values(array( + 'name' => 'node_rank_comments', + 'value' => 's:1:"5";', + )) + ->values(array( + 'name' => 'node_rank_promote', + 'value' => 's:1:"0";', + )) + ->values(array( + 'name' => 'node_rank_recent', + 'value' => 's:1:"0";', + )) + ->values(array( + 'name' => 'node_rank_relevance', + 'value' => 's:1:"2";', + )) + ->values(array( + 'name' => 'node_rank_sticky', + 'value' => 's:1:"8";', + )) + ->values(array( + 'name' => 'node_rank_views', + 'value' => 's:1:"1";', + )) + ->execute(); + + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SearchSettings.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SearchSettings.php index fffc6c7..e6c8ea0 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SearchSettings.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SearchSettings.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\migrate\Tests\Drupal6SearchSettings. + * Contains \Drupal\migrate_drupal\Tests\Dump\Drupal6SearchSettings. */ namespace Drupal\migrate_drupal\Tests\Dump; diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyTerm.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyTerm.php new file mode 100644 index 0000000..2f96140 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyTerm.php @@ -0,0 +1,182 @@ +setModuleVersion('taxonomy', 6000); + + $this->createTable('term_data', array( + 'fields' => array( + 'tid' => array( + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + 'vid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'name' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'description' => array( + 'type' => 'text', + 'not null' => FALSE, + 'size' => 'big', + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + ), + 'primary key' => array( + 'tid', + ), + 'indexes' => array( + 'taxonomy_tree' => array( + 'vid', + 'weight', + 'name', + ), + 'vid_name' => array( + 'vid', + 'name', + ), + ), + 'module' => 'taxonomy', + 'name' => 'term_data', + )); + + $this->createTable('term_hierarchy', array( + 'fields' => array( + 'tid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'parent' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'indexes' => array( + 'parent' => array( + 'parent', + ), + ), + 'primary key' => array( + 'tid', + 'parent', + ), + 'module' => 'taxonomy', + 'name' => 'term_hierarchy', + )); + + $this->database->insert('term_data')->fields(array( + 'tid', + 'vid', + 'name', + 'description', + 'weight', + )) + ->values(array( + 'tid' => '1', + 'vid' => '1', + 'name' => 'term 1 of vocabulary 1', + 'description' => 'description of term 1 of vocabulary 1', + 'weight' => '0', + )) + ->values(array( + 'tid' => '2', + 'vid' => '2', + 'name' => 'term 2 of vocabulary 2', + 'description' => 'description of term 2 of vocabulary 2', + 'weight' => '3', + )) + ->values(array( + 'tid' => '3', + 'vid' => '2', + 'name' => 'term 3 of vocabulary 2', + 'description' => 'description of term 3 of vocabulary 2', + 'weight' => '4', + )) + ->values(array( + 'tid' => '4', + 'vid' => '3', + 'name' => 'term 4 of vocabulary 3', + 'description' => 'description of term 4 of vocabulary 3', + 'weight' => '6', + )) + ->values(array( + 'tid' => '5', + 'vid' => '3', + 'name' => 'term 5 of vocabulary 3', + 'description' => 'description of term 5 of vocabulary 3', + 'weight' => '7', + )) + ->values(array( + 'tid' => '6', + 'vid' => '3', + 'name' => 'term 6 of vocabulary 3', + 'description' => 'description of term 6 of vocabulary 3', + 'weight' => '8', + )) + ->execute(); + + $this->database->insert('term_hierarchy')->fields(array( + 'tid', + 'parent', + )) + ->values(array( + 'tid' => '1', + 'parent' => '0', + )) + ->values(array( + 'tid' => '2', + 'parent' => '0', + )) + ->values(array( + 'tid' => '4', + 'parent' => '0', + )) + ->values(array( + 'tid' => '3', + 'parent' => '2', + )) + ->values(array( + 'tid' => '5', + 'parent' => '4', + )) + ->values(array( + 'tid' => '6', + 'parent' => '4', + )) + ->values(array( + 'tid' => '6', + 'parent' => '5', + )) + ->execute(); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyVocabulary.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyVocabulary.php new file mode 100644 index 0000000..70b2429 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyVocabulary.php @@ -0,0 +1,186 @@ +createTable('vocabulary', array( + 'description' => 'Stores vocabulary information.', + 'fields' => array( + 'vid' => array( + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'description' => 'Primary Key: Unique vocabulary ID.', + ), + 'name' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'Name of the vocabulary.', + ), + 'description' => array( + 'type' => 'text', + 'not null' => FALSE, + 'size' => 'big', + 'description' => 'Description of the vocabulary.', + ), + 'help' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'Help text to display for the vocabulary.', + ), + 'relations' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'Whether or not related terms are enabled within the vocabulary. (0 = disabled, 1 = enabled)', + ), + 'hierarchy' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)', + ), + 'multiple' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'Whether or not multiple terms from this vocabulary may be assigned to a node. (0 = disabled, 1 = enabled)', + ), + 'required' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'Whether or not terms are required for nodes using this vocabulary. (0 = disabled, 1 = enabled)', + ), + 'tags' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'Whether or not free tagging is enabled for the vocabulary. (0 = disabled, 1 = enabled)', + ), + 'module' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'The module which created the vocabulary.', + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'The weight of the vocabulary in relation to other vocabularies.', + ), + ), + 'primary key' => array('vid'), + 'indexes' => array( + 'list' => array('weight', 'name'), + ), + )); + $this->createTable('vocabulary_node_types', array( + 'description' => 'Stores which node types vocabularies may be used with.', + 'fields' => array( + 'vid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'Primary Key: the {vocabulary}.vid of the vocabulary.', + ), + 'type' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + 'description' => 'The {node}.type of the node type for which the vocabulary may be used.', + ), + ), + 'primary key' => array('type', 'vid'), + 'indexes' => array( + 'vid' => array('vid'), + ), + )); + $this->database->insert('vocabulary')->fields(array( + 'vid', + 'name', + 'description', + 'help', + 'relations', + 'hierarchy', + 'multiple', + 'required', + 'tags', + 'module', + 'weight', + )) + ->values(array( + 'vid' => '1', + 'name' => 'vocabulary 1 (i=0)', + 'description' => 'description of vocabulary 1 (i=0)', + 'help' => '', + 'relations' => '1', + 'hierarchy' => '0', + 'multiple' => '0', + 'required' => '0', + 'tags' => '0', + 'module' => 'taxonomy', + 'weight' => '4', + )) + ->values(array( + 'vid' => '2', + 'name' => 'vocabulary 2 (i=1)', + 'description' => 'description of vocabulary 2 (i=1)', + 'help' => '', + 'relations' => '1', + 'hierarchy' => '1', + 'multiple' => '1', + 'required' => '0', + 'tags' => '0', + 'module' => 'taxonomy', + 'weight' => '5', + )) + ->values(array( + 'vid' => '3', + 'name' => 'vocabulary 3 (i=2)', + 'description' => 'description of vocabulary 3 (i=2)', + 'help' => '', + 'relations' => '1', + 'hierarchy' => '2', + 'multiple' => '0', + 'required' => '0', + 'tags' => '0', + 'module' => 'taxonomy', + 'weight' => '6', + )) + ->execute(); + $this->setModuleVersion('taxonomy', 6001); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TermNode.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TermNode.php new file mode 100644 index 0000000..8df32d7 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TermNode.php @@ -0,0 +1,89 @@ +setModuleVersion('taxonomy', 6000); + $this->createTable('term_node', array( + 'fields' => array( + 'nid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'vid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + 'tid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + ), + 'indexes' => array( + 'vid' => array( + 'vid', + ), + 'nid' => array( + 'nid', + ), + ), + 'primary key' => array( + 'tid', + 'vid', + ), + 'module' => 'taxonomy', + 'name' => 'term_node', + )); + $this->database->insert('term_node')->fields(array( + 'nid', + 'vid', + 'tid', + )) + ->values(array( + 'nid' => 1, + 'vid' => 1, + 'tid' => 1, + )) + ->values(array( + 'nid' => 1, + 'vid' => 2, + 'tid' => 5, + )) + ->values(array( + 'nid' => 1, + 'vid' => 2, + 'tid' => 4, + )) + ->values(array( + 'nid' => 2, + 'vid' => 3, + 'tid' => 2, + )) + ->values(array( + 'nid' => 2, + 'vid' => 3, + 'tid' => 3, + )) + ->execute(); + + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Upload.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Upload.php new file mode 100644 index 0000000..6fd53d3 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Upload.php @@ -0,0 +1,120 @@ +setModuleVersion('upload', 6000); + $this->createTable('upload', array( + 'fields' => array( + 'fid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'Primary Key: The {files}.fid.', + ), + 'nid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {node}.nid associated with the uploaded file.', + ), + 'vid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'Primary Key: The {node}.vid associated with the uploaded file.', + ), + 'description' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => 'Description of the uploaded file.', + ), + 'list' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'Whether the file should be visibly listed on the node: yes(1) or no(0).', + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'Weight of this upload in relation to other uploads in this node.', + ), + ), + 'primary key' => array('vid', 'fid'), + 'indexes' => array( + 'fid' => array('fid'), + 'nid' => array('nid'), + ), + )); + $this->database->insert('upload')->fields(array( + 'nid', + 'vid', + 'fid', + 'description', + 'list', + 'weight', + )) + ->values(array( + 'nid' => 1, + 'vid' => 1, + 'fid' => 1, + 'description' => 'file 1-1-1', + 'list' => 0, + 'weight' => 5, + )) + ->values(array( + 'nid' => 1, + 'vid' => 2, + 'fid' => 2, + 'description' => 'file 1-2-2', + 'list' => 1, + 'weight' => 4, + )) + ->values(array( + 'nid' => 1, + 'vid' => 2, + 'fid' => 3, + 'description' => 'file 1-2-3', + 'list' => 0, + 'weight' => 3, + )) + ->values(array( + 'nid' => 2, + 'vid' => 3, + 'fid' => 2, + 'description' => 'file 2-3-2', + 'list' => 1, + 'weight' => 2, + )) + ->values(array( + 'nid' => 2, + 'vid' => 3, + 'fid' => 3, + 'description' => 'file 2-3-3', + 'list' => 0, + 'weight' => 1, + )) + ->execute(); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UploadField.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UploadField.php new file mode 100644 index 0000000..6df410d --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UploadField.php @@ -0,0 +1,19 @@ +setModuleVersion('upload', 6000); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UploadInstance.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UploadInstance.php new file mode 100644 index 0000000..c3721ba --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UploadInstance.php @@ -0,0 +1,95 @@ +setModuleVersion('upload', 6000); + $this->createTable('node_type'); + $this->database->merge('node_type') + ->key(array('type' => 'page')) + ->fields(array( + 'name' => 'Page', + 'module' => 'node', + 'description' => "A page, similar in form to a story, is a simple method for creating and displaying information that rarely changes, such as an \"About us\" section of a website. By default, a page entry does not allow visitor comments and is not featured on the site's initial home page.", + 'help' => '', + 'has_title' => '1', + 'title_label' => 'Title', + 'has_body' => '1', + 'body_label' => 'Body', + 'min_word_count' => '0', + 'custom' => '1', + 'modified' => '1', + 'locked' => '0', + 'orig_type' => 'page', + )) + ->execute(); + $this->database->merge('node_type') + ->key(array('type' => 'story')) + ->fields(array( + 'name' => 'Story', + 'module' => 'node', + 'description' => "A story, similar in form to a page, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with a story entry. By default, a story entry is automatically featured on the site's initial home page, and provides the ability to post comments.", + 'help' => '', + 'has_title' => '1', + 'title_label' => 'Title', + 'has_body' => '1', + 'body_label' => 'Body', + 'min_word_count' => '0', + 'custom' => '1', + 'modified' => '1', + 'locked' => '0', + 'orig_type' => 'story', + )) + ->execute(); + $this->database->merge('node_type') + ->key(array('type' => 'article')) + ->fields(array( + 'name' => 'Article', + 'module' => 'node', + 'description' => "An article, content type.", + 'help' => '', + 'has_title' => '1', + 'title_label' => 'Title', + 'has_body' => '1', + 'body_label' => 'Body', + 'min_word_count' => '0', + 'custom' => '1', + 'modified' => '1', + 'locked' => '0', + 'orig_type' => 'story', + )) + ->execute(); + $this->createTable('variable'); + $this->database->insert('variable')->fields(array( + 'name', + 'value', + )) + ->values(array( + 'name' => 'upload_page', + 'value' => 'b:1;', + )) + ->values(array( + 'name' => 'upload_story', + 'value' => 'b:1;', + )) + ->values(array( + 'name' => 'upload_article', + 'value' => 'b:0;', + )) + ->execute(); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UrlAlias.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UrlAlias.php new file mode 100644 index 0000000..2af66ef --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UrlAlias.php @@ -0,0 +1,82 @@ +createTable('url_alias', array( + 'description' => 'A list of URL aliases for Drupal paths; a user may visit either the source or destination path.', + 'fields' => array( + 'pid' => array( + 'description' => 'A unique path alias identifier.', + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + 'src' => array( + 'description' => 'The Drupal path this alias is for; e.g. node/12.', + 'type' => 'varchar', + 'length' => 128, + 'not null' => TRUE, + 'default' => '', + ), + 'dst' => array( + 'description' => 'The alias for this path; e.g. title-of-the-story.', + 'type' => 'varchar', + 'length' => 128, + 'not null' => TRUE, + 'default' => '', + ), + 'language' => array( + 'description' => 'The language this alias is for; if blank, the alias will be used for unknown languages. Each Drupal path can have an alias for each supported language.', + 'type' => 'varchar', + 'length' => 12, + 'not null' => TRUE, + 'default' => '', + ), + ), + 'unique keys' => array( + 'dst_language_pid' => array( + 'dst', + 'language', + 'pid', + ), + ), + 'primary key' => array('pid'), + 'indexes' => array('src_language_pid' => array('src', 'language', 'pid')), + )); + + $this->database->insert('url_alias')->fields(array( + 'pid', + 'src', + 'dst', + 'language', + )) + ->values(array( + 'pid' => 1, + 'src' => 'node/1', + 'dst' => 'alias-one', + 'language' => 'en', + )) + ->values(array( + 'pid' => 2, + 'src' => 'node/2', + 'dst' => 'alias-two', + 'language' => 'en', + )) + ->execute(); + + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6User.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6User.php new file mode 100644 index 0000000..2b662e8 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6User.php @@ -0,0 +1,423 @@ + $schema) { + // Create tables. + $this->createTable($table, $schema); + + // Insert data. + $data = static::getData($table); + if ($data) { + $query = $this->database->insert($table)->fields(array_keys($data[0])); + foreach ($data as $record) { + $query->values($record); + } + $query->execute(); + } + } + } + + /** + * Defines schema for this database dump. + * + * @return array + * Associative array having the structure as is returned by hook_schema(). + */ + protected static function getSchema() { + return array( + 'users' => array( + 'description' => 'Stores user data.', + 'fields' => array( + 'uid' => array( + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'description' => 'Primary Key: Unique user ID.', + ), + 'name' => array( + 'type' => 'varchar', + 'length' => 60, + 'not null' => TRUE, + 'default' => '', + 'description' => 'Unique user name.', + ), + 'pass' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + 'description' => "User's password (md5 hash).", + ), + 'mail' => array( + 'type' => 'varchar', + 'length' => 64, + 'not null' => FALSE, + 'default' => '', + 'description' => "User's email address.", + ), + 'mode' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'Per-user comment display mode (threaded vs. flat), used by the {comment} module.', + ), + 'sort' => array( + 'type' => 'int', + 'not null' => FALSE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'Per-user comment sort order (newest vs. oldest first), used by the {comment} module.', + ), + 'threshold' => array( + 'type' => 'int', + 'not null' => FALSE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'Previously used by the {comment} module for per-user preferences; no longer used.', + ), + 'theme' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => "User's default theme.", + ), + 'signature' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => "User's signature.", + ), + 'signature_format' => array( + 'type' => 'int', + 'size' => 'small', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {filter_formats}.format of the signature.', + ), + 'created' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'Timestamp for when user was created.', + ), + 'access' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'Timestamp for previous time user accessed the site.', + ), + 'login' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => "Timestamp for user's last login.", + ), + 'status' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'Whether the user is active(1) or blocked(0).', + ), + 'timezone' => array( + 'type' => 'varchar', + 'length' => 8, + 'not null' => FALSE, + 'description' => "User's timezone.", + ), + 'language' => array( + 'type' => 'varchar', + 'length' => 12, + 'not null' => TRUE, + 'default' => '', + 'description' => "User's default language.", + ), + 'picture' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => "Path to the user's uploaded picture.", + ), + 'init' => array( + 'type' => 'varchar', + 'length' => 64, + 'not null' => FALSE, + 'default' => '', + 'description' => 'Email address used for initial account creation.', + ), + 'data' => array( + 'type' => 'text', + 'not null' => FALSE, + 'size' => 'big', + 'description' => 'A serialized array of name value pairs that are related to the user. Any form values posted during user edit are stored and are loaded into the $user object during user_load(). Use of this field is discouraged and it will likely disappear in a future version of Drupal.', + ), + // Field not part of Drupal 6 schema. Added by Date contributed module. + 'timezone_name' => array( + 'type' => 'varchar', + 'length' => 50, + 'not null' => FALSE, + 'default' => '', + 'description' => 'Field added by Date contributed module.', + ), + // Field not part of Drupal 6 schema. Added by Event contributed module. + 'timezone_id' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'Field added by Event contributed module.', + ), + // Field not part of Drupal 6 schema. Needed to test password rehashing. + 'pass_plain' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => "User's password (plain).", + ), + // Field not part of Drupal 6 schema. Needed to test user_update_7002. + 'expected_timezone' => array( + 'type' => 'varchar', + 'length' => 50, + 'not null' => FALSE, + ), + ), + 'indexes' => array( + 'access' => array('access'), + 'created' => array('created'), + 'mail' => array('mail'), + ), + 'unique keys' => array( + 'name' => array('name'), + ), + 'primary key' => array('uid'), + ), + 'users_roles' => array( + 'description' => 'Maps users to roles.', + 'fields' => array( + 'uid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'Primary Key: {users}.uid for user.', + ), + 'rid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'Primary Key: {role}.rid for role.', + ), + ), + 'primary key' => array('uid', 'rid'), + 'indexes' => array( + 'rid' => array('rid'), + ), + ), + 'event_timezones' => array( + 'fields' => array( + 'timezone' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + ), + 'name' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + ) + ), + 'profile_values' => array( + 'description' => 'Stores values for profile fields.', + 'fields' => array( + 'fid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {profile_field}.fid of the field.', + ), + 'uid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {users}.uid of the profile user.', + ), + 'value' => array( + 'type' => 'text', + 'not null' => FALSE, + 'description' => 'The value for the field.', + ), + ), + 'primary key' => array('uid', 'fid'), + 'indexes' => array( + 'fid' => array('fid'), + ), + 'foreign keys' => array( + 'profile_field' => array( + 'table' => 'profile_field', + 'columns' => array('fid' => 'fid'), + ), + 'profile_user' => array( + 'table' => 'users', + 'columns' => array('uid' => 'uid'), + ), + ), + ), + ); + } + + /** + * Returns dump data from a specific table. + * + * @param string $table + * The table name. + * + * @return array + * Array of associative arrays each one having fields as keys. + */ + public static function getData($table) { + $data = array( + 'users' => array( + array( + 'uid' => 2, + 'name' => 'john.doe', + 'pass' => md5('john.doe_pass'), + 'mail' => 'john.doe@example.com', + 'picture' => 'core/modules/simpletest/files/image-test.jpg', + 'mode' => 0, + 'sort' => 0, + 'threshold' => 0, + 'theme' => '', + 'signature' => 'John Doe | john.doe@example.com', + 'signature_format' => 1, + 'created' => 1391150052, + 'access' => 1391259672, + 'login' => 1391152253, + 'status' => 1, + 'timezone' => '3600', + 'language' => 'fr', + 'init' => 'doe@example.com', + 'data' => serialize(array()), + 'timezone_name' => NULL, + 'timezone_id' => 1, + 'pass_plain' => 'john.doe_pass', + 'expected_timezone' => 'Europe/Berlin', + ), + array( + 'uid' => 8, + 'name' => 'joe.roe', + 'pass' => md5('joe.roe_pass'), + 'mail' => 'joe.roe@example.com', + 'picture' => 'core/modules/simpletest/files/image-test.png', + 'mode' => 0, + 'sort' => 0, + 'threshold' => 0, + 'theme' => '', + 'signature' => 'JR', + 'signature_format' => 2, + 'created' => 1391150053, + 'access' => 1391259673, + 'login' => 1391152254, + 'status' => 1, + 'timezone' => '7200', + 'language' => 'ro', + 'init' => 'roe@example.com', + 'data' => serialize(array()), + 'timezone_name' => 'Europe/Helsinki', + 'timezone_id' => 0, + 'pass_plain' => 'joe.roe_pass', + 'expected_timezone' => 'Europe/Helsinki', + ), + array( + 'uid' => 15, + 'name' => 'joe.bloggs', + 'pass' => md5('joe.bloggs_pass'), + 'mail' => 'joe.bloggs@example.com', + 'picture' => '', + 'mode' => 0, + 'sort' => 0, + 'threshold' => 0, + 'theme' => '', + 'signature' => 'bloggs', + 'signature_format' => 1, + 'created' => 1391150054, + 'access' => 1391259674, + 'login' => 1391152255, + 'status' => 1, + 'timezone' => '3600', + 'language' => 'en', + 'init' => 'bloggs@example.com', + 'data' => serialize(array()), + 'timezone_name' => NULL, + 'timezone_id' => 0, + 'pass_plain' => 'joe.bloggs_pass', + 'expected_timezone' => NULL, + ), + ), + 'users_roles' => array( + array('uid' => 2, 'rid' => 3), + array('uid' => 8, 'rid' => 4), + array('uid' => 8, 'rid' => 5), + array('uid' => 15, 'rid' => 3), + array('uid' => 15, 'rid' => 4), + array('uid' => 15, 'rid' => 5), + ), + 'event_timezones' => array( + array( + 'timezone' => 1, + 'name' => 'Europe/Berlin', + ) + ), + 'profile_values' => array( + array('fid' => 8, 'uid' => 2, 'value' => 'red'), + array('fid' => 9, 'uid' => 2, 'value' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam nulla sapien, congue nec risus ut, adipiscing aliquet felis. Maecenas quis justo vel nulla varius euismod. Quisque metus metus, cursus sit amet sem non, bibendum vehicula elit. Cras dui nisl, eleifend at iaculis vitae, lacinia ut felis. Nullam aliquam ligula volutpat nulla consectetur accumsan. Maecenas tincidunt molestie diam, a accumsan enim fringilla sit amet. Morbi a tincidunt tellus. Donec imperdiet scelerisque porta. Sed quis sem bibendum eros congue sodales. Vivamus vel fermentum est, at rutrum orci. Nunc consectetur purus ut dolor pulvinar, ut volutpat felis congue. Cras tincidunt odio sed neque sollicitudin, vehicula tempor metus scelerisque.'), + array('fid' => 10, 'uid' => 2, 'value' => '1'), + array('fid' => 11, 'uid' => 2, 'value' => 'Fitness spammers'), + array('fid' => 12, 'uid' => 2, 'value' => "AC/DC\nEagles"), + array('fid' => 13, 'uid' => 2, 'value' => "http://example.com/blog"), + array('fid' => 14, 'uid' => 2, 'value' => 'a:3:{s:5:"month";s:1:"6";s:3:"day";s:1:"2";s:4:"year";s:4:"1974";}'), + array('fid' => 8, 'uid' => 8, 'value' => 'brown'), + array('fid' => 9, 'uid' => 8, 'value' => 'Nunc condimentum ligula felis, eget lacinia purus accumsan at. Pellentesque eu lobortis felis. Duis at accumsan nisl, vel pulvinar risus. Nullam venenatis, tellus non eleifend hendrerit, augue nulla rhoncus leo, eget convallis enim sem ut velit. Mauris tincidunt enim ut eros volutpat dapibus. Curabitur augue libero, imperdiet eget orci sed, malesuada dapibus tellus. Nam lacus sapien, convallis vitae quam vel, bibendum commodo odio.'), + array('fid' => 10, 'uid' => 8, 'value' => '0'), + array('fid' => 11, 'uid' => 8, 'value' => ''), + array('fid' => 12, 'uid' => 8, 'value' => "Deep Purple\nWho\nThe Beatles"), + array('fid' => 13, 'uid' => 8, 'value' => "http://blog.example.com"), + array('fid' => 14, 'uid' => 8, 'value' => 'a:3:{s:5:"month";s:1:"9";s:3:"day";s:1:"9";s:4:"year";s:4:"1980";}'), + array('fid' => 8, 'uid' => 15, 'value' => 'orange'), + array('fid' => 9, 'uid' => 15, 'value' => 'Donec a diam volutpat augue fringilla fringilla. Mauris ultricies turpis ut lacus tempus, vitae pharetra lacus mattis. Nulla semper dui euismod sem bibendum, in eleifend nisi malesuada. Vivamus orci mauris, volutpat vitae enim ac, aliquam tempus lectus.'), + array('fid' => 10, 'uid' => 15, 'value' => '1'), + array('fid' => 11, 'uid' => 15, 'value' => 'Pill spammers'), + array('fid' => 12, 'uid' => 15, 'value' => "ABBA\nBoney M"), + array('fid' => 13, 'uid' => 15, 'value' => "http://example.com/journal"), + array('fid' => 14, 'uid' => 15, 'value' => 'a:3:{s:5:"month";s:2:"11";s:3:"day";s:2:"25";s:4:"year";s:4:"1982";}'), + ), + ); + + return isset($data[$table]) ? $data[$table] : FALSE; + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserProfileFields.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserProfileFields.php new file mode 100644 index 0000000..3d3d017 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserProfileFields.php @@ -0,0 +1,245 @@ +createTable('profile_fields', array( + 'fields' => array( + 'fid' => array( + 'type' => 'serial', + 'not null' => TRUE, + ), + 'title' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => FALSE, + ), + 'name' => array( + 'type' => 'varchar', + 'length' => 128, + 'not null' => TRUE, + 'default' => '', + ), + 'explanation' => array( + 'type' => 'text', + 'not null' => FALSE, + ), + 'category' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => FALSE, + ), + 'page' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => FALSE, + ), + 'type' => array( + 'type' => 'varchar', + 'length' => 128, + 'not null' => FALSE, + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'required' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'register' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'visibility' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'autocomplete' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'options' => array( + 'type' => 'text', + 'not null' => FALSE, + ), + ), + 'indexes' => array( + 'category' => array( + 'category', + ), + ), + 'unique keys' => array( + 'name' => array( + 'name', + ), + ), + 'primary key' => array( + 'fid', + ), + 'module' => 'profile', + 'name' => 'profile_fields', + )); + + // Insert data. + $data = static::getData('profile_fields'); + if ($data) { + $query = $this->database->insert('profile_fields')->fields(array_keys($data[0])); + foreach ($data as $record) { + $query->values($record); + } + $query->execute(); + } + $this->setModuleVersion('profile', 6001); + } + + /** + * Returns dump data from a specific table. + * + * @param string $table + * The table name. + * + * @return array + * Array of associative arrays each one having fields as keys. + */ + public static function getData($table) { + $data = array( + 'profile_fields' => array( + array( + 'fid' => '8', + 'title' => 'Favorite color', + 'name' => 'profile_color', + 'explanation' => 'List your favorite color', + 'category' => 'Personal information', + 'page' => 'Peole whose favorite color is %value', + 'type' => 'textfield', + 'weight' => '-10', + 'required' => '0', + 'register' => '1', + 'visibility' => '2', + 'autocomplete' => '1', + 'options' => '', + ), + array( + 'fid' => '9', + 'title' => 'Biography', + 'name' => 'profile_biography', + 'explanation' => 'Tell people a little bit about yourself', + 'category' => 'Personal information', + 'page' => '', + 'type' => 'textarea', + 'weight' => '-8', + 'required' => '0', + 'register' => '0', + 'visibility' => '2', + 'autocomplete' => '0', + 'options' => '', + ), + array( + 'fid' => '10', + 'title' => 'Sell your e-mail address?', + 'name' => 'profile_sell_address', + 'explanation' => "If you check this box, we'll sell your address to spammers to help line the pockets of our shareholders. Thanks!", + 'category' => 'Communication preferences', + 'page' => 'People who want us to sell their address', + 'type' => 'checkbox', + 'weight' => '-10', + 'required' => '0', + 'register' => '1', + 'visibility' => '1', + 'autocomplete' => '0', + 'options' => '', + ), + array( + 'fid' => '11', + 'title' => 'Sales Category', + 'name' => 'profile_sold_to', + 'explanation' => "Select the sales categories to which this user's address was sold.", + 'category' => 'Administrative data', + 'page' => 'People whose address was sold to %value', + 'type' => 'selection', + 'weight' => '-10', + 'required' => '0', + 'register' => '0', + 'visibility' => '4', + 'autocomplete' => '0', + 'options' => "Pill spammers\r\nFitness spammers", + ), + array( + 'fid' => '12', + 'title' => 'Favorite bands', + 'name' => 'profile_bands', + 'explanation' => "Enter your favorite bands. When you've saved your profile, you'll be able to find other people with the same favorites.", + 'category' => 'Personal information', + 'page' => '', + 'type' => 'list', + 'weight' => '-6', + 'required' => '0', + 'register' => '1', + 'visibility' => '3', + 'autocomplete' => '1', + 'options' => '', + ), +/* + array( + 'fid' => '13', + 'title' => 'Your blog', + 'name' => 'profile_blog', + 'explanation' => 'Paste the full URL, including http://, of your personal blog.', + 'category' => 'Personal information', + 'page' => '', + 'type' => 'url', + 'weight' => '0', + 'required' => '0', + 'register' => '0', + 'visibility' => '2', + 'autocomplete' => '0', + 'options' => '', + ), +*/ + array( + 'fid' => '14', + 'title' => 'Birthdate', + 'name' => 'profile_birthdate', + 'explanation' => "Enter your birth date and we'll send you a coupon.", + 'category' => 'Personal information', + 'page' => '', + 'type' => 'date', + 'weight' => '4', + 'required' => '0', + 'register' => '0', + 'visibility' => '2', + 'autocomplete' => '0', + 'options' => '', + ), + ), + ); + + return isset($data[$table]) ? $data[$table] : FALSE; + } + +} + diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserRole.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserRole.php index 12283bb..4c91ed9 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserRole.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserRole.php @@ -2,10 +2,11 @@ /** * @file - * Contains \Drupal\migrate\Tests\Dump\Drupal6UserRole. + * Contains \Drupal\migrate_drupal\Tests\Dump\Drupal6UserRole. */ namespace Drupal\migrate_drupal\Tests\Dump; + /** * Database dump for testing user role migration. */ diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6VocabularyField.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6VocabularyField.php new file mode 100644 index 0000000..1330cb5 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6VocabularyField.php @@ -0,0 +1,173 @@ +createTable('vocabulary', array( + 'fields' => array( + 'vid' => array( + 'type' => 'serial', + 'unsigned' => TRUE, + 'not null' => TRUE, + ), + 'name' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'description' => array( + 'type' => 'text', + 'not null' => FALSE, + 'size' => 'big', + ), + 'help' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'relations' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'hierarchy' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'multiple' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'required' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'tags' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + 'module' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + ), + ), + 'primary key' => array( + 'vid', + ), + 'indexes' => array( + 'list' => array( + 'weight', + 'name', + ), + ), + 'module' => 'taxonomy', + 'name' => 'vocabulary', + )); + + $this->database->insert('vocabulary') + ->fields(array( + 'vid' => 4, + 'name' => 'Tags', + 'description' => 'Tags Vocabulary', + 'help' => '', + 'relations' => '1', + 'hierarchy' => '0', + 'multiple' => '0', + 'required' => '0', + 'tags' => '0', + 'module' => 'taxonomy', + 'weight' => '0', + )) + ->execute(); + + + $this->createTable('vocabulary_node_types', array( + 'description' => 'Stores which node types vocabularies may be used with.', + 'fields' => array( + 'vid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'Primary Key: the {vocabulary}.vid of the vocabulary.', + ), + 'type' => array( + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + 'description' => 'The {node}.type of the node type for which the vocabulary may be used.', + ), + ), + 'primary key' => array('type', 'vid'), + 'indexes' => array( + 'vid' => array('vid'), + ), + )); + + $this->database->insert('vocabulary_node_types')->fields(array( + 'vid', + 'type', + )) + ->values(array( + 'vid' => '1', + 'type' => 'story', + )) + ->values(array( + 'vid' => '2', + 'type' => 'story', + )) + ->values(array( + 'vid' => '3', + 'type' => 'story', + )) + ->values(array( + 'vid' => '4', + 'type' => 'article', + )) + ->values(array( + 'vid' => '4', + 'type' => 'page', + )) + ->execute(); + $this->setModuleVersion('taxonomy', 6001); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php new file mode 100644 index 0000000..a32d37b --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php @@ -0,0 +1,64 @@ + 'Migrate variables to aggregator_feed entities.', + 'description' => 'Upgrade variables to aggregator_feed entities', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + $migration = entity_load('migration', 'd6_aggregator_feed'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorFeed.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + /** + * Tests migration of aggregator feeds. + */ + public function testAggregatorFeedImport() { + /** @var Feed $feed */ + $feed = entity_load('aggregator_feed', 5); + $this->assertNotNull($feed->uuid()); + $this->assertEqual($feed->title->value, 'Know Your Meme'); + $this->assertEqual($feed->language()->id, Language::LANGCODE_NOT_SPECIFIED); + $this->assertEqual($feed->url->value, 'http://knowyourmeme.com/newsfeed.rss'); + $this->assertEqual($feed->refresh->value, 900); + $this->assertEqual($feed->checked->value, 1387659487); + $this->assertEqual($feed->queued->value, 0); + $this->assertEqual($feed->link->value, 'http://knowyourmeme.com'); + $this->assertEqual($feed->description->value, 'New items added to the News Feed'); + $this->assertEqual($feed->image->value, 'http://b.thumbs.redditmedia.com/harEHsUUZVajabtC.png'); + $this->assertEqual($feed->hash->value, ''); + $this->assertEqual($feed->etag->value, '"213cc1365b96c310e92053c5551f0504"'); + $this->assertEqual($feed->modified->value, 0); + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php new file mode 100644 index 0000000..6668c53 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php @@ -0,0 +1,85 @@ + 'Migrate aggregator items', + 'description' => 'Upgrade aggregator items', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + // Add some id mappings for the dependant migrations. + $id_mappings = array( + 'd6_aggregator_feed' => array( + array(array(5), array(5)), + ), + ); + $this->prepareIdMappings($id_mappings); + + $entity = entity_create('aggregator_feed', array( + 'fid' => 5, + 'title' => 'Drupal Core', + 'url' => 'https://groups.drupal.org/not_used/167169', + 'refresh' => 900, + 'checked' => 1389919932, + 'description' => 'Drupal Core Group feed', + )); + $entity->enforceIsNew(); + $entity->save(); + /** @var \Drupal\migrate\entity\Migration $migration */ + $migration = entity_load('migration', 'd6_aggregator_item'); + $path = drupal_get_path('module', 'migrate_drupal'); + $dumps = array( + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorItem.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + /** + * Test Drupal 6 aggregator item migration to Drupal 8. + */ + public function testAggregatorItem() { + /** @var Item $item */ + $item = entity_load('aggregator_item', 1); + $this->assertEqual($item->id(), 1); + $this->assertEqual($item->getFeedId(), 5); + $this->assertEqual($item->label(), 'This (three) weeks in Drupal Core - January 10th 2014'); + $this->assertEqual($item->getAuthor(), 'larowlan'); + $this->assertEqual($item->getDescription(), "

What's new with Drupal 8?

"); + $this->assertEqual($item->getLink(), 'https://groups.drupal.org/node/395218'); + $this->assertEqual($item->getPostedTime(), 1389297196); + $this->assertEqual($item->language()->id, Language::LANGCODE_NOT_SPECIFIED); + $this->assertEqual($item->getGuid(), '395218 at https://groups.drupal.org'); + + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBlockTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBlockTest.php new file mode 100644 index 0000000..2bf15b2 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBlockTest.php @@ -0,0 +1,76 @@ + 'Migrate block settings to block.block.*.yml', + 'description' => 'Upgrade block settings to block.block.*.yml', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + $entities = array( + entity_create('menu', array('id' => 'primary-links')), + entity_create('menu', array('id' => 'secondary-links')), + entity_create('custom_block', array('id' => 1, 'type' => 'basic')), + ); + foreach ($entities as $entity) { + $entity->enforceIsNew(TRUE); + $entity->save(); + } + $this->prepareIdMappings(array('d6_custom_block' => array(array(array(1), array(1))))); + /** @var \Drupal\migrate\entity\Migration $migration */ + $migration = entity_load('migration', 'd6_block'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Block.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + /** + * Test the block settings migration. + */ + public function testBlockMigration() { + $blocks = entity_load_multiple('block'); + $this->assertTrue(count($blocks)); + // @TODO add more asserts. + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookTest.php new file mode 100644 index 0000000..e9a9bfb --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBookTest.php @@ -0,0 +1,87 @@ + 'Migrate book', + 'description' => 'Upgrade book structure', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $id_mappings = array(); + for ($i = 4; $i <= 8; $i++) { + $entity = entity_create('node', array( + 'type' => 'story', + 'nid' => $i, + )); + $entity->enforceIsNew(); + $entity->save(); + $id_mappings['d6_node'][] = array(array($i), array($i)); + } + $this->prepareIdMappings($id_mappings); + // Load database dumps to provide source data. + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Book.php', + ); + $this->loadDumps($dumps); + // Migrate books.. + $migration = entity_load('migration', 'd6_book'); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + /** + * Tests the Drupal 6 book structure to Drupal 8 migration. + */ + public function testBook() { + $nodes = node_load_multiple(array(4, 5, 6, 7, 8)); + $this->assertEqual($nodes[4]->book['bid'], 4); + $this->assertEqual($nodes[4]->book['pid'], 0); + + $this->assertEqual($nodes[5]->book['bid'], 4); + $this->assertEqual($nodes[5]->book['pid'], 4); + + $this->assertEqual($nodes[6]->book['bid'], 4); + $this->assertEqual($nodes[6]->book['pid'], 5); + + $this->assertEqual($nodes[7]->book['bid'], 4); + $this->assertEqual($nodes[7]->book['pid'], 5); + + $this->assertEqual($nodes[8]->book['bid'], 8); + $this->assertEqual($nodes[8]->book['pid'], 0); + + $tree = \Drupal::service('book.manager')->bookTreeAllData(4); + $this->assertEqual($tree['49990 4']['link']['nid'], 4); + $this->assertEqual($tree['49990 4']['below']['50000 5']['link']['nid'], 5); + $this->assertEqual($tree['49990 4']['below']['50000 5']['below']['50000 6']['link']['nid'], 6); + $this->assertEqual($tree['49990 4']['below']['50000 5']['below']['50000 7']['link']['nid'], 7); + $this->assertIdentical($tree['49990 4']['below']['50000 5']['below']['50000 6']['below'], array()); + $this->assertIdentical($tree['49990 4']['below']['50000 5']['below']['50000 7']['below'], array()); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCckFieldRevisionTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCckFieldRevisionTest.php new file mode 100644 index 0000000..d18077b --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCckFieldRevisionTest.php @@ -0,0 +1,98 @@ + 'Migrate CCK field revisions', + 'description' => 'CCK field revision migration', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + entity_create('field_config', array( + 'entity_type' => 'node', + 'name' => 'field_test', + 'type' => 'text', + ))->save(); + entity_create('field_instance_config', array( + 'entity_type' => 'node', + 'field_name' => 'field_test', + 'bundle' => 'story', + ))->save(); + entity_create('field_config', array( + 'entity_type' => 'node', + 'name' => 'field_test_two', + 'type' => 'integer', + 'cardinality' => -1, + ))->save(); + entity_create('field_instance_config', array( + 'entity_type' => 'node', + 'field_name' => 'field_test_two', + 'bundle' => 'story', + ))->save(); + + // Add some id mappings for the dependant migrations. + $id_mappings = array( + 'd6_cck_field_values' => array( + array(array(1), array(1)), + ), + 'd6_node' => array( + array(array(1), array(1)), + array(array(2), array(2)), + ), + 'd6_node_revision' => array( + array(array(1), array(1)), + ), + ); + $this->prepareIdMappings($id_mappings); + $path = drupal_get_path('module', 'migrate_drupal'); + $dumps = array( + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeRevision.php', + ); + $this->loadDumps($dumps); + + $migrations = entity_load_multiple('migration', array('d6_cck_field_revision:*')); + foreach ($migrations as $migration) { + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + } + + /** + * Test CCK revision migration from Drupal 6 to 8. + */ + public function testCckFieldRevision() { + $node = \Drupal::entityManager()->getStorage('node')->loadRevision(2); + $this->assertEqual($node->id(), 1, 'Node 1 loaded.'); + $this->assertEqual($node->getRevisionId(), 2, 'Node 1 revision 2loaded.'); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCckFieldValuesTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCckFieldValuesTest.php new file mode 100644 index 0000000..e9498ba --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCckFieldValuesTest.php @@ -0,0 +1,95 @@ + 'Migrate CCK fields', + 'description' => 'CCK field content migration', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + entity_create('field_config', array( + 'entity_type' => 'node', + 'name' => 'field_test', + 'type' => 'text', + ))->save(); + entity_create('field_instance_config', array( + 'entity_type' => 'node', + 'field_name' => 'field_test', + 'bundle' => 'story', + ))->save(); + entity_create('field_config', array( + 'entity_type' => 'node', + 'name' => 'field_test_two', + 'type' => 'integer', + 'cardinality' => -1, + ))->save(); + entity_create('field_instance_config', array( + 'entity_type' => 'node', + 'field_name' => 'field_test_two', + 'bundle' => 'story', + ))->save(); + + // Add some id mappings for the dependant migrations. + $id_mappings = array( + 'd6_field_formatter_settings' => array( + array(array('page', 'default', 'node', 'field_test'), array('node', 'page', 'default', 'field_test')), + ), + 'd6_field_instance_widget_settings' => array( + array(array('page', 'field_test'), array('node', 'page', 'default', 'test')), + ), + 'd6_node' => array( + array(array(1), array(1)), + array(array(2), array(2)), + ), + ); + $this->prepareIdMappings($id_mappings); + + $migrations = entity_load_multiple('migration', array('d6_cck_field_values:*')); + foreach ($migrations as $migration) { + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + } + + /** + * Test CCK migration from Drupal 6 to 8. + */ + public function testCckFields() { + $node = node_load(1); + $this->assertEqual($node->field_test->value, 'This is a text field', "Single field storage field is correct."); + $this->assertEqual($node->field_test_two->value, 10, 'Multi field storage field is correct'); + $this->assertEqual($node->field_test_two[1]->value, 20, 'Multi field second value is correct.'); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php new file mode 100644 index 0000000..06c1340 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php @@ -0,0 +1,89 @@ + 'Migrate comments.', + 'description' => 'Upgrade comments.', + 'group' => 'Migrate Drupal', + ); + } + + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + entity_create('node_type', array('type' => 'page'))->save(); + $node = entity_create('node', array( + 'type' => 'page', + 'nid' => 1, + )); + $node->enforceIsNew(); + $node->save(); + $id_mappings = array( + 'd6_filter_format' => array(array(array(1), array('filtered_html'))), + 'd6_node' => array(array(array(1), array(1))), + 'd6_user' => array(array(array(0), array(0))), + 'd6_comment_entity_display' => array(array(array('page'), array('node', 'page', 'default', 'comment'))), + 'd6_comment_entity_form_display' => array(array(array('page'), array('node', 'page', 'default', 'comment'))), + ); + $this->prepareIdMappings($id_mappings); + + \Drupal::service('comment.manager')->addDefaultField('node', 'page'); + /** @var \Drupal\migrate\entity\Migration $migration */ + $migration = entity_load('migration', 'd6_comment'); + + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Comment.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + /** + * Tests the Drupal 6 to Drupal 6 comment migration. + */ + public function testComments() { + /** @var Comment $comment */ + $comment = entity_load('comment', 1); + $this->assertEqual('The first comment.', $comment->subject->value); + $this->assertEqual('The first comment body.', $comment->comment_body->value); + $this->assertEqual('filtered_html', $comment->comment_body->format); + $this->assertEqual(0, $comment->pid->value); + $this->assertEqual(1, $comment->entity_id->value); + $this->assertEqual('node', $comment->entity_type->value); + $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $comment->language()->id); + + $comment = entity_load('comment', 2); + $this->assertEqual('The response to the second comment.', $comment->subject->value); + $this->assertEqual(3, $comment->pid->value); + + $comment = entity_load('comment', 3); + $this->assertEqual('The second comment.', $comment->subject->value); + $this->assertEqual(0, $comment->pid->value); + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableDisplayBase.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableDisplayBase.php new file mode 100644 index 0000000..787d09a --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableDisplayBase.php @@ -0,0 +1,86 @@ + 'node', + 'name' => 'comment', + 'type' => 'comment', + 'translatable' => '0', + ))->save(); + foreach ($this->types as $type) { + entity_create('node_type', array('type' => $type))->save(); + entity_create('field_instance_config', array( + 'label' => 'Comment settings', + 'description' => '', + 'field_name' => 'comment', + 'entity_type' => 'node', + 'bundle' => $type, + 'required' => 1, + ))->save(); + } + $this->dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6CommentVariable.php', + ); + $id_mappings = array( + 'd6_comment_field_instance' => array( + array(array('page'), array('node', 'comment', 'page')), + ), + ); + $this->prepareIdMappings($id_mappings); + /** @var \Drupal\migrate\entity\Migration $migration */ + $migration = entity_load('migration', static::MIGRATION); + $this->prepare($migration, $this->dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableEntityDisplay.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableEntityDisplay.php new file mode 100644 index 0000000..4d9ca86 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableEntityDisplay.php @@ -0,0 +1,47 @@ + 'Migrate comment variables to entity displays,', + 'description' => 'Upgrade comment variables to entity.display.node.*.default.yml', + 'group' => 'Migrate Drupal', + ); + } + + /** + * Tests comment variables migrated into an entity display. + */ + public function testCommentEntityDisplay() { + foreach ($this->types as $type) { + $component = entity_get_display('node', $type, 'default')->getComponent('comment'); + $this->assertEqual($component['label'], 'hidden'); + $this->assertEqual($component['type'], 'comment_default'); + $this->assertEqual($component['weight'], 20); + } + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableEntityFormDisplay.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableEntityFormDisplay.php new file mode 100644 index 0000000..c58d55b --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableEntityFormDisplay.php @@ -0,0 +1,42 @@ + 'Migrate comment variables to entity form displays,', + 'description' => 'Upgrade comment variables to entity.form_display.node.*.default.yml', + 'group' => 'Migrate Drupal', + ); + } + + /** + * Tests comment variables migrated into an entity display. + */ + public function testCommentEntityFormDisplay() { + foreach ($this->types as $type) { + $component = entity_get_form_display('node', $type, 'default')->getComponent('comment'); + $this->assertEqual($component['type'], 'comment_default'); + $this->assertEqual($component['weight'], 20); + } + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableField.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableField.php new file mode 100644 index 0000000..6c5d11d --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableField.php @@ -0,0 +1,56 @@ + 'Migrate comment variables to a field,', + 'description' => 'Upgrade comment variables to field.field.node.comment.yml', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + foreach (array('page', 'story', 'test') as $type) { + entity_create('node_type', array('type' => $type))->save(); + } + /** @var \Drupal\migrate\entity\Migration $migration */ + $migration = entity_load('migration', 'd6_comment_field'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6CommentVariable.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + /** + * Tests comment variables migrated into a field entity. + */ + public function testCommentField() { + $this->assertTrue(is_object(entity_load('field_config', 'node.comment'))); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableInstance.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableInstance.php new file mode 100644 index 0000000..0e37c12 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentVariableInstance.php @@ -0,0 +1,83 @@ + 'Migrate comment variables to a field instance,', + 'description' => 'Upgrade comment variables to field.instance.node.*.comment.yml', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + // Add some id mappings for the dependant migrations. + $id_mappings = array( + 'd6_comment_field' => array( + array(array('page'), array('node', 'page')), + ), + 'd6_node_type' => array( + array(array('page'), array('page')), + ), + ); + $this->prepareIdMappings($id_mappings); + + foreach (array('page', 'story') as $type) { + entity_create('node_type', array('type' => $type))->save(); + } + entity_create('field_config', array( + 'entity_type' => 'node', + 'name' => 'comment', + 'type' => 'comment', + 'translatable' => '0', + ))->save(); + /** @var \Drupal\migrate\entity\Migration $migration */ + $migration = entity_load('migration', 'd6_comment_field_instance'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6CommentVariable.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + /** + * Test the migrated field instance values. + */ + public function testCommentFieldInstance() { + $node = entity_create('node', array('type' => 'page')); + $this->assertEqual($node->comment->status, 0); + $node = entity_create('node', array('type' => 'story')); + $this->assertEqual($node->comment->status, 2); + $settings = $node->comment->getFieldDefinition()->getSettings(); + $this->assertEqual($settings['default_mode'], 2); + $this->assertEqual($settings['per_page'], 70); + $this->assertEqual($settings['anonymous'], 1); + $this->assertEqual($settings['subject'], 0); + $this->assertEqual($settings['form_location'], 0); + $this->assertEqual($settings['preview'], 0); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateContactCategoryTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateContactCategoryTest.php new file mode 100644 index 0000000..f46884c --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateContactCategoryTest.php @@ -0,0 +1,63 @@ + 'Migrate contact categories.', + 'description' => 'Migrate contact categories to contact.category.*.yml', + 'group' => 'Migrate Drupal', + ); + } + + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + $migration = entity_load('migration', 'd6_contact_category'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ContactCategory.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, new MigrateMessage()); + $executable->import(); + } + + /** + * The Drupal 6 contact categories to Drupal 8 migration. + */ + public function testContactCategory() { + /** @var \Drupal\contact\Entity\Category $contact_category */ + $contact_category = entity_load('contact_category', 'website_feedback'); + $this->assertEqual($contact_category->label, 'Website feedback'); + $this->assertEqual($contact_category->recipients, 'admin@example.com'); + $this->assertEqual($contact_category->reply, ''); + $this->assertEqual($contact_category->weight, 0); + } +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php new file mode 100644 index 0000000..7620793 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php @@ -0,0 +1,67 @@ + 'Migrate custom blocks.', + 'description' => 'Upgrade custom blocks.', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + $this->prepareIdMappings(array( + 'd6_filter_format' => array( + array(array(2), array('full_html')) + ) + )); + /** @var \Drupal\migrate\entity\Migration $migration */ + $migration = entity_load('migration', 'd6_custom_block'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Box.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + /** + * Tests the Drupal 6 custom block to Drupal 8 migration. + */ + public function testBlockMigration() { + /** @var CustomBlock $block */ + $block = entity_load('custom_block', 1); + $this->assertEqual('My block 1', $block->label()); + $this->assertEqual(1, $block->getRevisionId()); + $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time()); + $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $block->language()->id); + $this->assertEqual('

My custom block body

', $block->body->value); + $this->assertEqual('full_html', $block->body->format); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDateFormatTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDateFormatTest.php new file mode 100644 index 0000000..41e7cdc --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDateFormatTest.php @@ -0,0 +1,71 @@ + 'Migrate date formats to system.date_format.*.yml', + 'description' => 'Upgrade date formats to system.date_format.*.yml', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + /** @var \Drupal\migrate\entity\Migration $migration */ + $migration = entity_load('migration', 'd6_date_formats'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6DateFormat.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, new MigrateMessage()); + $executable->import(); + } + + /** + * Tests the Drupal 6 date formats to Drupal 8 migration. + */ + public function testDateFormats() { + $short_date_format = entity_load('date_format', 'short'); + $this->assertEqual('\S\H\O\R\T m/d/Y - H:i', $short_date_format->getPattern(DrupalDateTime::PHP)); + + $medium_date_format = entity_load('date_format', 'medium'); + $this->assertEqual('\M\E\D\I\U\M D, m/d/Y - H:i', $medium_date_format->getPattern(DrupalDateTime::PHP)); + + $long_date_format = entity_load('date_format', 'long'); + $this->assertEqual('\L\O\N\G l, F j, Y - H:i', $long_date_format->getPattern(DrupalDateTime::PHP)); + + // Test that we can re-import using the EntityDateFormat destination. + Database::getConnection('default', 'migrate') + ->update('variable') + ->fields(array('value' => serialize('\S\H\O\R\T d/m/Y - H:i'))) + ->condition('name', 'date_format_short') + ->execute(); + db_truncate(entity_load('migration', 'd6_date_formats')->getIdMap()->mapTableName())->execute(); + $migration = entity_load_unchanged('migration', 'd6_date_formats'); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + + $short_date_format = entity_load('date_format', 'short'); + $this->assertEqual('\S\H\O\R\T d/m/Y - H:i', $short_date_format->getPattern(DrupalDateTime::PHP)); + + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDrupal6Test.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDrupal6Test.php new file mode 100644 index 0000000..6b973c7 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateDrupal6Test.php @@ -0,0 +1,350 @@ + 'Migrate Drupal 6', + 'description' => 'Test every Drupal 6 migration', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + public function tearDown() { + // Move the results of every class under ours. This is solely for + // reporting, the filename will guide developers. + self::getDatabaseConnection() + ->update('simpletest') + ->fields(array('test_class' => get_class($this))) + ->condition('test_id', $this->testId) + ->execute(); + parent::tearDown(); + } + + + /** + * Test the complete Drupal 6 migration. + */ + public function testDrupal6() { + $path = drupal_get_path('module', 'migrate_drupal'); + $dumps = array( + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ActionSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorFeed.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorItem.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6AggregatorSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Block.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6BookSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Box.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Comment.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6CommentVariable.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ContactCategory.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ContactSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6DateFormat.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6DblogSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6File.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FileSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FilterFormat.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6ForumSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6LocaleSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Menu.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6MenuSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeBodyInstance.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Node.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeRevision.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6NodeType.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SearchPage.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SearchSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SimpletestSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6StatisticsSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SyslogSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemCron.php', + // This dump contains the file directory path to the simpletest directory + // where the files are. + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemFile.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemFilter.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemImageGd.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemImage.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemMaintenance.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemPerformance.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemRss.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemSite.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemTheme.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomySettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyTerm.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TaxonomyVocabulary.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TermNode.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6TextSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UpdateSettings.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UploadInstance.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Upload.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UrlAlias.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserMail.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6User.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserProfileFields.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6UserRole.php', + $path . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6VocabularyField.php', + ); + $this->loadDumps($dumps); + $migrations = array( + 'd6_action_settings', + 'd6_aggregator_settings', + 'd6_aggregator_feed', + 'd6_aggregator_item', + 'd6_block', + 'd6_book_settings', + 'd6_cck_field_values:*', + 'd6_cck_field_revision:*', + 'd6_comment', + 'd6_comment_entity_display', + 'd6_comment_entity_form_display', + 'd6_comment_field', + 'd6_comment_field_instance', + 'd6_contact_category', + 'd6_contact_settings', + 'd6_custom_block', + 'd6_date_formats', + 'd6_dblog_settings', + 'd6_field', + 'd6_field_instance', + 'd6_field_instance_widget_settings', + 'd6_field_settings', + 'd6_field_formatter_settings', + 'd6_file_settings', + 'd6_file', + 'd6_filter_format', + 'd6_forum_settings', + 'd6_locale_settings', + 'd6_menu_settings', + 'd6_menu', + 'd6_node_revision', + 'd6_node', + 'd6_node_settings', + 'd6_node_type', + 'd6_profile_values:user', + 'd6_search_page', + 'd6_search_settings', + 'd6_simpletest_settings', + 'd6_statistics_settings', + 'd6_syslog_settings', + 'd6_system_cron', + 'd6_system_file', + 'd6_system_filter', + 'd6_system_image', + 'd6_system_image_gd', + 'd6_system_maintenance', + 'd6_system_performance', + 'd6_system_rss', + 'd6_system_site', + 'd6_system_theme', + 'd6_taxonomy_settings', + 'd6_taxonomy_term', + 'd6_taxonomy_vocabulary', + 'd6_term_node_revision:*', + 'd6_term_node:*', + 'd6_text_settings', + 'd6_update_settings', + 'd6_upload_entity_display', + 'd6_upload_entity_form_display', + 'd6_upload_field', + 'd6_upload_field_instance', + 'd6_upload', + 'd6_url_alias', + 'd6_user_mail', + 'd6_user_profile_field_instance', + 'd6_user_profile_entity_display', + 'd6_user_profile_entity_form_display', + 'd6_user_profile_field', + 'd6_user_picture_entity_display', + 'd6_user_picture_entity_form_display', + 'd6_user_picture_field_instance', + 'd6_user_picture_field', + 'd6_user_picture_file', + 'd6_user_role', + 'd6_user', + 'd6_view_modes', + 'd6_vocabulary_entity_display', + 'd6_vocabulary_entity_form_display', + 'd6_vocabulary_field_instance', + 'd6_vocabulary_field', + ); + $classes = array( + __NAMESPACE__ . '\MigrateActionConfigsTest', + __NAMESPACE__ . '\MigrateAggregatorConfigsTest', + __NAMESPACE__ . '\MigrateAggregatorFeedTest', + __NAMESPACE__ . '\MigrateAggregatorItemTest', + __NAMESPACE__ . '\MigrateBlockTest', + __NAMESPACE__ . '\MigrateBookConfigsTest', + __NAMESPACE__ . '\MigrateCckFieldValuesTest', + __NAMESPACE__ . '\MigrateCckFieldRevisionTest', + __NAMESPACE__ . '\MigrateCommentTest', + __NAMESPACE__ . '\MigrateCommentVariableEntityDisplay', + __NAMESPACE__ . '\MigrateCommentVariableEntityFormDisplay', + __NAMESPACE__ . '\MigrateCommentVariableField', + __NAMESPACE__ . '\MigrateCommentVariableInstance', + __NAMESPACE__ . '\MigrateContactCategoryTest', + __NAMESPACE__ . '\MigrateContactConfigsTest', + __NAMESPACE__ . '\MigrateCustomBlockTest', + __NAMESPACE__ . '\MigrateDateFormatTest', + __NAMESPACE__ . '\MigrateDblogConfigsTest', + __NAMESPACE__ . '\MigrateFieldConfigsTest', + __NAMESPACE__ . '\MigrateFieldTest', + __NAMESPACE__ . '\MigrateFieldInstanceTest', + __NAMESPACE__ . '\MigrateFieldFormatterSettingsTest', + __NAMESPACE__ . '\MigrateFieldWidgetSettingsTest', + __NAMESPACE__ . '\MigrateFileConfigsTest', + __NAMESPACE__ . '\MigrateFileTest', + __NAMESPACE__ . '\MigrateFilterFormatTest', + __NAMESPACE__ . '\MigrateForumConfigsTest', + __NAMESPACE__ . '\MigrateLocaleConfigsTest', + __NAMESPACE__ . '\MigrateMenuConfigsTest', + __NAMESPACE__ . '\MigrateMenuTest', + __NAMESPACE__ . '\MigrateNodeConfigsTest', + __NAMESPACE__ . '\MigrateNodeRevisionTest', + __NAMESPACE__ . '\MigrateNodeTest', + __NAMESPACE__ . '\MigrateNodeTypeTest', + __NAMESPACE__ . '\MigrateProfileValuesTest', + __NAMESPACE__ . '\MigrateSearchConfigsTest', + __NAMESPACE__ . '\MigrateSearchPageTest', + __NAMESPACE__ . '\MigrateSimpletestConfigsTest', + __NAMESPACE__ . '\MigrateStatisticsConfigsTest', + __NAMESPACE__ . '\MigrateSyslogConfigsTest', + __NAMESPACE__ . '\MigrateSystemCronTest', + __NAMESPACE__ . '\MigrateSystemFileTest', + __NAMESPACE__ . '\MigrateSystemFilterTest', + __NAMESPACE__ . '\MigrateSystemImageGdTest', + __NAMESPACE__ . '\MigrateSystemImageTest', + __NAMESPACE__ . '\MigrateSystemMaintenanceTest', + __NAMESPACE__ . '\MigrateSystemPerformanceTest', + __NAMESPACE__ . '\MigrateSystemRssTest', + __NAMESPACE__ . '\MigrateSystemSiteTest', + __NAMESPACE__ . '\MigrateSystemThemeTest', + __NAMESPACE__ . '\MigrateTaxonomyConfigsTest', + __NAMESPACE__ . '\MigrateTaxonomyTermTest', + __NAMESPACE__ . '\MigrateTaxonomyVocabularyTest', + __NAMESPACE__ . '\MigrateTermNodeRevisionTest', + __NAMESPACE__ . '\MigrateTermNodeTest', + __NAMESPACE__ . '\MigrateTextConfigsTest', + __NAMESPACE__ . '\MigrateUpdateConfigsTest', + __NAMESPACE__ . '\MigrateUploadEntityDisplayTest', + __NAMESPACE__ . '\MigrateUploadEntityFormDisplayTest', + __NAMESPACE__ . '\MigrateUploadFieldTest', + __NAMESPACE__ . '\MigrateUploadInstanceTest', + __NAMESPACE__ . '\MigrateUploadTest', + __NAMESPACE__ . '\MigrateUrlAliasTest', + __NAMESPACE__ . '\MigrateUserConfigsTest', + __NAMESPACE__ . '\MigrateUserProfileEntityDisplayTest', + __NAMESPACE__ . '\MigrateUserProfileEntityFormDisplayTest', + __NAMESPACE__ . '\MigrateUserProfileFieldTest', + __NAMESPACE__ . '\MigrateUserProfileFieldInstanceTest', + __NAMESPACE__ . '\MigrateUserPictureEntityDisplayTest', + __NAMESPACE__ . '\MigrateUserPictureEntityFormDisplayTest', + __NAMESPACE__ . '\MigrateUserPictureFileTest', + __NAMESPACE__ . '\MigrateUserPictureFieldTest', + __NAMESPACE__ . '\MigrateUserPictureInstanceTest', + __NAMESPACE__ . '\MigrateUserRoleTest', + __NAMESPACE__ . '\MigrateUserTest', + __NAMESPACE__ . '\MigrateViewModesTest', + __NAMESPACE__ . '\MigrateVocabularyEntityDisplayTest', + __NAMESPACE__ . '\MigrateVocabularyEntityFormDisplayTest', + __NAMESPACE__ . '\MigrateVocabularyFieldInstanceTest', + __NAMESPACE__ . '\MigrateVocabularyFieldTest', + ); + // Run every migration in the order specified by the storage controller. + foreach (entity_load_multiple('migration', $migrations) as $migration) { + (new MigrateExecutable($migration, $this))->import(); + } + foreach ($classes as $class) { + $test_object = new $class($this->testId); + $test_object->databasePrefix = $this->databasePrefix; + $test_object->container = $this->container; + // run() does a lot of setup and tear down work which we don't need: + // it would setup a new database connection and wouldn't find the + // Drupal 6 dump. Also by skipping the setUp() methods there are no id + // mappings or entities prepared. The tests run against solely migrated + // data. + foreach (get_class_methods($test_object) as $method) { + if (strtolower(substr($method, 0, 4)) == 'test') { + // Insert a fail record. This will be deleted on completion to ensure + // that testing completed. + $method_info = new \ReflectionMethod($class, $method); + $caller = array( + 'file' => $method_info->getFileName(), + 'line' => $method_info->getStartLine(), + 'function' => $class . '->' . $method . '()', + ); + $completion_check_id = TestBase::insertAssert($this->testId, $class, FALSE, 'The test did not complete due to a fatal error.', 'Completion check', $caller); + // Run the test method. + try { + $test_object->$method(); + } + catch (\Exception $e) { + $this->exceptionHandler($e); + } + // Remove the completion check record. + TestBase::deleteAssert($completion_check_id); + } + } + // Add the pass/fail/exception/debug results. + foreach ($this->results as $key => &$value) { + $value += $test_object->results[$key]; + } + } + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldFormatterSettingsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldFormatterSettingsTest.php new file mode 100644 index 0000000..2cbc837 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldFormatterSettingsTest.php @@ -0,0 +1,235 @@ + 'Migrate field formatter settings to entity.display.*.*.yml', + 'description' => 'Upgrade field formatter settings to entity.display.*.*.yml', + 'group' => 'Migrate Drupal', + ); + } + + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + + entity_create('node_type', array('type' => 'article'))->save(); + entity_create('node_type', array('type' => 'story'))->save(); + // Create the node preview view mode. + entity_create('view_mode', array('id' => 'node.preview', 'targetEntityType' => 'node'))->save(); + + // Add some id mappings for the dependant migrations. + $id_mappings = array( + 'd6_view_modes' => array( + array(array(1), array('node', 'preview')), + array(array(4), array('node', 'rss')), + array(array('teaser'), array('node', 'teaser')), + array(array('full'), array('node', 'full')), + ), + 'd6_field_instance' => array( + array(array('fieldname', 'page'), array('node', 'fieldname', 'page')), + ), + 'd6_field' => array( + array(array('field_test'), array('node', 'field_test')), + array(array('field_test_two'), array('node', 'field_test_two')), + array(array('field_test_three'), array('node', 'field_test_three')), + array(array('field_test_email'), array('node', 'field_test_email')), + array(array('field_test_link'), array('node', 'field_test_link')), + array(array('field_test_filefield'), array('node', 'field_test_filefield')), + array(array('field_test_imagefield'), array('node', 'field_test_imagefield')), + array(array('field_test_phone'), array('node', 'field_test_phone')), + array(array('field_test_date'), array('node', 'field_test_date')), + array(array('field_test_datestamp'), array('node', 'field_test_datestamp')), + array(array('field_test_datetime'), array('node', 'field_test_datetime')), + ), + ); + $this->prepareIdMappings($id_mappings); + + $migration = entity_load('migration', 'd6_field_formatter_settings'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + /** + * Test that migrated entity display settings can be loaded using D8 API's. + */ + public function testEntityDisplaySettings() { + // Run tests. + $field_name = "field_test"; + $expected = array( + 'weight' => 1, + 'label' => 'above', + 'type' => 'text_trimmed', + 'settings' => array('trim_length' => 600), + ); + + // Make sure we don't have the excluded print entity display. + $display = entity_load('entity_view_display', 'node.story.print'); + $this->assertNull($display, "Print entity display not found."); + // Can we load any entity display. + $display = entity_load('entity_view_display', 'node.story.teaser'); + $this->assertEqual($display->getComponent($field_name), $expected); + + // Test migrate worked with multiple bundles. + $display = entity_load('entity_view_display', 'node.article.teaser'); + $this->assertEqual($display->getComponent($field_name), $expected); + + // Test RSS because that has been converted from 4 to rss. + $display = entity_load('entity_view_display', 'node.story.rss'); + $this->assertEqual($display->getComponent($field_name), $expected); + + // Test the full format with text_default which comes from a static map. + $expected['type'] = 'text_default'; + $expected['settings'] = array(); + $display = entity_load('entity_view_display', 'node.story.full'); + $this->assertEqual($display->getComponent($field_name), $expected); + + // Check that we can migrate multiple fields. + $content = $display->get('content'); + $this->assertTrue(isset($content['field_test']), 'Settings for field_test exist.'); + $this->assertTrue(isset($content['field_test_two']), "Settings for field_test_two exist."); + + // Test the number field formatter settings are correct. + $expected['weight'] = 2; + $expected['type'] = 'number_integer'; + $expected['settings'] = array( + 'scale' => 0, + 'decimal_separator' => '.', + 'thousand_separator' => ',', + 'prefix_suffix' => TRUE, + ); + $component = $display->getComponent('field_test_two'); + $this->assertEqual($component, $expected); + $expected['weight'] = 3; + $expected['type'] = 'number_decimal'; + $expected['settings']['scale'] = 2; + $component = $display->getComponent('field_test_three'); + $this->assertEqual($component, $expected); + + // Test the email field formatter settings are correct. + $expected['weight'] = 4; + $expected['type'] = 'email_mailto'; + $expected['settings'] = array(); + $component = $display->getComponent('field_test_email'); + $this->assertEqual($component, $expected); + + // Test the link field formatter settings. + $expected['weight'] = 5; + $expected['type'] = 'link'; + $expected['settings'] = array( + 'trim_length' => 80, + 'url_only' => 1, + 'url_plain' => 1, + 'rel' => 0, + 'target' => 0, + ); + $component = $display->getComponent('field_test_link'); + $this->assertEqual($component, $expected, "node.story.full field_test_link has correct absolute link settings."); + $expected['settings']['url_only'] = 0; + $expected['settings']['url_plain'] = 0; + $display = entity_load('entity_view_display', 'node.story.teaser'); + $component = $display->getComponent('field_test_link'); + $this->assertEqual($component, $expected, "node.story.teaser field_test_link has correct default link settings."); + + // Test the file field formatter settings. + $expected['weight'] = 7; + $expected['type'] = 'file_default'; + $expected['settings'] = array(); + $component = $display->getComponent('field_test_filefield'); + $this->assertEqual($component, $expected, "node.story.teaser field_test_filefield is of type file_default."); + $display = entity_load('entity_view_display', 'node.story.full'); + $expected['type'] = 'file_url_plain'; + $component = $display->getComponent('field_test_filefield'); + $this->assertEqual($component, $expected, "node.story.full field_test_filefield is of type file_url_plain."); + + // Test the image field formatter settings. + $expected['weight'] = 8; + $expected['type'] = 'image'; + $expected['settings'] = array('image_style' => '', 'image_link' => ''); + $component = $display->getComponent('field_test_imagefield'); + $this->assertEqual($component, $expected, "node.story.full field_test_imagefield is of type image with the correct settings."); + $display = entity_load('entity_view_display', 'node.story.teaser'); + $expected['settings']['image_link'] = 'file'; + $component = $display->getComponent('field_test_imagefield'); + $this->assertEqual($component, $expected, "node.story.teaser field_test_imagefield is of type image with the correct settings."); + + // Test phone field. + $expected['weight'] = 9; + $expected['type'] = 'string'; + $expected['settings'] = array(); + $component = $display->getComponent('field_test_phone'); + $this->assertEqual($component, $expected, "node.story.teaser field_test_phone is of type telephone."); + + // Test date field. + $expected['weight'] = 10; + $expected['type'] = 'datetime_default'; + $expected['settings'] = array('format_type' => 'fallback'); + $component = $display->getComponent('field_test_date'); + $this->assertEqual($component, $expected); + $display = entity_load('entity_view_display', 'node.story.full'); + $expected['settings']['format_type'] = 'long'; + $component = $display->getComponent('field_test_date'); + $this->assertEqual($component, $expected); + + // Test date stamp field. + $expected['weight'] = 11; + $expected['settings']['format_type'] = 'fallback'; + $component = $display->getComponent('field_test_datestamp'); + $this->assertEqual($component, $expected); + $display = entity_load('entity_view_display', 'node.story.teaser'); + $expected['settings'] = array('format_type' => 'medium'); + $component = $display->getComponent('field_test_datestamp'); + $this->assertEqual($component, $expected); + + // Test datetime field. + $expected['weight'] = 12; + $expected['settings'] = array('format_type' => 'short'); + $component = $display->getComponent('field_test_datetime'); + $this->assertEqual($component, $expected); + $display = entity_load('entity_view_display', 'node.story.full'); + $expected['settings']['format_type'] = 'fallback'; + $component = $display->getComponent('field_test_datetime'); + $this->assertEqual($component, $expected); + + // Test a date field with a random format which should be mapped + // to datetime_default. + $display = entity_load('entity_view_display', 'node.story.rss'); + $expected['settings']['format_type'] = 'fallback'; + $component = $display->getComponent('field_test_datetime'); + $this->assertEqual($component, $expected); + // Test that our Id map has the correct data. + $this->assertEqual(array('node', 'story', 'teaser', 'field_test'), entity_load('migration', 'd6_field_formatter_settings')->getIdMap()->lookupDestinationID(array('story', 'teaser', 'node', 'field_test'))); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldInstanceTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldInstanceTest.php new file mode 100644 index 0000000..5c3da6e --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldInstanceTest.php @@ -0,0 +1,173 @@ + 'Migrate field instances to field.instance.*.*.*.yml', + 'description' => 'Migrate field instances.', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + // Add some id mappings for the dependant migrations. + $id_mappings = array( + 'd6_field' => array( + array(array('field_test'), array('node', 'field_test')), + array(array('field_test_two'), array('node', 'field_test_two')), + array(array('field_test_three'), array('node', 'field_test_three')), + array(array('field_test_email'), array('node', 'field_test_email')), + array(array('field_test_link'), array('node', 'field_test_link')), + array(array('field_test_filefield'), array('node', 'field_test_filefield')), + array(array('field_test_imagefield'), array('node', 'field_test_imagefield')), + array(array('field_test_phone'), array('node', 'field_test_phone')), + array(array('field_test_date'), array('node', 'field_test_date')), + array(array('field_test_datestamp'), array('node', 'field_test_datestamp')), + array(array('field_test_datetime'), array('node', 'field_test_datetime')), + ), + 'd6_node_type' => array( + array(array('page'), array('page')), + array(array('story'), array('story')), + array(array('article'), array('article')), + ), + ); + $this->prepareIdMappings($id_mappings); + entity_create('node_type', array('type' => 'page'))->save(); + entity_create('node_type', array('type' => 'story'))->save(); + entity_create('node_type', array('type' => 'article'))->save(); + + $migration = entity_load('migration', 'd6_field_instance'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php', + ); + $this->createFields(); + + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + + } + + /* + * Tests migration of file variables to file.settings.yml. + */ + public function testFieldInstanceSettings() { + $entity = entity_create('node', array('type' => 'story')); + // Test a text field. + $field = entity_load('field_instance_config', 'node.story.field_test'); + $this->assertEqual($field->label(), 'Text Field'); + $expected = array('max_length' => 255, 'text_processing' => 1); + $this->assertEqual($field->getSettings(), $expected); + $this->assertEqual('text for default value', $entity->field_test->value); + + // Test a number field. + $field = entity_load('field_instance_config', 'node.story.field_test_two'); + $this->assertEqual($field->label(), 'Integer Field'); + $expected = array( + 'min' => '10', + 'max' => '100', + 'prefix' => 'pref', + 'suffix' => 'suf', + 'unsigned' => '', + ); + $this->assertEqual($field->getSettings(), $expected); + + // Test email field. + $field = entity_load('field_instance_config', 'node.story.field_test_email'); + $this->assertEqual($field->label(), 'Email Field'); + $this->assertEqual('benjy@example.com', $entity->field_test_email->value, 'Field field_test_email default_value is correct.'); + + // Test a filefield. + $field = entity_load('field_instance_config', 'node.story.field_test_filefield'); + $this->assertEqual($field->label(), 'File Field'); + $expected = array( + 'file_extensions' => 'txt pdf doc', + 'file_directory' => 'images', + 'description_field' => TRUE, + 'max_filesize' => '200KB', + 'target_type' => 'file', + 'display_field' => FALSE, + 'display_default' => FALSE, + 'uri_scheme' => 'public', + 'handler' => 'default', + 'target_bundle' => NULL, + ); + // This is the only way to compare arrays. + $this->assertFalse(array_diff_assoc($field->getSettings(), $expected)); + $this->assertFalse(array_diff_assoc($expected, $field->getSettings())); + + // Test a link field. + $field = entity_load('field_instance_config', 'node.story.field_test_link'); + $this->assertEqual($field->label(), 'Link Field'); + $expected = array('title' => 2, 'link_type' => LinkItemInterface::LINK_GENERIC); + $this->assertEqual($field->getSettings(), $expected); + $this->assertEqual('default link title', $entity->field_test_link->title, 'Field field_test_link default title is correct.'); + $this->assertEqual('http://drupal.org', $entity->field_test_link->url, 'Field field_test_link default title is correct.'); + + } + + /** + * Helper to create fields. + */ + protected function createFields() { + $fields = array( + 'field_test' => 'text', + 'field_test_two' => 'integer', + 'field_test_three' => 'decimal', + 'field_test_email' => 'email', + 'field_test_link' => 'link', + 'field_test_filefield' => 'file', + 'field_test_imagefield' => 'image', + 'field_test_phone' => 'telephone', + 'field_test_date' => 'datetime', + 'field_test_datestamp' => 'datetime', + 'field_test_datetime' => 'datetime', + ); + foreach ($fields as $name => $type) { + entity_create('field_config', array( + 'name' => $name, + 'entity_type' => 'node', + 'type' => $type, + ))->save(); + } + + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldTest.php new file mode 100644 index 0000000..005ad53 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldTest.php @@ -0,0 +1,99 @@ + 'Migrate fields to field.*.*.yml', + 'description' => 'Migrate fields', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + /** @var \Drupal\migrate\entity\Migration $migration */ + $migration = entity_load('migration', 'd6_field'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + /** + * Tests the Drupal 6 field to Drupal 8 migration. + */ + public function testFields() { + // Text field. + $field = entity_load('field_config', 'node.field_test'); + $expected = array('max_length' => 255); + $this->assertEqual($field->type, "text", "Field type is text."); + $this->assertEqual($field->status, TRUE, "Status is TRUE"); + $this->assertEqual($field->settings, $expected, "Field type text settings are correct"); + + // Integer field. + $field = entity_load('field_config', 'node.field_test_two'); + $this->assertEqual($field->type, "integer", "Field type is integer."); + + // Float field. + $field = entity_load('field_config', 'node.field_test_three'); + $this->assertEqual($field->type, "decimal", "Field type is decimal."); + + // Link field. + $field = entity_load('field_config', 'node.field_test_link'); + $this->assertEqual($field->type, "link", "Field type is link."); + + // File field. + $field = entity_load('field_config', 'node.field_test_filefield'); + $this->assertEqual($field->type, "file", "Field type is file."); + + /** @var \Drupal\field\Entity\FieldConfig $field */ + $field = entity_load('field_config', 'node.field_test_imagefield'); + $this->assertEqual($field->type, "image", "Field type is image."); + $settings = $field->getSettings(); + $this->assertEqual($settings['column_groups']['alt']['label'], 'Test alt'); + $this->assertEqual($settings['column_groups']['title']['label'], 'Test title'); + $this->assertEqual($settings['target_type'], 'file'); + $this->assertEqual($settings['uri_scheme'], 'public'); + $this->assertEqual($settings['default_image']['fid'], ''); + $this->assertEqual(array_filter($settings['default_image']), array()); + + // Phone field. + $field = entity_load('field_config', 'node.field_test_phone'); + $this->assertEqual($field->type, "telephone", "Field type is telephone."); + + // Date field. + $field = entity_load('field_config', 'node.field_test_datetime'); + $this->assertEqual($field->type, "datetime", "Field type is datetime."); + $this->assertEqual($field->status, FALSE, "Status is FALSE"); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldWidgetSettingsTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldWidgetSettingsTest.php new file mode 100644 index 0000000..c85e388 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFieldWidgetSettingsTest.php @@ -0,0 +1,159 @@ + 'Migrate field widget settings to entity.form_display.*.*.default.yml', + 'description' => 'Migrate field widget settings.', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + + entity_create('node_type', array('type' => 'article'))->save(); + entity_create('node_type', array('type' => 'story'))->save(); + + // Add some id mappings for the dependant migrations. + $id_mappings = array( + 'd6_field_instance' => array( + array(array('fieldname', 'page'), array('node', 'fieldname', 'page')), + ), + 'd6_field' => array( + array(array('field_test'), array('node', 'field_test')), + array(array('field_test_two'), array('node', 'field_test_two')), + array(array('field_test_three'), array('node', 'field_test_three')), + array(array('field_test_email'), array('node', 'field_test_email')), + array(array('field_test_link'), array('node', 'field_test_link')), + array(array('field_test_filefield'), array('node', 'field_test_filefield')), + array(array('field_test_imagefield'), array('node', 'field_test_imagefield')), + array(array('field_test_phone'), array('node', 'field_test_phone')), + array(array('field_test_date'), array('node', 'field_test_date')), + array(array('field_test_datestamp'), array('node', 'field_test_datestamp')), + array(array('field_test_datetime'), array('node', 'field_test_datetime')), + ), + ); + $this->prepareIdMappings($id_mappings); + $migration = entity_load('migration', 'd6_field_instance_widget_settings'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FieldInstance.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + + } + + /** + * Test that migrated view modes can be loaded using D8 API's. + */ + public function testWidgetSettings() { + // Test the config can be loaded. + $form_display = entity_load('entity_form_display', 'node.story.default'); + $this->assertEqual(is_null($form_display), FALSE, "Form display node.story.default loaded with config."); + + // Text field. + $component = $form_display->getComponent('field_test'); + $expected = array('weight' => 1, 'type' => 'text_textfield'); + $expected['settings'] = array('size' => 60, 'placeholder' => ''); + $this->assertEqual($component, $expected, 'Text field settings are correct.'); + + // Integer field. + $component = $form_display->getComponent('field_test_two'); + $expected['type'] = 'number'; + $expected['weight'] = 2; + $expected['settings'] = array('placeholder' => ''); + $this->assertEqual($component, $expected, 'Integer field settings are correct.'); + + // Float field. + $component = $form_display->getComponent('field_test_three'); + $expected['weight'] = 3; + $this->assertEqual($component, $expected, 'Float field settings are correct.'); + + // Email field. + $component = $form_display->getComponent('field_test_email'); + $expected['type'] = 'email_default'; + $expected['weight'] = 4; + $this->assertEqual($component, $expected, 'Email field settings are correct.'); + + // Link field. + $component = $form_display->getComponent('field_test_link'); + $this->assertEqual($component['type'], 'link_default'); + $this->assertEqual($component['weight'], 5); + $this->assertFalse(array_filter($component['settings'])); + + // File field. + $component = $form_display->getComponent('field_test_filefield'); + $expected['type'] = 'file_generic'; + $expected['weight'] = 7; + $expected['settings'] = array('progress_indicator' => 'bar'); + $this->assertEqual($component, $expected, 'File field settings are correct.'); + + // Image field. + $component = $form_display->getComponent('field_test_imagefield'); + $expected['type'] = 'image_image'; + $expected['weight'] = 8; + $expected['settings'] = array('progress_indicator' => 'bar', 'preview_image_style' => 'thumbnail'); + $this->assertEqual($component, $expected, 'Image field settings are correct.'); + + // Phone field. + $component = $form_display->getComponent('field_test_phone'); + $expected['type'] = 'telephone_default'; + $expected['weight'] = 9; + $expected['settings'] = array('placeholder' => ''); + $this->assertEqual($component, $expected, 'Phone field settings are correct.'); + + // Date fields. + $component = $form_display->getComponent('field_test_date'); + $expected['type'] = 'datetime_default'; + $expected['weight'] = 10; + $expected['settings'] = array(); + $this->assertEqual($component, $expected, 'Date field settings are correct.'); + + $component = $form_display->getComponent('field_test_datestamp'); + $expected['weight'] = 11; + $this->assertEqual($component, $expected, 'Date stamp field settings are correct.'); + + $component = $form_display->getComponent('field_test_datetime'); + $expected['weight'] = 12; + $this->assertEqual($component, $expected, 'Datetime field settings are correct.'); + + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFileTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFileTest.php new file mode 100644 index 0000000..f453641 --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFileTest.php @@ -0,0 +1,82 @@ + 'Migrate files', + 'description' => 'file migration', + 'group' => 'Migrate Drupal', + ); + } + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6File.php', + ); + /** @var \Drupal\migrate\entity\Migration $migration */ + $migration = entity_load('migration', 'd6_file'); + $migration->source['conf_path'] = 'core/modules/simpletest'; + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + $this->standalone = TRUE; + } + + /** + * Tests the Drupal 6 files to Drupal 8 migration. + */ + public function testFiles() { + /** @var \Drupal\file\FileInterface $file */ + $file = entity_load('file', 1); + $this->assertEqual($file->getFilename(), 'Image1.png'); + $this->assertEqual($file->getSize(), 39325); + $this->assertEqual($file->getFileUri(), 'public://image-1.png'); + $this->assertEqual($file->getMimeType(), 'image/png'); + // It is pointless to run the second half from MigrateDrupal6Test. + if (empty($this->standalone)) { + return; + } + + // Test that we can re-import and also test with file_directory_path set. + db_truncate(entity_load('migration', 'd6_file')->getIdMap()->mapTableName())->execute(); + $migration = entity_load_unchanged('migration', 'd6_file'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6SystemFile.php', + ); + $this->loadDumps($dumps, 'loadMigrateFileStandalone'); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + + $file = entity_load('file', 2); + $this->assertEqual($file->getFileUri(), 'public://core/modules/simpletest/files/image-2.jpg'); + } + +} diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFilterFormatTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFilterFormatTest.php new file mode 100644 index 0000000..fdb7d2b --- /dev/null +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateFilterFormatTest.php @@ -0,0 +1,74 @@ + 'Migrate variables to filter.formats.*.yml', + 'description' => 'Upgrade variables to filter.formats.*.yml', + 'group' => 'Migrate Drupal', + ); + } + + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + $migration = entity_load('migration', 'd6_filter_format'); + $dumps = array( + drupal_get_path('module', 'migrate_drupal') . '/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6FilterFormat.php', + ); + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + /** + * Tests the Drupal 6 filter format to Drupal 8 migration. + */ + public function testFilterFormat() { + $filter_format = entity_load('filter_format', 'filtered_html'); + + // Check filter status. + $filters = $filter_format->get('filters'); + $this->assertTrue($filters['filter_autop']['status']); + $this->assertTrue($filters['filter_url']['status']); + $this->assertTrue($filters['filter_htmlcorrector']['status']); + $this->assertTrue($filters['filter_html']['status']); + + // These should be false by default. + $this->assertFalse($filters['filter_html_escape']['status']); + $this->assertFalse($filters['filter_caption']['status']); + $this->assertFalse($filters['filter_html_image_secure']['status']); + + // Check variables migrated into filter. + $this->assertIdentical($filters['filter_html']['settings']['allowed_html'], '