Update to Drupal 8.0.6. For more information, see https://www.drupal.org/drupal-8.0.6-release-notes
This commit is contained in:
parent
4297c64508
commit
b11a755ba8
159 changed files with 2340 additions and 543 deletions
|
@ -151,3 +151,42 @@ migrate_entity_constant:
|
|||
migrate.source.md_empty:
|
||||
type: migrate.source.empty
|
||||
label: 'Empty source for migrate_drupal migrations'
|
||||
|
||||
migrate.source.i18n_variable:
|
||||
type: migrate_source_sql
|
||||
label: 'i18n Variable'
|
||||
mapping:
|
||||
variables:
|
||||
type: sequence
|
||||
label: 'Variables'
|
||||
sequence:
|
||||
type: string
|
||||
label: 'Variable'
|
||||
constants:
|
||||
type: mapping
|
||||
label: 'Constants'
|
||||
mapping:
|
||||
entity_type:
|
||||
type: string
|
||||
label: 'Entity type'
|
||||
id:
|
||||
type: string
|
||||
label: 'ID'
|
||||
label:
|
||||
type: label
|
||||
label: 'Label'
|
||||
description:
|
||||
type: text
|
||||
label: 'Description'
|
||||
path:
|
||||
type: string
|
||||
label: 'Path'
|
||||
plugin:
|
||||
type: string
|
||||
label: 'Plugin'
|
||||
status:
|
||||
type: boolean
|
||||
label: 'Status'
|
||||
slash:
|
||||
type: string
|
||||
label: 'Slash'
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\migrate_drupal\Plugin\migrate\source\d6\i18nVariable.
|
||||
*/
|
||||
|
||||
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\State\StateInterface;
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal i18n_variable source from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "i18n_variable"
|
||||
* )
|
||||
*/
|
||||
class i18nVariable extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* The variable names to fetch.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $variables;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityManagerInterface $entity_manager) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
|
||||
$this->variables = $this->configuration['variables'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function initializeIterator() {
|
||||
return new \ArrayIterator($this->values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the values of the variables specified in the plugin configuration.
|
||||
*
|
||||
* @return array
|
||||
* An associative array where the keys are the variables specified in the
|
||||
* plugin configuration and the values are the values found in the source.
|
||||
* A key/value pair is added for the language code. Only those values are
|
||||
* returned that are actually in the database.
|
||||
*/
|
||||
protected function values() {
|
||||
$values = [];
|
||||
$result = $this->prepareQuery()->execute()->FetchAllAssoc('language');
|
||||
foreach ($result as $i18n_variable) {
|
||||
$values[]['language'] = $i18n_variable->language;
|
||||
}
|
||||
$result = $this->prepareQuery()->execute()->FetchAll();
|
||||
foreach ($result as $i18n_variable) {
|
||||
foreach ($values as $key => $value) {
|
||||
if ($values[$key]['language'] === $i18n_variable->language) {
|
||||
$values[$key][$i18n_variable->name] = unserialize($i18n_variable->value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function count() {
|
||||
return $this->initializeIterator()->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return array_combine($this->variables, $this->variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
return $this->getDatabase()
|
||||
->select('i18n_variable', 'v')
|
||||
->fields('v')
|
||||
->condition('name', (array) $this->configuration['variables'], 'IN');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['language']['type'] = 'string';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -30531,6 +30531,21 @@ $connection->insert('profile_fields')
|
|||
'autocomplete' => '1',
|
||||
'options' => '',
|
||||
))
|
||||
->values(array(
|
||||
'fid' => '13',
|
||||
'title' => 'Blog',
|
||||
'name' => 'profile_blog',
|
||||
'explanation' => 'Paste the full URL, including http://, of your personal blog.',
|
||||
'category' => 'Personal information',
|
||||
'page' => '',
|
||||
'type' => 'url',
|
||||
'weight' => '3',
|
||||
'required' => '0',
|
||||
'register' => '0',
|
||||
'visibility' => '3',
|
||||
'autocomplete' => '0',
|
||||
'options' => '',
|
||||
))
|
||||
->values(array(
|
||||
'fid' => '14',
|
||||
'title' => 'Birthdate',
|
||||
|
@ -30561,21 +30576,6 @@ $connection->insert('profile_fields')
|
|||
'autocomplete' => '0',
|
||||
'options' => '',
|
||||
))
|
||||
->values(array(
|
||||
'fid' => '16',
|
||||
'title' => 'Blog',
|
||||
'name' => 'profile_blog',
|
||||
'explanation' => 'Paste the full URL, including http://, of your personal blog.',
|
||||
'category' => 'Personal information',
|
||||
'page' => '',
|
||||
'type' => 'url',
|
||||
'weight' => '3',
|
||||
'required' => '0',
|
||||
'register' => '0',
|
||||
'visibility' => '3',
|
||||
'autocomplete' => '0',
|
||||
'options' => '',
|
||||
))
|
||||
->execute();
|
||||
|
||||
$connection->schema()->createTable('profile_values', array(
|
||||
|
@ -34072,7 +34072,7 @@ $connection->insert('vocabulary')
|
|||
'help' => '',
|
||||
'relations' => '1',
|
||||
'hierarchy' => '2',
|
||||
'multiple' => '0',
|
||||
'multiple' => '1',
|
||||
'required' => '0',
|
||||
'tags' => '0',
|
||||
'module' => 'taxonomy',
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\migrate_drupal\Unit\source\d6\i18nVariableTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests the variable source plugin.
|
||||
*
|
||||
* @group migrate_drupal
|
||||
*/
|
||||
class i18nVariableTest extends MigrateSqlSourceTestCase {
|
||||
|
||||
// The plugin system is not working during unit testing so the source plugin
|
||||
// class needs to be manually specified.
|
||||
const PLUGIN_CLASS = 'Drupal\migrate_drupal\Plugin\migrate\source\d6\i18nVariable';
|
||||
|
||||
/**
|
||||
* Define bare minimum migration configuration.
|
||||
*/
|
||||
protected $migrationConfiguration = [
|
||||
'id' => 'test',
|
||||
'highWaterProperty' => array('field' => 'test'),
|
||||
'source' => [
|
||||
'plugin' => 'i18n_variable',
|
||||
'variables' => [
|
||||
'site_slogan',
|
||||
'site_name',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Expected results from the source.
|
||||
*/
|
||||
protected $expectedResults = [
|
||||
[
|
||||
'language' => 'fr',
|
||||
'site_slogan' => 'Migrate est génial',
|
||||
'site_name' => 'nom de site',
|
||||
],
|
||||
[
|
||||
'language' => 'mi',
|
||||
'site_slogan' => 'Ko whakamataku heke',
|
||||
'site_name' => 'ingoa_pae',
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* Database contents for tests.
|
||||
*/
|
||||
protected $databaseContents = [
|
||||
'i18n_variable' => [
|
||||
array('name' => 'site_slogan', 'language' => 'fr', 'value' => 's:19:"Migrate est génial";'),
|
||||
array('name' => 'site_name', 'language' => 'fr', 'value' => 's:11:"nom de site";'),
|
||||
array('name' => 'site_slogan', 'language' => 'mi', 'value' => 's:19:"Ko whakamataku heke";'),
|
||||
array('name' => 'site_name', 'language' => 'mi', 'value' => 's:9:"ingoa_pae";'),
|
||||
],
|
||||
];
|
||||
|
||||
}
|
Reference in a new issue