Hi,
I have a serious problem migrating D6 content type with file (video) into my new D7.
read a lot of things but not found any solution. Trying to explain it here, forgive my bad english :)
Because of legacy D6 content type have a video field (video module) ; I have installed video module content in my D7.
First
I make a Files migration class to migrate Fields separately.
This migration class is registered like that :
...
$this->current_args = array(
'class_name' => 'MyMigrateFile',
'machine_name' => 'Fichiers',
'description' => '',
'default_uid' => 1,
'source_dir' => 'public://',
'destination_dir' => 'public://',
'preserve_files' => true,
'user_migration' => 'MyUsers',
);
...
Migration::registerMigration($this->current_args['class_name'], $this->current_args['machine_name'], $this->current_args);
...
Class is :
class MyMigrateFile extends DrupalFile6Migration {
public function __construct(array $arguments) {
parent::__construct($arguments);
$this->addUnmigratedSources(array('origname'));
$this->addFieldMapping('path')->defaultValue(false);
$this->addFieldMapping('urlencode')->defaultValue(true);
$this->addFieldMapping('preserve_files')->defaultValue(true);
}
...
}
This migration can run / rollback without error, all is ok.
Then
I want to migrate my video based content type so I create my custom class
class MyMigrateNodeVideo extends DrupalNode6Migration {
public function __construct(array $arguments) {
parent::__construct($arguments);
$useless_fields = array(
...
);
$this->addUnmigratedSources($useless_fields);
...
$this->addFieldMapping('field_video', 'field_video_contenu')->sourceMigration('Fichiers');
$this->addFieldMapping('field_video:file_class')->defaultValue('MigrateFileFid');
$this->addFieldMapping('field_video:preserve_files')->defaultValue(TRUE);
$this->addFieldMapping('field_video:thumbnail')->description('cf complete()');
...
}
}
This migration run fine, file rows are created in file_usage
, and I can see video into my new content.
But when I rollback this migration, file_usage
row are deleted too.
At the consequence, when I migrate again, I supposed new file ID is not found by migrate so the file is not "created" or "linked" to the node, and file_usage
stay empty
Why "file_preserve
" not working in this case ?
Need help, very appreciate :)
Thanks.
Note I use Migrate 2.6 and Migrate D2D together, and dynamics migrations.
Read that https://drupal.org/node/1061560 without success
Comments
Comment #1
rroblik CreditAttribution: rroblik commentedComment #2
rroblik CreditAttribution: rroblik commentedComment #3
rroblik CreditAttribution: rroblik commentedComment #4
rroblik CreditAttribution: rroblik commentedComment #5
mikeryanAre you sure you were using 7.x-2.6-rc1? This should have been fixed in #1989012: preserve_files = TRUE but files deleted on rollback , which was committed in May before rc1 was released in June...
Comment #6
mikeryan