I tried migrating Users and User Profiles data from a real-world D6 DB using the manifest file on https://drupal.org/node/2224001 and received the following error:

~/Sites/imp $  drush migrate-manifest mysql://imp@localhost/canvas6 manifest.yml
strpos() expects parameter 1 to be string, array given               [warning]
MigrationStorageController.php:30
substr() expects parameter 1 to be string, array given               [warning]
MigrationStorageController.php:31
substr() expects parameter 1 to be string, array given               [warning]
MigrationStorageController.php:34
array_flip(): Can only flip STRING and INTEGER values!               [warning]
MigrationStorageController.php:47
array_flip(): Can only flip STRING and INTEGER values!               [warning]
ConfigStorageController.php:112
Fatal error: Call to a member function getLoadPlugin() on a non-object in /Users/michael/Sites/imp/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/MigrationStorageController.php on line 73
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: Call to a member function getLoadPlugin() on a non-object in
/Users/michael/Sites/imp/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/MigrationStorageController.php,
line 73

-mike

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ultimike’s picture

ultimike’s picture

Spoke with Benjy on IRC this morning, he suggests removing - d6_user_picture_file: false from the manifest and trying again.

Also - to get profile fields, add the following migrations:

- d6_profile_values
- d6_user_profile_field
- d6_user_picture_field
- d6_user_picture_field_instance

-mike

benjy’s picture

I actually meant just remove the : false part.

Also, as we discussed if you want to bring field data across you'll also need:


- d6_user_profile_field
- d6_user_profile_field_instance
- d6_user_picture_field
- d6_user_picture_field_instance
- d6_profile_values

ultimike’s picture

