Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FiveSixtyTwo - Fix upgrade for domains with default value of enable_components #27075

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

totten
Copy link
Member

@totten totten commented Aug 16, 2023

Overview

v5.62 changes the data-storage for the list of active components -- previously, it was only a setting (enable_components); now , it is both a setting and a placeholder extension (civicrm_extension). This fixes a bug in upgrading sites with a default value of enable_components.

cc @mlutfy @larssandergreen

Steps to Reproduce

  • Install v5.60
  • Unset enable_components (i.e. cv vdel enable_components)
    • This means that the database does not have a specific value of civicrm_setting for enable_components. Consequently, the site inherits the default value of enable_components.
  • Upgrade to v5.65

Before

The upgrade encounters issues like this:

Argument 1 passed to CRM_Upgrade_Incremental_php_FiveSixtyTwo::{closure}() must be of the type string, null given

On my local system, this issues were fatal. But I can imagine other configurations where they might skipped. If I fix only the warnings, then the end-result is that the upgrade will execute and leave the system without any active components.

This can be seen with:

## Look at the setting
cv vget /compo/ -v

## Look at list of extensions
cv ext:list -Li /civi_/

After

The upgrader completes. The default components are enabled.

Technical Details

For testing, I used my local dmaster and prepared two DB snapshots:

  • dmaster snapshot with enable_components bearing a concrete value (as per sample data setup)
  • dmaster-vdel snapshot with no specific value of enable_components

Then I ran the upgrade on each. Afterward, I checked both civicrm_extension and civicrm_setting by running these commands:

cv ext:list -Li /civi_/
cv vget /compo/ -v

In both DB snapshots, the upgrade produced a decent list of components. e.g. on the second snapshot (dmaster-vdel), the final output was:

+----------+-----------------+-----------------+------------+-----------+-------------+
| location | key             | name            | version    | status    | downloadUrl |
+----------+-----------------+-----------------+------------+-----------+-------------+
| local    | civi_contribute | civi_contribute | 5.65.beta1 | installed |             |
| local    | civi_event      | civi_event      | 5.65.beta1 | installed |             |
| local    | civi_mail       | civi_mail       | 5.65.beta1 | installed |             |
| local    | civi_member     | civi_member     | 5.65.beta1 | installed |             |
| local    | civi_pledge     | civi_pledge     | 5.65.beta1 | installed |             |
| local    | civi_report     | civi_report     | 5.65.beta1 | installed |             |
+----------+-----------------+-----------------+------------+-----------+-------------+

+------------------------+------------------------------------------------------------------------------------------------------------------------+
| key                    | value                                                                                                                  |
+------------------------+------------------------------------------------------------------------------------------------------------------------+
| scope                  | domain                                                                                                                 |
| key                    | enable_components                                                                                                      |
| value                  | ["CiviEvent","CiviContribute","CiviMember","CiviMail","CiviReport","CiviPledge"]                                       |
| default                | ["CiviEvent","CiviContribute","CiviMember","CiviMail","CiviReport","CiviPledge"]                                       |
| explicit               | ["CiviEvent","CiviContribute","CiviMember","CiviMail","CiviReport","CiviPledge"]                                       |

@civibot
Copy link

civibot bot commented Aug 16, 2023

Thank you for contributing to CiviCRM! ❤️ We will need to test and review the PR. 👷

Introduction for new contributors
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
Quick links for reviewers

@civibot civibot bot added the master label Aug 16, 2023
@totten totten changed the base branch from master to 5.65 August 16, 2023 05:36
@civibot civibot bot added 5.65 and removed master labels Aug 16, 2023
@mlutfy
Copy link
Member

mlutfy commented Aug 16, 2023

I tested this on a few sites and went well. Thanks @totten !

@mlutfy mlutfy merged commit 7b063d5 into civicrm:5.65 Aug 16, 2023
@totten totten deleted the 5.65-null-comp branch August 17, 2023 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants