public function DrupalFile5Migration::__construct in Drupal-to-Drupal data migration 7.2
Required arguments:
source_connection - Connection key for the DatabaseConnection holding the source Drupal installation. source_version - Major version number (as an integer) of the source install. machine_name - Machine name under which a particular migration is registered. description - Description of the migration. group_name - The group (import job) containing this migration (import task).
Optional arguments:
source_database - Array describing the source connection, to be defined in the constructor. If absent, the source connection is assumed to be established elsewhere (typically settings.php). group - Migration group to add this migration to. dependencies - Array of migrations that must be run before this one. soft_dependencies - Array of migrations that should be listed before this one. format_mappings - Array keyed by source format IDs or machine names, with the values being the corresponding D7 machine name. If unspecified, source_options - Array to be passed as options to source constructors, overriding the defaults (map_joinable FALSE, cache_counts TRUE, cache_key derived from the machine name). version_class - The name of a custom DrupalVersion class overriding the default derived from source_version. new_only - For any destination types that support highwater marks or track_changes, suppress that support so repeated migrations only import new items.
Parameters
array $arguments:
Overrides DrupalFileMigration::__construct
1 call to DrupalFile5Migration::__construct()
- DrupalPicture5Migration::__construct in d5/
file.inc - Required arguments:
1 method overrides DrupalFile5Migration::__construct()
- DrupalPicture5Migration::__construct in d5/
file.inc - Required arguments:
File
- d5/
file.inc, line 10 - Implementation of DrupalFileMigration for Drupal 5 sources.
Class
- DrupalFile5Migration
- @file Implementation of DrupalFileMigration for Drupal 5 sources.
Code
public function __construct(array $arguments) {
parent::__construct($arguments);
$this
->addFieldMapping('value', 'filepath')
->callbacks(array(
$this,
'fixUri',
));
$this
->addFieldMapping('destination_file', 'filepath')
->callbacks(array(
$this,
'fixUri',
));
$this->legacyPath = unserialize(Database::getConnection('default', $this->sourceConnection)
->select('variable', 'v')
->fields('v', array(
'value',
))
->condition('name', 'file_directory_path')
->execute()
->fetchField());
// Strip ./ from the beginning
if (substr($this->legacyPath, 0, 2) == './') {
$this->legacyPath = substr($this->legacyPath, 2);
}
$this
->addUnmigratedDestinations(array(
'timestamp',
));
$this
->addUnmigratedSources(array(
'nid',
));
}