5.1.x requires a merge from wxt 5.0.x - settings (wxt_core countries) fix is missing

Created on 19 December 2023, 6 months ago
Updated 26 January 2024, 5 months ago

Problem/Motivation

The countries fix from 5.0.x is missing in 5.1.x due to the fact that we forgot to merge 5.0.x into 5.1.x (wxt)

Regression fix for Change wxt_core countries config name

πŸ› Bug report
Status

Fixed

Version

5.1

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada joseph.olstad

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

Comments & Activities

  • Issue created by @joseph.olstad
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    > [error] Drupal\Core\Config\Config::setData(): Argument #1 ($data) must be of type array, Drupal\Core\Config\Config given, called in /var/www/clients/client1/web8/web/docroot/html/profiles/wxt/modules/custom/wxt_core/wxt_core.install on line 695
    > [error] Update failed: wxt_core_update_8502

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    missing this:

     ╰❯ $ git diff 5.1.x modules/custom/wxt_core/wxt_core.install
    diff --git a/modules/custom/wxt_core/wxt_core.install b/modules/custom/wxt_core/wxt_core.install
    index 5d15742..49606ad 100644
    --- a/modules/custom/wxt_core/wxt_core.install
    +++ b/modules/custom/wxt_core/wxt_core.install
    @@ -675,7 +675,19 @@ function wxt_core_update_8500() {
      * Setup CountryManager lists 
                
                  #3111375: Webform should only list approved GoC recognized countries β†’
                .
      */
     function wxt_core_update_8501() {
    -  // 
                
                  #3399929: Change wxt_core countries config name β†’
                 wxt_core_update_8502 in favour
    +  $config_namespace = 'wxt_core.settings.countries';
    +  $module_handler = \Drupal::service('module_handler');
    +  $module_path = $module_handler->getModule('wxt_core')->getPath();
    +  $path = DRUPAL_ROOT . '/' . $module_path . '/config/install/' . $config_namespace . '.yml';
    +  $country_data = Yaml::parse(\file_get_contents($path));
    +
    +  // Get the configuration factory service.
    +  $config_factory = \Drupal::configFactory();
    +
    +  // Save the configuration using the loaded data.
    +  $config = $config_factory->getEditable($config_namespace);
    +  $config->setData($country_data);
    +  $config->save();
     }
     
     /**
    @@ -692,6 +704,11 @@ function wxt_core_update_8502() {
       if ($hasUpdated) {
         $country_data = $config_factory->getEditable($legacy);
         $config = $config_factory->getEditable($updated);
    +    if (!is_array($country_data)) {
    +      // Update hook 8501 wasn't run correctly for some reason, or the yml was deleted.
    +      wxt_core_update_8501();
    +      return;
    +    }
         $config->setData($country_data);
         $config->save();
         // Delete old data.
    
    

    possibly missing something else, just focused on this install file for now.

    • sylus β†’ committed 6ee4b000 on 5.1.x
      Issue #3409755: 5.1.x requires a merge from wxt 5.0.x - countries fix is...
  • Status changed to Fixed 6 months ago
  • πŸ‡¨πŸ‡¦Canada sylus

    Committed the fix :)

  • πŸ‡¨πŸ‡¦Canada smulvih2 Canada 🍁

    Tried an upgrade from 5.0.1 to 5.1.0 and ran into this issue with drush updb:

    [notice] Update started: wxt_core_update_8502
    >  [error]  Drupal\Core\Config\Config::setData(): Argument #1 ($data) must be of type array, Drupal\Core\Config\Config given, called in /var/www/public_html/profiles/wxt/modules/custom/wxt_core/wxt_core.install on line 695 
    >  [error]  Update failed: wxt_core_update_8502 
     [error]  Update aborted by: wxt_core_update_8502

    Realized this fix was pushed to 5.1.x-dev branch (not 5.1.0 tag), and upgrading to this branch allowed me to complete the upgrade successfully. We should cut a new release 5.1.1 with this change to prevent upgrade issues for other projects.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    @smulvih2 ya 5.1.1 will fix it.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    @sylus,
    Thanks again for committing this, I think with the relative calm of issues being reported, I haven't found any others, I think we could tag 5.1.1 anytime.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    A duplicate issue was opened by Open Plus not realizing that this is the solution.

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

Production build 0.69.0 2024