如何使用Drupal 7将这些错误修复为Drupal 8 Migration

时间:2018-03-03 21:53:50

标签: drupal drupal-8

我有一个客户需要/想要将他们的Drupal 7站点升级到Drupal 8.该站点有超过50,000篇文章,大部分内容都是使用原文"文章"节点/内容类型...但该原始节点已被自定义为包含更多字段。客户希望我为新网站功能创建另一种自定义内容类型,但在开始处理新功能之前,我更愿意将网站升级到Drupal 8,因此我不必经历将来会有更多的移民麻烦。

我已阅读从此页开始的所有Drupal 6/7到8个迁移文档:https://www.drupal.org/docs/8/upgrade/upgrading-from-drupal-6-or-7-to-drupal-8

我已经尝试使用迁移工具,根据这个记录使用webui版本和drush版本。两种方法似乎都使用相同的迁移代码,因为两种方法都会产生相同的错误(见下文):

首先,这是" drush migrate-status"给我们:

serverpilot@XXX.XXX.XXX.XXX:~/apps/therooster-d8/public$ drush migrate-status
 Group: Import from Drupal 7 (migrate_drupal_7)  Status  Total  Imported  Unprocessed  Last imported
 upgrade_action_settings                         Idle    0      0         0
 upgrade_block_content_type                      Idle    1      0         1
 upgrade_d7_action                               Idle    15     0         15
 upgrade_d7_aggregator_settings                  Idle    0      0         0
 upgrade_d7_dblog_settings                       Idle    1      0         1
 upgrade_d7_file_private                         Idle    0      0         0
 upgrade_d7_filter_settings                      Idle    1      0         1
 upgrade_d7_global_theme_settings                Idle    1      0         1
 upgrade_d7_image_settings                       Idle    0      0         0
 upgrade_d7_image_styles                         Idle    13     0         13
 upgrade_d7_node_settings                        Idle    1      0         1
 upgrade_d7_search_settings                      Idle    0      0         0
 upgrade_d7_system_authorize                     Idle    0      0         0
 upgrade_d7_system_cron                          Idle    0      0         0
 upgrade_d7_system_date                          Idle    1      0         1
 upgrade_d7_system_file                          Idle    1      0         1
 upgrade_d7_system_mail                          Idle    0      0         0
 upgrade_d7_system_performance                   Idle    1      0         1
 upgrade_d7_theme_settings                       Idle    2      0         2
 upgrade_d7_tracker_settings                     Idle    0      0         0
 upgrade_d7_url_alias                            Idle    10890  0         10890
 upgrade_d7_user_flood                           Idle    0      0         0
 upgrade_d7_user_mail                            Idle    1      0         1
 upgrade_file_settings                           Idle    0      0         0
 upgrade_menu_settings                           Idle    0      0         0
 upgrade_search_page                             Idle    0      0         0
 upgrade_statistics_settings                     Idle    1      0         1
 upgrade_system_image                            Idle    1      0         1
 upgrade_system_image_gd                         Idle    1      0         1
 upgrade_system_logging                          Idle    1      0         1
 upgrade_system_maintenance                      Idle    0      0         0
 upgrade_system_rss                              Idle    0      0         0
 upgrade_system_site                             Idle    1      0         1
 upgrade_taxonomy_settings                       Idle    0      0         0
 upgrade_text_settings                           Idle    0      0         0
 upgrade_update_settings                         Idle    1      0         1
 upgrade_block_content_body_field                Idle    1      0         1
 upgrade_block_content_entity_display            Idle    1      0         1
 upgrade_block_content_entity_form_display       Idle    1      0         1
 upgrade_d7_filter_format                        Idle    5      0         5
 upgrade_d7_custom_block                         Idle    10     0         10
 upgrade_d7_user_role                            Idle    6      0         6
 upgrade_d7_block                                Idle    345    0         345
 upgrade_d7_field                                Idle    46     0         46
 upgrade_d7_node_type                            Idle    10     0         10
 upgrade_d7_comment_type                         Idle    10     0         10
 upgrade_d7_taxonomy_vocabulary                  Idle    3      0         3
 upgrade_d7_field_instance                       Idle    64     0         64
 upgrade_d7_file                                 Idle    50826  0         50826
 upgrade_user_picture_field                      Idle    1      0         1
 upgrade_user_picture_field_instance             Idle    1      0         1
 upgrade_user_picture_entity_display             Idle    1      0         1
 upgrade_user_picture_entity_form_display        Idle    1      0         1
 upgrade_d7_user                                 Idle    107    0         107
 upgrade_d7_comment_field                        Idle    10     0         10
 upgrade_d7_comment_field_instance               Idle    10     0         10
 upgrade_d7_node_ad                              Idle    204    0         204
 upgrade_d7_node_article                         Idle    9933   0         9933
 upgrade_d7_node_background_ad                   Idle    1      0         1
 upgrade_d7_node_establishment                   Idle    391    0         391
 upgrade_d7_node_green_guide                     Idle    6      0         6
 upgrade_d7_node_happy_hour                      Idle    176    0         176
 upgrade_d7_node_homepage_config                 Idle    2      0         2
 upgrade_d7_node_page                            Idle    7      0         7
 upgrade_d7_node_sidebar_config                  Idle    1      0         1
 upgrade_d7_node_webform                         Idle    1      0         1
 upgrade_d7_comment                              Idle    0      0         0
 upgrade_d7_comment_entity_display               Idle    10     0         10
 upgrade_d7_comment_entity_form_display          Idle    10     0         10
 upgrade_d7_comment_entity_form_display_subject  Idle    10     0         10
 upgrade_d7_view_modes                           Idle    5      0         5
 upgrade_d7_field_formatter_settings             Idle    97     0         97
 upgrade_d7_field_instance_widget_settings       Idle    64     0         64
 upgrade_d7_google_analytics_settings            Idle    1      0         1
 upgrade_d7_google_analytics_user_settings       Idle    107    0         107
 upgrade_d7_menu                                 Idle    7      0         7
 upgrade_d7_menu_links                           Idle    88     0         88
 upgrade_d7_node_revision_ad                     Idle    0      0         0
 upgrade_d7_node_revision_article                Idle    0      0         0
 upgrade_d7_node_revision_background_ad          Idle    0      0         0
 upgrade_d7_node_revision_establishment          Idle    0      0         0
 upgrade_d7_node_revision_green_guide            Idle    0      0         0
 upgrade_d7_node_revision_happy_hour             Idle    0      0         0
 upgrade_d7_node_revision_homepage_config        Idle    0      0         0
 upgrade_d7_node_revision_page                   Idle    0      0         0
 upgrade_d7_node_revision_sidebar_config         Idle    0      0         0
 upgrade_d7_node_revision_webform                Idle    0      0         0
 upgrade_d7_node_title_label                     Idle    10     0         10
 upgrade_d7_shortcut_set                         Idle    1      0         1
 upgrade_d7_shortcut                             Idle    4      0         4
 upgrade_d7_shortcut_set_users                   Idle    0      0         0
 upgrade_d7_taxonomy_term_category               Idle    56     0         56
 upgrade_d7_taxonomy_term_tags                   Idle    0      0         0
 upgrade_d7_taxonomy_term_vicinity               Idle    12     0         12
 Group: Beer Imports (beer)                      Status  Total  Imported  Unprocessed  Last imported
 beer_term                                       Idle    3      0         3
 beer_user                                       Idle    4      0         4
 beer_node                                       Idle    3      0         3
 beer_comment                                    Idle    5      0         5
 Group: Wine Imports (wine)                      Status  Total  Imported  Unprocessed  Last imported
 weather_soap                                    Idle    50     0         50
 wine_role_json                                  Idle    2      0         2
 wine_role_xml                                   Idle    2      0         2
 wine_terms                                      Idle    23     0         23
 wine_variety_multi_xml                          Idle    4      0         4
 Group: Default (default)                        Status  Total  Imported  Unprocessed  Last imported
 block_content_type                              Idle    1      1         0
 block_content_body_field                        Idle    1      1         0
 block_content_entity_display                    Idle    1      1         0
 block_content_entity_form_display               Idle    1      1         0
 user_picture_field                              Idle    1      0         1
 d6_upload_field                                 Idle    1      0         1

