- 🇺🇸United States hongpong Philadelphia
still getting stuff like this
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'themereviewteam-en' for key 'user__name': INSERT INTO "users_field_data" ("uid", "langcode", "preferred_langcode", "preferred_admin_langcode", "name", "pass", "mail", "timezone", "status", "created", "changed", "access", "login", "init", "default_langcode") VALUES (: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, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14); Array ( [:db_insert_placeholder_0] => 6 [:db_insert_placeholder_1] => en [:db_insert_placeholder_2] => en [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => themereviewteam [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => themereviewteam@gmail.com [:db_insert_placeholder_7] => America/New_York [:db_insert_placeholder_8] => 1 [:db_insert_placeholder_9] => 1732512346 [:db_insert_placeholder_10] => 1732512346 [:db_insert_placeholder_11] => 0 [:db_insert_placeholder_12] => 0 [:db_insert_placeholder_13] => [:db_insert_placeholder_14] => 1 ) (/var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:817)
- First commit to issue fork.
- First commit to issue fork.
- 🇳🇮Nicaragua dinarcon
Ok, got my commits and branches a bit messed up, but I think I finally sorted things out...
I tested @baltowen commit (after rebasing the branch against
8.x-3.x
) and the error is gone. For this, I used thewp-import-5-loremipsum-2024-11-25.xml
file in https://gitlab.com/HongPong/wordpress-test-imports While MR #30 technically fixes the issue, I think we should go with a slightly different approach.MR #30 will allow overwriting users based on their usernames. That could lead to account take over or at regain access that had been revoked.
The
wordpress_authors.yml
migration uses the email based on the XWR file. If a matching username is found, the email will be changed and someone else can get access to the site via a password reset link. Also, the migration sets thestatus
to1
always which means the user is active. A user that had been blocked would have their account reactivated if that username is present in the XWR file.I propose we do not allow overwriting existing accounts. In MR #31 I expand on @baltowen's commit to add a safety check to prevent user accounts from being overwritten.
By the way, I included a message to indicating that is is not allowed to overwrite user accounts. For some reasons, those messages are lost when running the migration from the UI. When doing it from Drush, the messages are preserved. This is unrelated to the issue being discussed here. Still I wanted to point it out in case someone looks for the messages and does not find them.
- 🇺🇸United States hongpong Philadelphia
I was able to get one 'updating existing users is not allowed' message to print by running the loremipsum XML twice. it ignores all of them but it only gives one message, in my case at
/admin/structure/migrate/manage/my_wordpress7lorem/migrations/my_7loremwordpress_authors/messages
under the 'messages' tab for authors.ollie.medhurst Informational my_7loremwordpress_authors:_skip_existing_user: Updating existing users is not allowed.
I think we can commit this for now and make note that, the authors skipped, do not each generate a message.
-
hongpong →
committed 270c29de on 8.x-3.x authored by
dinarcon →
Issue #3123393: Users are duplicated (Integrity constraint violation)...
-
hongpong →
committed 270c29de on 8.x-3.x authored by
dinarcon →
- 🇺🇸United States hongpong Philadelphia
Thank you everyone, another nasty bug squashed. baltowen, dinarcon, lobodakyrylo, uridrupal, splash112!!
Automatically closed - issue fixed for 2 weeks with no activity.