Update to Drupal 8.1.2. For more information, see https://www.drupal.org/project/drupal/releases/8.1.2

This commit is contained in:
Pantheon Automation 2016-06-02 15:56:09 -07:00 committed by Greg Anderson
parent 9eae24d844
commit 28556d630e
1322 changed files with 6699 additions and 2064 deletions

View file

@ -44,4 +44,5 @@ class MigrateProcessPlugin extends Plugin {
* @var bool (optional)
*/
public $handle_multiples = FALSE;
}

View file

@ -18,4 +18,5 @@ interface MigrateBuildDependencyInterface {
* An array of migrations.
*/
public function buildDependencyMigration(array $migrations, array $dynamic_ids);
}

View file

@ -378,6 +378,7 @@ class MigrateExecutable implements MigrateExecutableInterface {
$new_value[] = $plugin->transform($scalar_value, $this, $row, $destination);
}
catch (MigrateSkipProcessException $e) {
$new_value[] = NULL;
$break = TRUE;
}
}
@ -391,6 +392,7 @@ class MigrateExecutable implements MigrateExecutableInterface {
$value = $plugin->transform($value, $this, $row, $destination);
}
catch (MigrateSkipProcessException $e) {
$value = NULL;
break;
}
$multiple = $multiple || $plugin->multiple();

View file

@ -14,4 +14,5 @@ interface MigrateMessageInterface {
* The type of message, for example: status or warning.
*/
public function display($message, $type = 'status');
}

View file

@ -209,10 +209,32 @@ interface MigrateIdMapInterface extends \Iterator, PluginInspectionInterface {
* The source identifier keyed values of the record, e.g. ['nid' => 5].
*
* @return array
* The destination identifier values of the record, or NULL on failure.
* The destination identifier values of the record, or empty on failure.
*
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.x. Use
* lookupDestinationIds() instead.
*/
public function lookupDestinationId(array $source_id_values);
/**
* Looks up the destination identifiers corresponding to a source key.
*
* This can look up a subset of source keys if only some are provided, and
* will return all destination keys that match.
*
* @param array $source_id_values
* The source identifier keyed values of the records, e.g. ['nid' => 5].
* If unkeyed, the first count($source_id_values) keys will be assumed.
*
* @return array
* An array of arrays of destination identifier values.
*
* @throws \Drupal\migrate\MigrateException
* Thrown when $source_id_values contains unknown keys, or is the wrong
* length.
*/
public function lookupDestinationIds(array $source_id_values);
/**
* Looks up the destination identifier currently being iterated.
*

View file

@ -217,7 +217,7 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn
protected $migrationPluginManager;
/**
* The source plugin manager.
* The source plugin manager.
*
* @var \Drupal\migrate\Plugin\MigratePluginManager
*/
@ -712,4 +712,5 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn
public function getDestinationIds() {
$this->destinationIds;
}
}

View file

@ -279,7 +279,7 @@ interface MigrationInterface extends PluginInspectionInterface, DerivativeInspec
* @return $this
* The migration entity.
*
* @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField().
* @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField()
*/
public function mergeProcessOfProperty($property, array $process_of_property);

View file

@ -157,6 +157,7 @@ class MigrationPluginManager extends DefaultPluginManager implements MigrationPl
// current migration.
$dependency_graph = [];
$required_dependency_graph = [];
$have_optional = FALSE;
foreach ($migrations as $migration) {
/** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
$id = $migration->id();
@ -172,14 +173,15 @@ class MigrationPluginManager extends DefaultPluginManager implements MigrationPl
$this->addDependency($dependency_graph, $id, $dependency, $dynamic_ids);
}
}
if (isset($migration_dependencies['optional'])) {
if (!empty($migration_dependencies['optional'])) {
foreach ($migration_dependencies['optional'] as $dependency) {
$this->addDependency($dependency_graph, $id, $dependency, $dynamic_ids);
}
$have_optional = TRUE;
}
}
$dependency_graph = (new Graph($dependency_graph))->searchAndSort();
if (!empty($migration_dependencies['optional'])) {
if ($have_optional) {
$required_dependency_graph = (new Graph($required_dependency_graph))->searchAndSort();
}
else {

View file

@ -517,16 +517,56 @@ class Sql extends PluginBase implements MigrateIdMapInterface, ContainerFactoryP
* {@inheritdoc}
*/
public function lookupDestinationId(array $source_id_values) {
$results = $this->lookupDestinationIds($source_id_values);
return $results ? reset($results) : array();
}
/**
* {@inheritdoc}
*/
public function lookupDestinationIds(array $source_id_values) {
if (empty($source_id_values)) {
return array();
}
$query = $this->getDatabase()->select($this->mapTableName(), 'map')
->fields('map', $this->destinationIdFields());
$query->condition(static::SOURCE_IDS_HASH, $this->getSourceIDsHash($source_id_values));
$result = $query->execute();
$destination_id = $result->fetchAssoc();
return array_values($destination_id ?: array());
// Canonicalize the keys into a hash of DB-field => value.
$is_associative = !isset($source_id_values[0]);
$conditions = [];
foreach ($this->sourceIdFields() as $field_name => $db_field) {
if ($is_associative) {
// Associative $source_id_values can have fields out of order.
if (isset($source_id_values[$field_name])) {
$conditions[$db_field] = $source_id_values[$field_name];
unset($source_id_values[$field_name]);
}
}
else {
// For non-associative $source_id_values, we assume they're the first
// few fields.
if (empty($source_id_values)) {
break;
}
$conditions[$db_field] = array_shift($source_id_values);
}
}
if (!empty($source_id_values)) {
throw new MigrateException("Extra unknown items in source IDs");
}
$query = $this->getDatabase()->select($this->mapTableName(), 'map')
->fields('map', $this->destinationIdFields());
if (count($this->sourceIdFields()) === count($conditions)) {
// Optimization: Use the primary key.
$query->condition(self::SOURCE_IDS_HASH, $this->getSourceIDsHash(array_values($conditions)));
}
else {
foreach ($conditions as $db_field => $value) {
$query->condition($db_field, $value);
}
}
return $query->execute()->fetchAll(\PDO::FETCH_NUM);
}
/**

View file

@ -335,4 +335,5 @@ class Row {
public function isStub() {
return $this->isStub;
}
}