Pimcore从V10升级到V11的完整指南

Pimcore从V10升级到V11的完整指南

pimcore Open Source Data & Experience Management Platform (PIM, MDM, CDP, DAM, DXP/CMS & Digital Commerce) pimcore 项目地址: https://gitcode.com/gh_mirrors/pi/pimcore

前言

Pimcore作为一款强大的开源数字体验平台,其版本迭代带来了诸多改进和新特性。本文将详细介绍如何从Pimcore 10.x版本平滑升级到11.x版本,帮助开发者规避升级过程中的常见问题。

升级前的准备工作

系统设置迁移

Pimcore 11采用了LocationAwareConfigRepository来管理系统设置,这带来了更灵活的配置管理方式。在升级前需要完成以下操作:

  1. 数据库字段类型调整

    • json_array类型字段改为json类型
    • 使用以下命令检查需要修改的字段:
      mysqldump -u <用户名> -p <密码> --no-data <数据库名> | grep -i json_array
      
  2. 外观与品牌设置分离

    • var/config/system.yaml中的相关设置迁移到var/config/admin_system_settings/admin_system_settings.yaml
    • 配置示例如下:
      pimcore_admin:
          config_location:
              admin_system_settings:
                  write_target:
                      type: 'settings-store'
                  read_target:
                      type: 'settings-store'
      
  3. 系统设置迁移

    • 将剩余系统设置迁移到var/config/system_settings/system_settings.yaml
    • 配置示例如下:
      pimcore:
          config_location:
              system_settings:
                  write_target:
                      type: 'settings-store'
                  read_target:
                      type: 'settings-store'
      

功能模块配置处理

Pimcore 11将部分功能拆分为独立模块,需要特别注意:

  1. Web2Print功能

    • 如果使用该功能,确保启用"在默认文档视图中显示Web2Print文档"选项
    • 不使用则建议关闭该选项
  2. 富文本编辑器安全配置

    • 更新HTML标签白名单配置,确保所需标签和属性被允许
  3. Redis缓存配置

    • 更新缓存配置以适应新版本:
      framework:
          cache:
              pools:
                  pimcore.cache.pool:
                      public: true 
                      default_lifetime: 31536000
                      adapter: cache.adapter.redis_tag_aware
      

执行升级操作

通过Composer升级核心

执行以下命令进行核心升级:

composer require -W pimcore/pimcore:^11.0 pimcore/admin-ui-classic-bundle

注意:根据项目实际情况,可能需要添加额外的依赖项或清理composer.lockvendor目录。

升级后的必要操作

核心配置更新

  1. 注册Admin Bundle

    • src/Kernel.php中添加:
      $collection->addBundle(new \Pimcore\Bundle\AdminBundle\PimcoreAdminBundle(), 60);
      
  2. 安全配置更新

    • 按照最新格式更新config/packages/security.yaml
  3. 路径引用更新

    • @PimcoreCoreBundle/Resources/config/...更新为@PimcoreCoreBundle/config/...
    • 注意将routing.yml改为routing.yaml

功能模块安装与配置

  1. 安装可选模块

    composer require pimcore/system-info-bundle pimcore/file-explorer-bundle pimcore/personalization-bundle pimcore/google-marketing-bundle pimcore/web-to-print-bundle pimcore/ecommerce-framework-bundle pimcore/newsletter-bundle
    
  2. 激活模块

    • config/bundles.php中添加需要的模块,例如:
      \Pimcore\Bundle\EcommerceFrameworkBundle\PimcoreEcommerceFrameworkBundle::class => ['all' => true],
      \Pimcore\Bundle\PersonalizationBundle\PimcorePersonalizationBundle::class => ['all' => true]
      
  3. 恢复模块配置

    • 重新激活各模块的配置存储设置

数据迁移与清理

  1. 执行数据库迁移

    bin/console doctrine:migrations:migrate
    
  2. 清理无用数据

    • 对于不使用的Web2Print功能:
      bin/console pimcore:documents:cleanup printpage printcontainer
      
    • 对于不使用的Newsletter功能:
      bin/console pimcore:documents:cleanup newsletter
      
  3. 移除废弃设置

    bin/console pimcore:assets:remove-custom-setting faceCoordinates
    bin/console pimcore:assets:remove-custom-setting disableFocalPointDetection
    bin/console pimcore:assets:remove-custom-setting disableImageFeatureAutoDetection
    

系统重建

  1. 重建数据结构

    bin/console doctrine:migration:exec 'Pimcore\Bundle\CoreBundle\Migrations\Version20240708083500'
    
  2. 清理旧配置

    • 确认迁移完成后可删除var/config/system.yaml

服务器配置调整

  1. WebDav路径变更

    • 根据新版本要求更新Nginx配置
  2. 消息队列配置

    • 更新Symfony Messenger worker配置,添加新的接收器:
      • pimcore_scheduled_tasks
      • pimcore_image_optimize
      • pimcore_asset_update
      • pimcore_search_backend_message

总结

Pimcore 11带来了更模块化的架构和多项改进。按照本文步骤执行升级,可以确保平稳过渡到新版本。升级完成后,建议进行全面测试,特别是自定义功能和集成部分,以确保所有功能正常工作。

pimcore Open Source Data & Experience Management Platform (PIM, MDM, CDP, DAM, DXP/CMS & Digital Commerce) pimcore 项目地址: https://gitcode.com/gh_mirrors/pi/pimcore

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

贺晔音

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值