Closed (fixed)
Project:
Migrate
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Oct 2012 at 17:50 UTC
Updated:
1 Nov 2012 at 14:01 UTC
Hello,
While testing migration from phpBB to Drupal with the migrate and phpbb2drupal modules, I noticed the following:
This leaves the imported forum in an inconsistent state. I understand that migrate tries to correlate the entries with existing users in the DB, but what can be done about this so that the end result is as follows?
Data from old users is imported with their old user ID and treated as retained data from deleted users.
Thank you
Comments
Comment #1
mikeryanSorry, I don't understand that... Content authored by users that have been imported will be assigned to their account on the destination site. I.e., if user example1 (user ID 123 on the original site) authored a given piece of content, when they're migrated and get assigned Drupal uid 456, then the account with 456 will be the author of their content (assuming proper usage of sourceMigration(), of course). "retained data from deleted users" makes no sense to me - deleted users of course would not be imported, right?
Now, if there are users that don't get imported because they're deleted, and content that had been authored by them is still pointing at the non-existent account (e.g., an article author is uid 123, but that account was deleted and not imported), then the author by default ends up as Drupal uid 1 - but you can override that mapping and default unresolved authors to another Drupal account if you want.
Comment #2
marktheshark commentedLet me clarify my use case further:
I have a 10-year old forum to import. Some forum posts, topics and private messages belong to users that no longer exist.
The default logic of assigning this to User 1 since there is no prerequisite user for these items, doesn't work out very well because:
This is quite a blocking issue for my use case.
Could you advise how to override this and:
Thanks
Comment #3
mikeryanReally? You want posts to be authored by a non-existent account? Well, yes, you could create dummy users and then delete the rows from the users table, but there's too much stuff in Drupal and in contrib modules that depends on the database being self-consistent, you'll have a horrible mess on your hands if you break the data model like that.
If you really can't abide the admin or anonymous accounts as owners of orphaned content, then I would suggest creating a single dummy account, say with the username "Deleted User", and defaulting content ownership to that account.
Comment #4
marktheshark commentedWell, leaving ownership to the admin can be misleading (people may think the admin actually authored these posts, the content of which may be debateable, it is a public forum after all).
Having one fake user for this content is also a bit problematic, since it would accumulate all content and give the impression that there was a single old user responsible.
Logic similar to "Delete the account and make its content belong to the Anonymous user." from the account settings would be viable I guess, or "Disable the account and keep its content."
The problem with disabling the account is that all users are imported as blocked, so I cannot distinguish old from new.
P.S. When I mean deleting user, I don't mean from the DB directly. But I guess the schema precludes this from happening, thus the user must either be blocked, or the Anonymous user must be used.
Comment #5
mikeryanThat username for the dummy account could be as helpful as you like (well, up to 60 characters) - e.g., "The account authoring this post has been deleted".
Anyway, you just have to override the uid mapping in your node migrations to change the default value:
That's to get anonymous ownership - alternatively, you could pass the uid of a dummy account.
Comment #6
marktheshark commentedThanks, I guess I'll go for the Anonymous User approach for simplicity.
Comment #7
mikeryanComment #8.0
(not verified) commentedmarkup