update drupal

This commit is contained in:
Tessier
2020-10-15 11:59:37 +02:00
parent ebb5db14b5
commit d8b9162932
558 changed files with 5954 additions and 4475 deletions
@@ -189,7 +189,11 @@ class MigrateExecutable implements MigrateExecutableInterface {
}
catch (\Exception $e) {
$this->message->display(
$this->t('Migration failed with source plugin exception: @e', ['@e' => $e->getMessage()]), 'error');
$this->t('Migration failed with source plugin exception: @e in @file line @line', [
'@e' => $e->getMessage(),
'@file' => $e->getFile(),
'@line' => $e->getLine(),
]), 'error');
$this->migration->setStatus(MigrationInterface::STATUS_IDLE);
return MigrationInterface::RESULT_FAILED;
}
@@ -269,8 +273,11 @@ class MigrateExecutable implements MigrateExecutableInterface {
}
catch (\Exception $e) {
$this->message->display(
$this->t('Migration failed with source plugin exception: @e',
['@e' => $e->getMessage()]), 'error');
$this->t('Migration failed with source plugin exception: @e in @file line @line', [
'@e' => $e->getMessage(),
'@file' => $e->getFile(),
'@line' => $e->getLine(),
]), 'error');
$this->migration->setStatus(MigrationInterface::STATUS_IDLE);
return MigrationInterface::RESULT_FAILED;
}
@@ -13,21 +13,56 @@ use Drupal\migrate\Row;
* for audit and rollback purposes. The keys used in the migrate_map table are
* of the form sourceidN and destidN for the source and destination values
* respectively.
*
* The mappings are stored in a migrate_map table with properties:
* - source_ids_hash: A hash of the source IDs.
* - sourceidN: Any number of source IDs defined by a source plugin, where N
* starts at 1, for example, sourceid1, sourceid2 ... sourceidN.
* - destidN: Any number of destination IDs defined by a destination plugin,
* where N starts at 1, for example, destid1, destid2 ... destidN.
* - source_row_status: Indicates current status of the source row, valid
* values are self::STATUS_IMPORTED, self::STATUS_NEEDS_UPDATE,
* self::STATUS_IGNORED or self::STATUS_FAILED.
* - rollback_action: Flag indicating what to do for this item on rollback. This
* property is set in destination plugins. Valid values are
* self::ROLLBACK_DELETE and self::ROLLBACK_PRESERVE.
* - last_imported: UNIX timestamp of the last time the row was imported.
* - hash: A hash of the source row data that is used to detect changes in the
* source data.
*/
interface MigrateIdMapInterface extends \Iterator, PluginInspectionInterface {
/**
* Codes reflecting the current status of a map row.
* Indicates that the import of the row was successful.
*/
const STATUS_IMPORTED = 0;
/**
* Indicates that the row needs to be updated.
*/
const STATUS_NEEDS_UPDATE = 1;
/**
* Indicates that the import of the row was ignored.
*/
const STATUS_IGNORED = 2;
/**
* Indicates that the import of the row failed.
*/
const STATUS_FAILED = 3;
/**
* Codes reflecting how to handle the destination item on rollback.
* Indicates that the data for the row is to be deleted.
*/
const ROLLBACK_DELETE = 0;
/**
* Indicates that the data for the row is to be preserved.
*
* Rows that refer to entities that already exist on the destination and are
* being updated are preserved.
*/
const ROLLBACK_PRESERVE = 1;
/**
@@ -9,16 +9,9 @@ use Drupal\migrate\Row;
/**
* An interface for migrate process plugins.
*
* A process plugin will typically implement the transform() method to perform
* its work. However, it is possible instead for a process plugin to use any
* number of methods, thus offering different alternatives ways of processing.
* In this case, the transform() method should not be implemented, and the
* plugin configuration must provide the name of the method to be called via the
* "method" key. Each method must have the same signature as transform().
* The base class \Drupal\migrate\ProcessPluginBase takes care of implementing
* transform() and calling the configured method. See
* \Drupal\migrate\Plugin\migrate\process\SkipOnEmpty and
* d6_field_instance_widget_settings.yml for examples.
* Migrate process plugins transform the input value.For example, transform a
* human provided name into a machine name, look up an identifier in a previous
* migration and so on.
*
* @see \Drupal\migrate\Plugin\MigratePluginManager
* @see \Drupal\migrate\ProcessPluginBase
@@ -14,6 +14,10 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a generic destination to import entities.
*
* Available configuration keys:
* - default_bundle: (optional) The bundle to use for this row if 'bundle' is
* not defined on the row.
*
* Examples:
*
* @code
@@ -44,8 +48,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* revision_timestamp: timestamp
* destination:
* plugin: entity:node
* default_bundle: custom
* @endcode
*
* This will save the processed, migrated row as a node of type 'custom'.
*
* @MigrateDestination(
* id = "entity",
* deriver = "Drupal\migrate\Plugin\Derivative\MigrateEntity"
@@ -85,6 +85,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* validate: true
* @endcode
*
* @see \Drupal\migrate\Plugin\migrate\destination\Entity
* @see \Drupal\migrate\Plugin\migrate\destination\EntityRevision
*/
class EntityContentBase extends Entity implements HighestIdInterface, MigrateValidatableEntityInterface {
@@ -29,8 +29,8 @@ use Drupal\migrate\Row;
* @endcode
*
* This will set new_text_field to the concatenation of the 'foo' and 'bar'
* source values. For example, if the 'foo' property is "wambooli" and the 'bar'
* property is "pastafazoul", new_text_field will be "wamboolipastafazoul".
* source values. For example, if the 'foo' property is "Rosa" and the 'bar'
* property is "Parks", new_text_field will be "RosaParks".
*
* You can also specify a delimiter.
*
@@ -46,8 +46,8 @@ use Drupal\migrate\Row;
*
* This will set new_text_field to the concatenation of the 'foo' source value,
* the delimiter and the 'bar' source value. For example, using the values above
* and "/" as the delimiter, if the 'foo' property is "wambooli" and the 'bar'
* property is "pastafazoul", new_text_field will be "wambooli/pastafazoul".
* and "/" as the delimiter, if the 'foo' property is "Rosa" and the 'bar'
* property is "Rosa", new_text_field will be "Rosa/Parks".
*
* @see \Drupal\migrate\Plugin\MigrateProcessInterface
*
@@ -16,7 +16,8 @@ use Drupal\migrate\Row;
* Available configuration keys:
* - process: the plugin(s) that will process each element of the source.
* - key: runs the process pipeline for the key to determine a new dynamic
* name.
* name. If the new dynamic name is NULL then the result of the sub_process
* pipeline is ignored.
* - include_source: (optional) If TRUE, all source plugin configuration and
* values will be copied into the sub-processed row in a new property named
* for the source_key configuration value (see below). Defaults to FALSE.
@@ -143,7 +144,8 @@ use Drupal\migrate\Row;
* you need to change the key, it is possible for the returned array to be keyed
* by one of the transformed values in the sub-array. For the same source data
* used in the previous example, the migration below would result to keys
* 'filter_2' and 'filter_0'.
* 'filter_2' and 'filter_0'. If the value for 'id' is NULL the result of the
* sub_process pipeline is ignored.
* @code
* process:
* filters:
@@ -207,7 +209,13 @@ class SubProcess extends ProcessPluginBase {
if (array_key_exists('key', $this->configuration)) {
$key = $this->transformKey($key, $migrate_executable, $new_row);
}
$return[$key] = $destination;
// Do not save the result if the key is NULL. The configured process
// pipeline used in transformKey() will return NULL if a
// MigrateSkipProcessException is thrown.
// @see \Drupal\filter\Plugin\migrate\process\FilterID
if ($key !== NULL) {
$return[$key] = $destination;
}
}
}
return $return;
@@ -452,7 +452,7 @@ abstract class SqlBase extends SourcePluginBase implements ContainerFactoryPlugi
}
foreach (['username', 'password', 'host', 'port', 'namespace', 'driver'] as $key) {
if (isset($source_database_options[$key])) {
if (isset($source_database_options[$key]) && isset($id_map_database_options[$key])) {
if ($id_map_database_options[$key] != $source_database_options[$key]) {
return FALSE;
}
@@ -12,10 +12,18 @@ use Drupal\migrate\Plugin\MigrateProcessInterface;
* transform a human provided name into a machine name, look up an identifier
* in a previous migration and so on.
*
* Process plugins extending this class can use any number of methods, thus
* offering different alternative ways of processing. In this case, the
* transform() method should not be implemented, and the plugin configuration
* must provide the name of the method to be called via the "method" key. Each
* method must have the same signature as transform().
*
* @see https://www.drupal.org/node/2129651
* @see \Drupal\migrate\Plugin\MigratePluginManager
* @see \Drupal\migrate\Plugin\MigrateProcessInterface
* @see \Drupal\migrate\Annotation\MigrateProcessPlugin
* @see \Drupal\migrate\Plugin\migrate\process\SkipOnEmpty
* @see d7_field_formatter_settings.yml
* @see plugin_api
*
* @ingroup migration