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

dev/core#3783 convert Recent Items providers into an option group #24164

Merged
merged 4 commits into from
Aug 9, 2022
Merged

dev/core#3783 convert Recent Items providers into an option group #24164

merged 4 commits into from
Aug 9, 2022

Conversation

herbdool
Copy link
Contributor

@herbdool herbdool commented Aug 5, 2022

Overview

Fixes https://lab.civicrm.org/dev/core/-/issues/3783

Before

Recent Items providers is a hard-coded list.

After

Adds an option group and uses that instead.

I'm not quite sure if I've got the right place to put the upgrade query. I haven't tried it for core yet.

@civibot
Copy link

civibot bot commented Aug 5, 2022

(Standard links)

@civibot civibot bot added the master label Aug 5, 2022
@colemanw
Copy link
Member

colemanw commented Aug 5, 2022

Normally we try to write upgrade code in a way that's safe to be run multiple times.
The way this upgrader is written, it's going to crash if it's already been run once.
I think the way the upgrade code is written is actually the right way to write install sql, and it should be moved to the installer.
For the upgrader, I would do it in php rather than a sql file, and take advantage of the failsafe functions \CRM_Core_BAO_OptionGroup::ensureOptionGroupExists and \CRM_Core_BAO_OptionValue::ensureOptionValueExists

@herbdool
Copy link
Contributor Author

herbdool commented Aug 5, 2022

I've updated it. I figured eventually it would be in php, but as I was looking around it seemed like it would temporarily in sql/*.tpl until closer to the release. Anyway, I guess I was wrong.

@colemanw
Copy link
Member

colemanw commented Aug 5, 2022

@herbdool this looks good. The sql you wrote is still needed though, it just needs to be placed in civicrm_data.tpl for the sake of new installs (or a slight variation of it, see how option groups and values are created in that file).

@herbdool
Copy link
Contributor Author

herbdool commented Aug 6, 2022

@colemanw I added it to civicrm_data.tpl too. All tests pass

@colemanw
Copy link
Member

colemanw commented Aug 9, 2022

I tested this and added one additional safeguard. Everything else looks fine and works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants