Commit ec9a3ec2 authored by alexpott's avatar alexpott
Browse files

Issue #2348875 by benjy, chx, bdone: Improving our dump files

parent 7d013683
...@@ -102,7 +102,7 @@ process: ...@@ -102,7 +102,7 @@ process:
filefield: filefield:
default: file_default default: file_default
url_plain: file_url_plain url_plain: file_url_plain
path_plain: file_url_plan #unsure about this? path_plain: file_url_plain
image_plain: image image_plain: image
image_nodelink: image image_nodelink: image
image_imagelink: image image_imagelink: image
......
...@@ -112,21 +112,26 @@ public function loadMultiple(EntityStorageInterface $storage, array $sub_ids = N ...@@ -112,21 +112,26 @@ public function loadMultiple(EntityStorageInterface $storage, array $sub_ids = N
]; ];
} }
elseif ($data['type'] === 'text') { elseif ($data['type'] === 'text') {
$migration->process[$field_name . '/value'] = $field_name . '/value'; // The data is stored differently depending on whether we're using
// db storage.
$value_key = $data['db_storage'] ? $field_name : "$field_name/value";
$format_key = $data['db_storage'] ? $field_name . '_format' : "$field_name/format" ;
$migration->process["$field_name/value"] = $value_key;
// See d6_user, signature_format for an example of the YAML that // See d6_user, signature_format for an example of the YAML that
// represents this process array. // represents this process array.
$migration->process[$field_name . '/format'] = [ $migration->process["$field_name/format"] = [
[ [
'plugin' => 'static_map', 'plugin' => 'static_map',
'bypass' => TRUE, 'bypass' => TRUE,
'source' => $field_name . '/format', 'source' => $format_key,
'map' => [0 => NULL] 'map' => [0 => NULL]
], ],
['plugin' => 'skip_process_on_empty'], ['plugin' => 'skip_process_on_empty'],
[ [
'plugin' => 'migration', 'plugin' => 'migration',
'migration' => 'd6_filter_format', 'migration' => 'd6_filter_format',
'source' => $field_name . '/format', 'source' => $format_key,
'no_stub' => 1, 'no_stub' => 1,
], ],
]; ];
......
<?php
/**
* @file
* Contains \Drupal\migrate_drupal\Tests\Dump\Drupal6ActionSettings.
*/
namespace Drupal\migrate_drupal\Tests\Dump;
/**
* Database dump for testing action.settings.yml migration.
*/
class Drupal6ActionSettings extends Drupal6DumpBase {
/**
* {@inheritdoc}
*/
public function load() {
$this->createTable('variable');
$this->database->insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'actions_max_stack',
'value' => 'i:35;',
))
->execute();
}
}
<?php
/**
* @file
* Contains \Drupal\migrate_drupal\Tests\Dump\Drupal6AggregatorSettings.
*/
namespace Drupal\migrate_drupal\Tests\Dump;
/**
* Database dump for testing aggregator.settings.yml migration.
*/
class Drupal6AggregatorSettings extends Drupal6DumpBase {
/**
* {@inheritdoc}
*/
public function load() {
$this->createTable('variable');
$this->database->insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'aggregator_fetcher',
'value' => 's:10:"aggregator";',
))
->values(array(
'name' => 'aggregator_parser',
'value' => 's:10:"aggregator";',
))
->values(array(
'name' => 'aggregator_processors',
'value' => 'a:1:{i:0;s:10:"aggregator";}',
))
->values(array(
'name' => 'aggregator_allowed_html_tags',
'value' => 's:70:"<a> <b> <br /> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>";',
))
->values(array(
'name' => 'aggregator_teaser_length',
'value' => 's:3:"600";',
))
->values(array(
'name' => 'aggregator_clear',
'value' => 's:7:"9676800";',
))
->values(array(
'name' => 'aggregator_summary_items',
'value' => 's:1:"3";',
))
->execute();
}
}
<?php
/**
* @file
* Contains \Drupal\migrate_drupal\Tests\Dump\Drupal6Book.
*/
namespace Drupal\migrate_drupal\Tests\Dump;
class Drupal6Book extends Drupal6DumpBase {
/**
* {@inheritdoc}
*/
public function load() {
$this->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();
}
}
<?php
/**
* @file
* Contains \Drupal\migrate_drupal\Tests\Dump\Drupal6BookSettings.
*/
namespace Drupal\migrate_drupal\Tests\Dump;
/**
* Database dump for testing book.settings.yml migration.
*/
class Drupal6BookSettings extends Drupal6DumpBase {
/**