Hardcoded list of groups can cause social_group_update_11902 to fail if Open Social group type doesn't exist

Created on 14 November 2023, over 1 year ago
Updated 3 January 2024, over 1 year ago

Problem/Motivation

The social_group_update_11902() update function hardcodes the list of group types that will be updated.
If your list of group types diverged, you are in troubles.
Running update from 11.9.14 to 11.10.4 breaks sites if you have updated the list of group types on your site. Especially if you removed one of the 3 group types (closed, open or public) because the update code insufficiently check if the type exists and can lead to an empty type generation.

Steps to reproduce

Create a new group type, delete the public group type in 11.9.14. Run the update to 11.10.4. Your site will blow since a empty group type shell is created for the public group type that doesn't exist anymore.

Proposed resolution

Do not hardcode the list of types and check if the config exists when loading it and then editing it.

🐛 Bug report
Status

Needs work

Version

11.10

Component

Code (back-end)

Created by

🇫🇷France artusamak Bzh

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

Comments & Activities

  • Issue created by @artusamak
  • @artusamak opened merge request.
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • 🇳🇱Netherlands kingdutch

    We shouldn't apply the update to all group types since there might be custom group types with different revisionability needs. Instead we should check if the configuration we're modifying isNew() and skip it if that's true since it indicates the group type doesn't exist.

    Please note that our development happens on GitHub and the Drupal.org GitLab is only a mirror, to make sure you contribution gets seen please open a PR on GitHub.

Production build 0.71.5 2024