当我执行" drush migrate-import --all"时会发生这种情况:

serverpilot@XXX.XXX.XXX.XXX:~/apps/therooster-d8/public$ drush migrate-import --all
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_action_settings'           [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_block_content_type'        [status]
    The "pathauto_node_update_action" plugin does not exist.                                                     [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php:52)
    The "pathauto_taxonomy_term_update_action" plugin does not exist.                                            [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php:52)
    The "pathauto_user_update_action" plugin does not exist.                                                     [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php:52)
    Processed 15 items (11 created, 0 updated, 3 failed, 1 ignored) - done with 'upgrade_d7_action'              [status]
    upgrade_d7_action Migration - 3 failed.                                                                      [error]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_aggregator_settings'    [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_dblog_settings'         [status]
    Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_file_private'          [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_filter_settings'        [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_global_theme_settings'  [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_image_settings'         [status]
    Processed 13 items (13 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_image_styles'        [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_node_settings'          [status]
    Processed 1 item (0 created, 0 updated, 0 failed, 1 ignored) - done with 'upgrade_d7_search_settings'        [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_system_authorize'       [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_system_cron'            [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_system_date'            [status]
    Processed 1 item (0 created, 0 updated, 0 failed, 1 ignored) - done with 'upgrade_d7_system_file'            [status]
    Processed 1 item (0 created, 0 updated, 0 failed, 1 ignored) - done with 'upgrade_d7_system_mail'            [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_system_performance'     [status]
    Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_theme_settings'        [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_tracker_settings'       [status]
    Processed 10890 items (10890 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_url_alias'     [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_user_flood'             [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_user_mail'              [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_file_settings'             [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_menu_settings'             [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_search_page'               [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_statistics_settings'       [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_system_image'              [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_system_image_gd'           [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_system_logging'            [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_system_maintenance'        [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_system_rss'                [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_system_site'               [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_taxonomy_settings'         [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_text_settings'             [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_update_settings'           [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_block_content_body_field'  [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with                                     [status]
    'upgrade_block_content_entity_display'
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with                                     [status]
    'upgrade_block_content_entity_form_display'
    Missing filter plugin: filter_null.                                                                          [error]
    Processed 5 items (5 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_filter_format'         [status]
    Processed 10 items (10 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_custom_block'        [status]
    Processed 6 items (6 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_user_role'             [status]
    Processed 345 items (38 created, 0 updated, 0 failed, 307 ignored) - done with 'upgrade_d7_block'            [status]
    Attempt to create a field storage field_establishment with no type.                                          [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/modules/field/src/Entity/FieldStorageConfig.php:252)
    Attempt to create a field storage field_daily_menu with no type.                                             [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/modules/field/src/Entity/FieldStorageConfig.php:252)
    Attempt to create a field storage field_articles with no type.                                               [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/modules/field/src/Entity/FieldStorageConfig.php:252)
    Attempt to create a field storage field_articles with no type.                                               [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/modules/field/src/Entity/FieldStorageConfig.php:252)
    Attempt to create a field storage field_trending_articles with no type.                                      [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/modules/field/src/Entity/FieldStorageConfig.php:252)
    Processed 46 items (41 created, 0 updated, 5 failed, 0 ignored) - done with 'upgrade_d7_field'               [status]
    upgrade_d7_field Migration - 5 failed.                                                                       [error]
    Processed 10 items (10 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_node_type'           [status]
    Processed 10 items (10 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_comment_type'        [status]
    Processed 3 items (3 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_taxonomy_vocabulary'   [status]
    Attempt to create a field field_establishment that does not exist on entity type node.                       [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/modules/field/src/Entity/FieldConfig.php:293)
    Attempt to create a field field_daily_menu that does not exist on entity type node.                          [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/modules/field/src/Entity/FieldConfig.php:293)
    Attempt to create a field field_articles that does not exist on entity type node.                            [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/modules/field/src/Entity/FieldConfig.php:293)
    Attempt to create a field field_articles that does not exist on entity type node.                            [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/modules/field/src/Entity/FieldConfig.php:293)
    Attempt to create a field field_articles that does not exist on entity type taxonomy_term.                   [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/modules/field/src/Entity/FieldConfig.php:293)
    Attempt to create a field field_trending_articles that does not exist on entity type node.                   [error]
    (/srv/users/serverpilot/apps/therooster-d8/public/core/modules/field/src/Entity/FieldConfig.php:293)
    Processed 64 items (58 created, 0 updated, 6 failed, 0 ignored) - done with 'upgrade_d7_field_instance'      [status]
    upgrade_d7_field_instance Migration - 6 failed.                                                              [error]
    Processed 50826 items (50817 created, 0 updated, 9 failed, 0 ignored) - done with 'upgrade_d7_file'          [status]
    upgrade_d7_file Migration - 9 failed.                                                                        [error]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with 'upgrade_user_picture_field'        [status]
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with                                     [status]
    'upgrade_user_picture_field_instance'
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with                                     [status]
    'upgrade_user_picture_entity_display'
    Processed 1 item (1 created, 0 updated, 0 failed, 0 ignored) - done with                                     [status]
    'upgrade_user_picture_entity_form_display'
    InvalidArgumentException: Passed variable is not an array or object in                                       [error]
    /srv/users/serverpilot/apps/therooster-d8/public/core/modules/migrate/src/Plugin/migrate/process/Flatten.php:52
    Stack trace:
    #0
    /srv/users/serverpilot/apps/therooster-d8/public/core/modules/migrate/src/Plugin/migrate/process/Flatten.php(52):
    ArrayIterator->__construct(NULL)
    #1 /srv/users/serverpilot/apps/therooster-d8/public/core/modules/migrate/src/MigrateExecutable.php(380):
    Drupal\migrate\Plugin\migrate\process\Flatten->transform(NULL,
    Object(Drupal\migrate_tools\MigrateExecutable), Object(Drupal\migrate\Row), 'permissions')
    #2
    /srv/users/serverpilot/apps/therooster-d8/public/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php(223):
    Drupal\migrate\MigrateExecutable->processRow(Object(Drupal\migrate\Row), Array)
    #3 /srv/users/serverpilot/apps/therooster-d8/public/core/modules/migrate/src/MigrateExecutable.php(366):
    Drupal\migrate\Plugin\migrate\process\MigrationLookup->transform(Array,
    Object(Drupal\migrate_tools\MigrateExecutable), Object(Drupal\migrate\Row), 'roles')
    #4 /srv/users/serverpilot/apps/therooster-d8/public/core/modules/migrate/src/MigrateExecutable.php(203):
    Drupal\migrate\MigrateExecutable->processRow(Object(Drupal\migrate\Row))
    #5 /srv/users/serverpilot/apps/therooster-d8/vendor/drush/drush/includes/drush.inc(721):
    Drupal\migrate\MigrateExecutable->import()
    #6 /srv/users/serverpilot/apps/therooster-d8/vendor/drush/drush/includes/drush.inc(712):
    drush_call_user_func_array(Array, Array)
    #7
    /srv/users/serverpilot/apps/therooster-d8/public/modules/contrib/migrate_tools/migrate_tools.drush.inc(303):
    drush_op(Array)
    #8 [internal function]: _drush_migrate_tools_execute_migration(Object(Drupal\user\Plugin\migrate\User),
    'upgrade_d7_user', Array)
    #9
    /srv/users/serverpilot/apps/therooster-d8/public/modules/contrib/migrate_tools/migrate_tools.drush.inc(267):
    array_walk(Array, '_drush_migrate_...', Array)
    #10 /srv/users/serverpilot/apps/therooster-d8/vendor/drush/drush/includes/command.inc(422):
    drush_migrate_tools_migrate_import()
    #11 /srv/users/serverpilot/apps/therooster-d8/vendor/drush/drush/includes/command.inc(231):
    _drush_invoke_hooks(Array, Array)
    #12 /srv/users/serverpilot/apps/therooster-d8/vendor/drush/drush/includes/command.inc(199): drush_command()
    #13 /srv/users/serverpilot/apps/therooster-d8/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67):
    drush_dispatch(Array)
    #14 /srv/users/serverpilot/apps/therooster-d8/vendor/drush/drush/includes/preflight.inc(66):
    Drush\Boot\BaseBoot->bootstrap_and_dispatch()
    #15 /srv/users/serverpilot/apps/therooster-d8/vendor/drush/drush/drush.php(12): drush_main()
    #16 {main}

基本上,近10K的文章不会迁移过来。这主要是我需要的。我已经尝试匹配并启用我可以匹配的所有模块,从Drupal 7到8 ......但也许我错过了训练有素的眼睛能够从上面的错误中看到的东西?非常感谢您的帮助。谢谢

2 个答案:

答案 0 :(得分:0)

我建议逐渐进行,而不是像drush命令所指示的那样。 通过使用drush,首先使用开关进行配置[drush ..... - 仅配置] 这将在目标站点/ dB(包括文章)处创建所需的配置。

您还可以使用清单文件开关执行除问题部分之外的所有操作(请参阅上面链接中有关带有drush的清单文件的文档)。

<强>更新: 安装与drush集成的features模块并导出/导入Articles内容类型。然后使用备份和迁移尝试内容迁移。 D7 https://www.drupal.org/docs/7/contrib/features/features-drush

D8 https://www.drupal.org/docs/8/modules/features

答案 1 :(得分:0)

我不喜欢成为坏消息的承载者,但根据我的经验,没有一键式自动解决方案可以升级并从D7迁移到D8。

如果您在D8中重建网站并使用Migrate API执行迁移,那么您最终将获得更稳定的产品 - 并且最有可能节省时间和成本。