Using the updated manifest (https://drupal.org/comment/8619757#comment-8619757), I'm getting better results now using a real-world D6 DB...

1. Roles are being migrated.

2. Permissions associated with the migrated roles and enabled D8 modules are being properly set (I didn't go through every single permission, but all the spot checks I did looked good).

3. Profile fields were migrated with the exception of fields of type "url" (link). The source D6 DB has 6 profile fields: 3 urls, 2 text fields, and 1 textarea. Errors reported:

Attempt to create a field of unknown type <em                     [error]
class="placeholder">link</em>.
(/Users/michael/Sites/imp/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php:323)

4. I don't see profile categories in D8, I'm assuming they don't exist?

5. Profile data is not being migrated.

6. Usernames, email addresses, status, assigned roles, member since, and last access data appears to be migrated just fine.

7. Received a large number of errors like this (looks like the source query returned a bunch of bogus records?):

WD user: Drupal\Core\Database\IntegrityConstraintViolationException: [error]
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
'' for key 'name': INSERT INTO {users} (mail, signature,
signature_format, init, uid, uuid, name, langcode, pass, created,
access, login, status, timezone, preferred_langcode,
preferred_admin_langcode) VALUES (default, default, default, default,
:db_insert_placeholder_0, :db_insert_placeholder_1,
:db_insert_placeholder_2, :db_insert_placeholder_3,
:db_insert_placeholder_4, :db_insert_placeholder_5,
:db_insert_placeholder_6, :db_insert_placeholder_7,
:db_insert_placeholder_8, :db_insert_placeholder_9,
:db_insert_placeholder_10, :db_insert_placeholder_11); Array
(
    [:db_insert_placeholder_0] => 1823
    [:db_insert_placeholder_1] =>
9c8b3330-1d09-43ac-9963-99a06b4ad786
    [:db_insert_placeholder_2] => 
    [:db_insert_placeholder_3] => und
    [:db_insert_placeholder_4] =>
$S$EncYjGfqFNPycvLR4kLWF3xUQaYqb.Ort.NbEr3vW1boD75y6bCl
    [:db_insert_placeholder_5] => 1395871436
    [:db_insert_placeholder_6] => 0
    [:db_insert_placeholder_7] => 0
    [:db_insert_placeholder_8] => 1
    [:db_insert_placeholder_9] => Europe/Berlin
    [:db_insert_placeholder_10] => und
    [:db_insert_placeholder_11] => und
)
 in Drupal\Core\Database\Connection->query() (line 566 of
/Users/michael/Sites/imp/core/lib/Drupal/Core/Database/Connection.php).

8. None of the user pictures migrated over. Received a bunch of errors like this:

filesize(): stat failed for public://files/pictures/picture-42.gif   [warning]
File.php:205

and then

The specified file files/pictures/picture-42.gif could not be copied [error]
because no file by that name exists. Please check that you supplied
the correct filename.

It this looking for photos on the source or destination? Should I be copying files over to the destination prior to running the migration?

Thanks,
-mike

Anonymous’s picture

I'm also having trouble running the d6_user migration. I have tried updating the definition of d6_user so that it does not require profile-related or picture-related items, but the result is the same. I usually get "does not meet requirements". I tried cache-rebuild and also fresh install, same result.

ultimike’s picture

I re-ran this using a simplified source database and the most recent imp 8.x codebase.

On the source D6 site:

Started with a fresh site.
Enabled core Profile module.
Created a new "name" (single-line textfield) profile field.
Populated the profile field for the admin (UID=1) user.

On the D8 site:

Started with a fresh site.
Enabled migrate_drupal module.
Used manifest from https://drupal.org/node/2224001#comment-8619757

When I ran the migration via the command line:

I didn't receive any errors on the command line.
The field and settings appeared to have migrated properly.
The value of the "name" profile field was not migrated.

Once we get this case working, I'll go ahead and start adding more user-y type stuff (more users, roles, different types of profile fields).

-mike

Mixologic’s picture

Not sure if this should be a new issue or not, but I wanted to mention a use case that I ran into with user imports that was *really* tricky.

The node_profile module was on the site I was importing, and there was a profile picture image field on the node profile.

Anyhow, it introduced a weird set of chicken/egg scenarios because the user entity I was importing to was a requirement for the file imports.

So perhaps add node_profile with attached files mapping to the user_entity as a potential complex, yet not entirely uncommon use case.

chx’s picture

Not sure what's happening but removing a :false can't make a failing migration into a passing one but you can't remove :false here because it's possible there are 0 users with pictures.

chx’s picture

Having a DB dump would make it easier to debug this. In fact, if you can make a dump based on the dump database script (I usually use the script shipped with D7 and add an if ($table != 'mytable') continue to the loop to only dump a single table) then you can even make a failing test case. From there the fix is easy.

ultimike’s picture

Project: IMP » Drupal core
Version: » 8.x-dev
Component: Miscellaneous » migration system
Status: Active » Needs work
FileSize
2.64 KB

It looks like that when "signature support" is disabled on the D6 site, then the "signature_format" of users is set to zero. This causes the D6->D8 migration to fail.

I went ahead and updated the Drupal6User.php dump with a new user record that has a signature_format of 0. Patch attached.

-mike

ultimike’s picture

FileSize
4.88 KB

Made some additional progress on this. I added the static_map and skip_process_on_empty process plugins to the signature_format field in d6_user.yml and got our new test to pass.

The addition of the plugins sets the signature_format value to NULL in D8 when the D6 source value is 0.

There's still an issue though, as with my simple D6 real-ish DB test case, profile values aren't being migrated. Looking into that next...

Thanks,
-mike

ultimike’s picture

Status: Needs work » Needs review

My profile value issue was related to my test manifest (see https://drupal.org/node/2224001#comment-8751825), not any code issue. I think the patch in 11 is ready for review.

Thanks,
-mike

chx’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
5.02 KB
757 bytes

Good to go , very good to go! I added a little comments, thanks much.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Nice catch!

Committed and pushed to 8.x. Thanks!

  • Commit 1e2bfb8 on 8.x by webchick:
    Issue #2225959 by chx, ultimike: D6 Users and User Profile data isn't...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.