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/translation#4 - Refine upgrade steps for modifying nl_NL #17048

Merged
merged 2 commits into from
Apr 10, 2020

Conversation

totten
Copy link
Member

@totten totten commented Apr 9, 2020

Overview

This refines the upgrader step added in #17027.

CC @demeritcowboy @seamuslee001

Before

After

  • Upgrader uses SQL
  • Upgrader includes option_group_id filter

totten added 2 commits April 9, 2020 14:43
The `interpolate()` function is already available as the heart of
`CRM_Util_SQL_Insert` and `CRM_Utils_SQL_Select`, etc.  This just makes it
easier to use for random SQL statements that don't have a full OOP model.
1. This adds a filter on `option_group_id` so that we don't modify unrelated OGs/OVs
2. Use simpler SQL semantics per https://docs.civicrm.org/dev/en/latest/framework/upgrade/#tips-prefer-simple-sql-semantics-over-apibaodao
@civibot
Copy link

civibot bot commented Apr 9, 2020

(Standard links)

\Civi\Api4\OptionValue::update()
->addWhere('name', '=', 'nl_NL')
// Adding check against label in case they've customized it, in which
$sql = CRM_Utils_SQL::interpolate('UPDATE civicrm_option_value SET label = @newLabel WHERE option_group_id = #group AND name = @name AND label IN (@oldLabels)', [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a silly question: Where is the interpolate function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see - it's part of this patch.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the function was originally two lines and then got a little longer for silly reasons.

I could break it out into a separate PR if that seems tidier.

@demeritcowboy
Copy link
Contributor

  • General standards
    • [r-explain] PASS
    • [r-user] PASS
    • [r-doc] PASS
    • [r-run] PASS
      • Also tested while upgrading in non-English.
  • Developer standards
    • [r-tech] PASS
    • [r-code] PASS
      • Normally the Utils::interpolate stuff would be separate but it's in its own commit.
    • [r-maint] PASS
      • Has frobnicate test.
    • [r-test] PASS

@eileenmcnaughton eileenmcnaughton merged commit a68cbdf into civicrm:master Apr 10, 2020
@eileenmcnaughton
Copy link
Contributor

merging based on @demeritcowboy review

@totten totten deleted the master-upgr-nl-be branch April 14, 2020 07:29
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.

3 participants