class MigrationDataImport in CRM Core 7
@file Handler for migration process.
Hierarchy
- class \MigrationBase
- class \Migration
- class \MigrationDataImport
- class \Migration
Expanded class hierarchy of MigrationDataImport
1 string reference to 'MigrationDataImport'
- crm_core_data_import_register_migration in modules/
crm_core_data_import/ crm_core_data_import.module - Register CRM Core data migration.
File
- modules/
crm_core_data_import/ includes/ controllers/ MigrationDataImport.inc, line 7 - Handler for migration process.
View source
class MigrationDataImport extends Migration {
/**
* Mapping of current migration
*/
public $fields_mapping;
/**
* Mapping for Field Collection fields.
*/
public $collection_mapping;
/**
* List of Field Collection fields.
*/
public $collection_items;
/**
* General initialization of a Migration object.
*/
public function __construct(array $arguments) {
$this->arguments = $arguments;
parent::__construct($arguments);
$importer = $this
->getImporter();
$entity_type = $this
->getEntityType();
$entity_bundle = $this
->getEntityBundle();
$delta = $this
->getDelta();
// Set migrate source settings.
$this->source = $importer
->migrateSource($entity_type, $entity_bundle);
// Set migrate destination settings.
$this->destination = $importer
->migrateDestination($entity_type, $entity_bundle, $delta);
// Key schema.
$this->map = new CRMCoreMigrateSQLMap($this->machineName, $importer
->migrateSourceMap($entity_type, $entity_bundle, $delta), $importer
->migrateDestinationMap($entity_type, $entity_bundle, $delta), 'default', array(
'importer' => $importer,
'entity_type' => $entity_type,
'entity_bundle' => $entity_bundle,
'delta' => $delta,
));
// Get linked data imports.
// If found, we will populate MigrateFieldMapping::sourceMigration later
// to automatically pull already imported values.
$linked_imports = $importer
->getLinkedImports();
$source_migration = array();
if ($linked_imports) {
foreach ($linked_imports as $id => $field) {
$linked_importer = crm_core_data_import_load_importer($id);
$candidates = $linked_importer
->getMigrationInstances();
foreach ($candidates as $m) {
/** @var Migration $m */
$source_keys = array_keys($m
->getMap()
->getSourceKey());
if ($source_keys[0] == $field['destination']) {
$source_migration[$field['destination']] = $m
->getMachineName();
}
}
}
}
// Set mapping according to settings.
$destination = $importer
->getDestinationsForEntity($this
->getEntityType(), $this
->getEntityBundle(), $this
->getDelta());
$mapping = $importer
->getMappingSettings();
if ($destination->entityType == $entity_type && $destination->bundle == $entity_bundle && !empty($mapping[$destination->controller . ':' . $destination->bundle . ':' . $delta])) {
$this->fields_mapping = $mapping[$destination->controller . ':' . $destination->bundle . ':' . $delta];
switch ($destination->entityType) {
case 'user':
// Separate handling for user entity.
foreach ($this->fields_mapping as $key => $field) {
if ($key !== 'primary' && !$this
->skipCollectionField($field) && !$this
->skipReferencesField($field)) {
if ($field['destination_field'] == 'name') {
$single_mapping = $this
->addFieldMapping($field['destination_field'], $field['source_field'])
->dedupe('users', 'name');
}
elseif ($field['destination_field'] == 'mail') {
$single_mapping = $this
->addFieldMapping($field['destination_field'], $field['source_field'])
->dedupe('users', 'mail');
}
else {
$single_mapping = $this
->addRegularFieldMapping($field);
}
// Add sourceMigration from linked import(s) if necessary
if (!empty($source_migration[$field['source_field']])) {
$single_mapping
->sourceMigration($source_migration[$field['source_field']]);
}
}
}
// Add status if not added in the configuration form.
if (!array_key_exists('status', $this->codedFieldMappings)) {
$this
->addFieldMapping('status')
->defaultValue(TRUE);
}
break;
case 'crm_core_activity':
// Separate handling for crm_core_activity entity.
foreach ($this->fields_mapping as $key => $field) {
if ($key !== 'primary' && !$this
->skipReferencesField($field)) {
$single_mapping = $this
->addRegularFieldMapping($field);
// Add sourceMigration from linked import(s) if necessary
if (!empty($source_migration[$field['source_field']])) {
$single_mapping
->sourceMigration($source_migration[$field['source_field']]);
}
}
}
// Add uid if not added in the configuration form.
if (!array_key_exists('uid', $this->codedFieldMappings)) {
$this
->addFieldMapping('uid')
->defaultValue(0);
}
break;
default:
foreach ($this->fields_mapping as $key => $field) {
if ($key !== 'primary' && !$this
->skipCollectionField($field) && !$this
->skipReferencesField($field)) {
$single_mapping = $this
->addRegularFieldMapping($field);
// Add sourceMigration from linked import(s) if necessary
if (!empty($source_migration[$field['source_field']])) {
$single_mapping
->sourceMigration($source_migration[$field['source_field']]);
}
}
// Collect names of the field collection fields.
if ($this
->skipCollectionField($field)) {
$main_field = $this
->getMainFieldName($field['destination_field']);
$this->collection_items[] = $main_field;
}
}
break;
}
}
// Run preImport method in settings plugins.
$importer_settings = $importer
->getSettings();
if (!empty($importer_settings['settings_controllers'])) {
foreach ($importer_settings['settings_controllers'] as $controller) {
$settings_controller = crm_core_data_import_load_plugin_instance('crm_core_data_import_settings', $controller);
if ($settings_controller) {
$settings_controller
->preImport($importer, $this);
}
}
}
if (!empty($this->collection_items)) {
$this->collection_items = array_unique($this->collection_items);
$this
->buildFieldCollectionMapping();
}
drupal_alter('crm_core_data_import_migration', $this);
}
/**
* This method is called from the source plugin upon first pulling the raw data from the source.
*/
public function prepareRow($row) {
$plugins = ctools_get_plugins('crm_core_data_import', 'crm_core_data_import_conversion');
foreach ($plugins as $plugin) {
$conversion = crm_core_data_import_load_plugin_instance('crm_core_data_import_conversion', $plugin['name']);
// Run conversion plugin if he compatible with source plugin.
if ($this
->isCompatible($conversion)) {
$conversion
->prepareRow($row, $this
->getImporter());
}
}
parent::prepareRow($row);
drupal_alter('crm_core_data_import_source_row', $row, $this
->generateMachineName());
$this
->prepareDefaultValues($row);
return $row;
}
/**
* Prepare entity before saving.
*/
public function prepare($entity, $row) {
// Run match engine for crm_core_contact.
if ($this
->getEntityType() == 'crm_core_contact') {
// Set temporary contact_id.
$entity->contact_id = 0;
$matches = array();
$values = array(
'contact' => &$entity,
'matches' => &$matches,
);
module_invoke_all('crm_core_contact_match', $values);
// If contact already exist, replace contact_id to match.
if (!empty($matches)) {
$entity->contact_id = reset($matches);
// Set current entity as original to update fields.
$entity->original = $entity;
entity_save('crm_core_contact', $entity);
}
}
drupal_alter('crm_core_data_import_prepare_entity', $entity, $row, $this
->generateMachineName());
}
/**
* Complete callback for each item.
*
* @param object $entity
* Imported entity.
*
* @param object $row
* Row of source values.
*/
public function complete($entity, $row) {
// Process field collections.
if (!empty($this->collection_items) && !empty($this->collection_mapping)) {
$collection_items = $this->collection_items;
foreach ($collection_items as $collection_item) {
$this
->attachFieldCollection($entity, $row, $collection_item, $this->collection_mapping[$collection_item]['mapping'], $this->collection_mapping[$collection_item]['main_field']);
}
}
// @TODO need add hook
}
/**
* Generate machine name. Data Import task and id with prefix.
*/
public function generateMachineName($class_name = NULL) {
return _crm_core_data_import_migration_machine_name($this->arguments['importer']->id, $this->arguments['entity_type'], $this->arguments['entity_bundle'], $this->arguments['delta']);
}
/**
* Returns entity type.
*/
public function getEntityType() {
return $this->arguments['entity_type'];
}
/**
* Returns entity bundle.
*/
public function getEntityBundle() {
return $this->arguments['entity_bundle'];
}
/**
* Returns entity delta.
*/
public function getDelta() {
return $this->arguments['delta'];
}
/**
* Returns importer.
*/
public function getImporter() {
return $this->arguments['importer'];
}
/**
* Helper to add field to mapping.
*
* @return MigrateFieldMapping
*/
public function addRegularFieldMapping($field) {
if ($field['source_field'] == 'default_value') {
// If need to set only default value.
$mapping = $this
->addFieldMapping($field['destination_field'])
->defaultValue($field['default_value']);
}
elseif (!empty($field['default_value'])) {
// If need to set default value. Will be apply if source data is empty.
$mapping = $this
->addFieldMapping($field['destination_field'], $field['source_field'])
->defaultValue($field['default_value']);
}
else {
$mapping = $this
->addFieldMapping($field['destination_field'], $field['source_field']);
}
return $mapping;
}
/**
* Prepare row for setting default values.
*/
public function prepareDefaultValues(&$row) {
// Remove values from row, if they are empty and have default value.
$importer = $this
->getImporter();
$entity_type = $this
->getEntityType();
$entity_bundle = $this
->getEntityBundle();
$delta = $this
->getDelta();
$mapping = $importer
->getMappingSettings();
$destination = $importer
->getDestinationsForEntity($this
->getEntityType(), $this
->getEntityBundle(), $this
->getDelta());
if ($destination->entityType == $entity_type && $destination->bundle == $entity_bundle && !empty($mapping[$destination->controller . ':' . $destination->bundle . ':' . $delta])) {
$fields_mapping = $mapping[$destination->controller . ':' . $destination->bundle . ':' . $delta];
foreach ($fields_mapping as $field) {
if (!empty($field['default_value']) && !empty($field['source_field']) && empty($row->{$field['source_field']})) {
unset($row->{$field['source_field']});
}
}
}
}
/**
* Check if we need skip references field.
*/
public function skipReferencesField($field) {
$settings = $importer = $this
->getImporter()
->getSettings();
if (!empty($settings['references']['enable']) && !empty($settings['references']['fields'])) {
foreach ($settings['references']['fields'] as $reference) {
list($entity_type, $entity_bundle, $delta, $target_field_name) = explode(':', $reference['reference_type']);
if ($this
->getEntityType() == $entity_type && $this
->getEntityBundle() == $entity_bundle && $this
->getDelta() == $delta && $target_field_name == $field['destination_field']) {
return TRUE;
}
}
}
return FALSE;
}
/**
* Check if we need skip field collection.
*/
public function skipCollectionField($field) {
if (!empty($field['destination_field'])) {
$main_field = $this
->getMainFieldName($field['destination_field']);
if (!empty($main_field) && _crm_core_data_import_is_field_collection_field($main_field)) {
return TRUE;
}
}
return FALSE;
}
/**
* Returns main field name.
*/
public function getMainFieldName($field) {
list($main_field) = explode(':', $field);
return $main_field;
}
/**
* Return TRUE if conversion plugin is compatible with current source plugin.
*/
public function isCompatible($conversion) {
$importer = $this
->getImporter();
$types = $conversion
->compatible();
return empty($types) || in_array($importer->source, $types);
}
/**
* Attach FC item to host entity.
*
* @param object $entity
* Imported entity.
*
* @param object $row
* Data to import.
*
* @param string $collection_item
* Name of the FC item.
*
* @param array $collection_mapping
* Mapping of the FC entity.
*
* @param string $main_source_field
* Name of the main field in source.
*/
public function attachFieldCollection(&$entity, &$row, $collection_item, $collection_mapping, $main_source_field) {
if (!empty($row->{$main_source_field . '_collection'})) {
foreach ($row->{$main_source_field . '_collection'} as $collection_value) {
try {
// Create FC entity.
$collection_entity = entity_create('field_collection_item', array(
'field_name' => $collection_item,
));
$collection_entity_wrapper = entity_metadata_wrapper('field_collection_item', $collection_entity);
$collection_entity
->setHostEntity($this
->getEntityType(), $entity);
// Add values according to mapping.
foreach ($collection_mapping as $mapping_item) {
$value = '';
// Process default value.
if ($mapping_item['source']['type'] == 'default_value') {
// Set default value.
$value = $mapping_item['destination']['default_value'];
}
elseif (isset($collection_value[$mapping_item['source']['sub_field']])) {
// Set field value from source.
$value = $collection_value[$mapping_item['source']['sub_field']];
}
if (empty($value) && !empty($mapping_item['destination']['default_value'])) {
// Set default value if source value is empty.
$value = $mapping_item['destination']['default_value'];
}
if (!empty($value) && isset($mapping_item['destination']['sub_field'])) {
$field_name = $mapping_item['destination']['sub_field'];
if (!empty($mapping_item['destination']['part'])) {
// If field is part, just attach to existing entity.
$collection_entity_wrapper->{$field_name}->{$mapping_item['destination']['part']}
->set($value);
}
else {
// Process field with MigrateFieldHandler.
$field_info = field_info_field($field_name);
$field_instance = field_info_instance('field_collection_item', $field_name, $collection_item);
$value = migrate_field_handler_invoke_all($collection_entity, $field_info, $field_instance, array(
$value,
));
$collection_entity->{$field_name} = $value;
}
}
}
$collection_entity
->save();
} catch (Exception $e) {
watchdog('crm_core_data_import', $e
->getMessage(), array(), WATCHDOG_ERROR);
}
}
}
}
/**
* Build field collection mapping.
*/
public function buildFieldCollectionMapping() {
if (!empty($this->collection_items)) {
$collection_items = $this->collection_items;
foreach ($collection_items as $collection_item) {
$collection_mapping = array();
foreach ($this->fields_mapping as $mapping_item) {
if (!empty($mapping_item['source_field']) && !empty($mapping_item['destination_field'])) {
$source_raw = explode(':', $mapping_item['source_field']);
$destination_raw = explode(':', $mapping_item['destination_field']);
$source = array(
'type' => !empty($source_raw[0]) ? $source_raw[0] : NULL,
'bundle' => !empty($source_raw[1]) ? $source_raw[1] : NULL,
'main_field' => !empty($source_raw[2]) ? $source_raw[2] : NULL,
'sub_field' => !empty($source_raw[3]) ? $source_raw[3] : NULL,
);
$destination = array(
'type' => $this
->getEntityType(),
'bundle' => $this
->getEntityBundle(),
'main_field' => !empty($destination_raw[0]) ? $destination_raw[0] : NULL,
'sub_field' => !empty($destination_raw[1]) ? $destination_raw[1] : NULL,
'part' => !empty($destination_raw[2]) ? $destination_raw[2] : NULL,
'default_value' => !empty($mapping_item['default_value']) ? $mapping_item['default_value'] : NULL,
);
if (!empty($destination['main_field']) && $destination['main_field'] == $collection_item) {
$collection_mapping[] = array(
'source' => $source,
'destination' => $destination,
);
if (!empty($source['main_field'])) {
$main_source_field = $source['type'] . ':' . $source['bundle'] . ':' . $source['main_field'];
}
}
}
}
if (!empty($collection_mapping) && !empty($main_source_field)) {
$this->collection_mapping[$collection_item] = array(
'mapping' => $collection_mapping,
'main_field' => $main_source_field,
);
}
}
}
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Migration:: |
protected | property | All field mappings, with those retrieved from the database overriding those defined in code. | |
Migration:: |
protected | property | Field mappings retrieved from storage. | |
Migration:: |
protected | property | An array of counts. Initially used for cache hit/miss tracking. | |
Migration:: |
protected | property | The default rollback action for this migration. Can be overridden on a per-row basis by setting $row->rollbackAction in prepareRow(). | |
Migration:: |
protected | property | Destination object for the migration, derived from MigrateDestination. | |
Migration:: |
protected | property | The object currently being constructed | |
Migration:: |
protected | property | If present, an array with keys name and alias (optional). Name refers to the source columns used for tracking highwater marks. alias is an optional table alias. | |
Migration:: |
protected | property | Map object tracking relationships between source and destination data | |
Migration:: |
public | property | Specify value of needs_update for current map row. Usually set by MigrateFieldHandler implementations. | |
Migration:: |
protected | property | Queue up messages that can't be safely saved (in particular, if they're generated in prepareRow(). | |
Migration:: |
public | property | The rollback action to be saved for the current row. | |
Migration:: |
protected | property | When performing a bulkRollback(), the maximum number of items to pass in a single call. Can be overridden in derived class constructor. | |
Migration:: |
protected | property | Source object for the migration, derived from MigrateSource. | |
Migration:: |
protected | property | The current data row retrieved from the source. | |
Migration:: |
protected | property | Field mappings defined in code. | |
Migration:: |
protected | property | ||
Migration:: |
protected | property | ||
Migration:: |
protected | property | ||
Migration:: |
public | function | Add a mapping for a destination field, specifying a source field and/or a default value. | 1 |
Migration:: |
public | function | Shortcut for adding several fields which have the same name on both source and destination sides. | |
Migration:: |
public | function | Shortcut for adding several destination fields which are to be explicitly not migrated. | |
Migration:: |
public | function | Shortcut for adding several source fields which are to be explicitly not migrated. | |
Migration:: |
public | function | Perform an analysis operation - report on field values in the source. | |
Migration:: |
protected | function | Apply field mappings to a data row received from the source, returning a populated destination object. | 1 |
Migration:: |
protected | function |
Override MigrationBase::beginProcess, to make sure the map/message tables
are present. Overrides MigrationBase:: |
|
Migration:: |
protected | function | Standard top-of-loop stuff, common between rollback and import - check for exceptional conditions, and display feedback. | |
Migration:: |
protected | function | If stub creation is enabled, try to create a stub and save the mapping. | |
Migration:: |
protected | function | Fetch the key array for the current source record. | |
Migration:: |
public static | function |
Deregister a migration - remove all traces of it from the database (without
touching any content which was created by this migration). Overrides MigrationBase:: |
|
Migration:: |
constant | |||
Migration:: |
public | function |
Override MigrationBase::endProcess, to call post hooks. Note that it must
be public to be callable as the shutdown function. Overrides MigrationBase:: |
|
Migration:: |
public | function | Get the number of source records which failed to import. TODO: Doesn't yet account for informationals, or multiple errors for a source record. | |
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
protected | function | For fields which require uniqueness, assign a new unique value if necessary. | |
Migration:: |
protected | function | Look up a value migrated in another migration. | |
Migration:: |
protected | function | Perform an import operation - migrate items from source to destination. | |
Migration:: |
public | function | Get the number of records successfully imported. | |
Migration:: |
public | function |
Reports whether this migration process is complete (i.e., all available
source rows have been processed). Overrides MigrationBase:: |
|
Migration:: |
protected | function | Test whether we've exceeded the designated item limit. | |
Migration:: |
public | function | Load any stored field mappings from the database. | |
Migration:: |
public | function | Get the number of messages associated with this migration | |
Migration:: |
protected | function | React when migration didn't failed but destination ids are empty. | |
Migration:: |
protected | function | React when there is an exception | |
Migration:: |
protected | function | React when there is a migrate exception | |
Migration:: |
protected | function | React when the migration has been successful. | |
Migration:: |
protected | function | ||
Migration:: |
protected | function | ||
Migration:: |
protected | function | Default implementations of pre/post import/rollback methods. These call the destination methods (if they exist) - when overriding, always call parent::preImport() etc. | |
Migration:: |
public | function | Default implementation of prepareKey. This method is called from the source plugin immediately after retrieving the raw data from the source - by default, it simply assigns the key values based on the field names passed to MigrateSQLMap(). Override… | |
Migration:: |
public | function | Prepares this migration to run as an update - that is, in addition to unmigrated content (source records not in the map table) being imported, previously-migrated content will also be updated in place. | |
Migration:: |
protected | function | ||
Migration:: |
public | function | Get the number of source records processed. | |
Migration:: |
protected | function | Outputs a progress message, reflecting the current status of a migration process. | |
Migration:: |
public | function | Queue messages to be later saved through the map class. | |
Migration:: |
public static | function |
Register a new migration process in the migrate_status table. This will
generally be used in two contexts - by the class detection code for
static (one instance per class) migrations, and by the module implementing
dynamic (parameterized class)… Overrides MigrationBase:: |
|
Migration:: |
public | function | Remove any existing coded mappings for a given destination or source field. | |
Migration:: |
protected | function | Perform a rollback operation - remove migrated items from the destination. | |
Migration:: |
public static | function | Record an array of field mappings to the database. | |
Migration:: |
public | function |
Pass messages through to the map class. Overrides MigrationBase:: |
|
Migration:: |
public | function | Save any messages we've queued up to the message table. | |
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | Set the specified row to be updated, if it exists. | |
Migration:: |
constant | Indicate whether the primary system of record for this migration is the source, or the destination (Drupal). In the source case, migration of an existing object will completely replace the Drupal object with data from the source side. In the… | ||
Migration:: |
public | function | Convenience function to return count of total source records | |
Migration:: |
public | function | Get the number of records marked as needing update. | |
MigrationBase:: |
protected | property | Arguments configuring a migration. | |
MigrationBase:: |
protected | property | A time limit in seconds appropriate to be used in a batch import. Defaults to 240. | |
MigrationBase:: |
protected static | property | Track the migration currently running, so handlers can easily determine it without having to pass a Migration object everywhere. | |
MigrationBase:: |
protected | property | List of other Migration classes which should be imported before this one. E.g., a comment migration class would typically have node and user migrations as dependencies. | |
MigrationBase:: |
protected | property | Detailed information describing the migration. | |
MigrationBase:: |
protected | property | Any module hooks which should be disabled during migration processes. | |
MigrationBase:: |
protected static | property | Name of a function for displaying feedback. It must take the message to display as its first argument, and a (string) message type as its second argument (see drush_log()). | |
MigrationBase:: |
protected static | property | ||
MigrationBase:: |
protected | property | Disabling a migration prevents it from running with --all, or individually without --force | |
MigrationBase:: |
protected | property | A migration group object, used to collect related migrations. | |
MigrationBase:: |
protected static | property | Have we already warned about obsolete constructor argumentss on this request? | |
MigrationBase:: |
protected | property | If provided, an URL for an issue tracking system containing :id where the issue number will go (e.g., 'http://example.com/project/ticket/:id'). | |
MigrationBase:: |
protected | property | Whether to maintain a history of migration processes in migrate_log | |
MigrationBase:: |
protected | property | Primary key of the current history record (inserted at the beginning of a process, to be updated at the end) | |
MigrationBase:: |
protected | property | The machine name of this Migration object, derived by removing the 'Migration' suffix from the class name. Used to construct default map/message table names, displayed in drush migrate-status, key to migrate_status table... | |
MigrationBase:: |
protected | property | An array to track 'mail_system' variable if disabled. | |
MigrationBase:: |
protected | property | The PHP memory_limit expressed in bytes. | |
MigrationBase:: |
protected | property | The fraction of the memory limit at which an operation will be interrupted. Can be overridden by a Migration subclass if one would like to push the envelope. Defaults to 85%. | |
MigrationBase:: |
protected | property | Save options passed to current operation | |
MigrationBase:: |
protected | property | If we set an error handler (during import), remember the previous one so it can be restored. | |
MigrationBase:: |
protected | property | Indicates that we are processing a rollback or import - used to avoid excess writes in endProcess() | |
MigrationBase:: |
protected static | property | Track whether or not we've already displayed an encryption warning | |
MigrationBase:: |
protected | property | When the current operation started. | |
MigrationBase:: |
protected | property | Are we importing, rolling back, or doing nothing? | |
MigrationBase:: |
protected | property | MigrateTeamMember objects representing people involved with this migration. | |
MigrationBase:: |
protected | property | The PHP max_execution_time. | |
MigrationBase:: |
protected | property | The fraction of the time limit at which an operation will be interrupted. Can be overridden by a Migration subclass if one would like to push the envelope. Defaults to 90%. | |
MigrationBase:: |
protected | property | Number of "items" processed in the current migration process (whatever that means for the type of process) | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public static | function | ||
MigrationBase:: |
public static | function | Decrypt an incoming value. | |
MigrationBase:: |
public static | function | Make sure any arguments we want to be decrypted get decrypted. | |
MigrationBase:: |
protected | function | Reports whether all (hard) dependencies have completed migration | |
MigrationBase:: |
public | function | Disables mail system to prevent emails from being sent during migrations. | |
MigrationBase:: |
public static | function | Output the given message appropriately (drush_print/drupal_set_message/etc.) | |
MigrationBase:: |
public static | function | Encrypt an incoming value. Detects for existence of the Drupal 'Encrypt' module. | |
MigrationBase:: |
public static | function | Make sure any arguments we want to be encrypted get encrypted. | |
MigrationBase:: |
public | function | Custom PHP error handler. TODO: Redundant with hook_watchdog? | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | Fetch the current highwater mark for updated content. | |
MigrationBase:: |
public static | function | Return the single instance of the given migration. | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | Retrieve the last time an import operation completed successfully. | |
MigrationBase:: |
public | function | Retrieve the last throughput for current Migration (items / minute). | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | Get human readable name for a message constant. | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | Check the current status of a migration. | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | Takes an Exception object and both saves and displays it, pulling additional information on the location triggering the exception. | |
MigrationBase:: |
public | function | Returns an array of the migration's dependencies that are incomplete. | |
MigrationBase:: |
public static | function | 1 | |
MigrationBase:: |
protected static | function | Given only a class name, derive a machine name (the class name with the "Migration" suffix, if any, removed). | |
MigrationBase:: |
protected | function | Test whether we've exceeded the desired memory threshold. If so, output a message. | |
MigrationBase:: |
constant | Message types to be passed to saveMessage() and saved in message tables. MESSAGE_INFORMATIONAL represents a condition that did not prevent the operation from succeeding - all others represent different severities of conditions resulting in a source… | ||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
public | function | Perform an operation during the import phase | |
MigrationBase:: |
public | function | Perform an operation during the rollback phase. | |
MigrationBase:: |
public | function | Reset the status of the migration to IDLE (to be used when the status gets stuck, e.g. if a process core-dumped) | |
MigrationBase:: |
public | function | Restores the original saved mail system for migrations that require it. | |
MigrationBase:: |
constant | Codes representing the result of a rollback or import process. | ||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
protected | function | Save the highwater mark for this migration (but not when using an idlist). | |
MigrationBase:: |
public | function | Saves the current mail system, or set a system default if there is none. | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | Set the PHP time limit. This method may be called from batch callbacks before calling the processImport method. | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public static | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public static | function | Initialize static members, before any class instances are created. | |
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | Codes representing the current status of a migration, and stored in the migrate_status table. | ||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
public | function | Signal that any current import or rollback process should end itself at the earliest opportunity | |
MigrationBase:: |
protected | function | Test whether we're approaching the PHP time limit. | |
MigrationBase:: |
protected | function | Test whether we've exceeded the designated time limit. | |
MigrationBase:: |
public static | function | Convert an incoming string (which may be a UNIX timestamp, or an arbitrarily-formatted date/time string) to a UNIX timestamp. | |
MigrationDataImport:: |
public | property | List of Field Collection fields. | |
MigrationDataImport:: |
public | property | Mapping for Field Collection fields. | |
MigrationDataImport:: |
public | property | Mapping of current migration | |
MigrationDataImport:: |
public | function | Helper to add field to mapping. | |
MigrationDataImport:: |
public | function | Attach FC item to host entity. | |
MigrationDataImport:: |
public | function | Build field collection mapping. | |
MigrationDataImport:: |
public | function | Complete callback for each item. | |
MigrationDataImport:: |
public | function |
Generate machine name. Data Import task and id with prefix. Overrides MigrationBase:: |
|
MigrationDataImport:: |
public | function | Returns entity delta. | |
MigrationDataImport:: |
public | function | Returns entity bundle. | |
MigrationDataImport:: |
public | function | Returns entity type. | |
MigrationDataImport:: |
public | function | Returns importer. | |
MigrationDataImport:: |
public | function | Returns main field name. | |
MigrationDataImport:: |
public | function | Return TRUE if conversion plugin is compatible with current source plugin. | |
MigrationDataImport:: |
public | function | Prepare entity before saving. | |
MigrationDataImport:: |
public | function | Prepare row for setting default values. | |
MigrationDataImport:: |
public | function |
This method is called from the source plugin upon first pulling the raw data from the source. Overrides Migration:: |
|
MigrationDataImport:: |
public | function | Check if we need skip field collection. | |
MigrationDataImport:: |
public | function | Check if we need skip references field. | |
MigrationDataImport:: |
public | function |
General initialization of a Migration object. Overrides Migration:: |