Upgrading from 5.x to 6.x

Created on 27 February 2025, 5 months ago

Problem/Motivation

What is the recommended process to upgrade from 5.x to 6.x

Problem one:
Composer - if we run upgrade composer will then remove the the color module as it's no longer a dependency.

I thought I would then composer require drupal/color to get it back so we can uninstall post upgrade.

However on running drush updb I got the following:

Cannot redeclare resolve_color

Grepping the codebase it only seems to be defined in that one location.
I've wrapped it in a if !function_exists call - however now I don't see the color settings migrated properly when running the update.

Note this site has a child theme build using the script - with a dxpr_theme as the parent theme.

Steps to reproduce

Install dxpr_theme v5.x
create a sub theme
customise the color
run upgrade to 6.x
Observer loss of custom colors

Proposed resolution

Some upgrade notes with steps to migrate and/or an upgrade task.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

6.0

Component

Code

Created by

🇳🇿New Zealand luke.stewart

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @luke.stewart
  • 🇳🇿New Zealand luke.stewart

    This looks to happen because:

    In dxpr_theme_post_update_n1_migrate_colors we

      // Load callbacks.
      require_once $theme_handler
        ->getTheme('dxpr_theme')
        ->getPath() . '/dxpr_theme_callbacks.inc';
    

    Which gives us the function 'dxpr_theme_css_cache_build'

    Then we loop over all themes and if it is dxpr_theme or a first generation child subtheme - i.e. this update doesn't work for multiple levels of subtheme.

    We do stuff then call dxpr_theme_css_cache_build

    In dxpr_theme_css_cache_build we

    Use a hardcoded reference to the dxpr_theme to load all the files in features that are suffixed css.inc

    foreach (\Drupal::service('file_system')->scanDirectory(\Drupal::service('extension.list.theme')->getPath('dxpr_theme') . '/features', '/css.inc/i') as $file)
    

    This loop runs multiple times if we have a subtheme/s that match above.

    We are using 'require_once $file->uri;' so we should only require this once. ????? SO why do we get a redeclared error!

  • 🇮🇳India sreenivasparuchuri

    used function_exists to fix the issue

Production build 0.71.5 2024