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#48 Add check for PHP-Intl Extension #17668

Merged
merged 1 commit into from
Jun 21, 2020

Conversation

seamuslee001
Copy link
Contributor

Overview

This adds in a system check for the PHP-Intl extension that will be needed from 5.28 onwards

Before

No System check

After

System Check

ping @eileenmcnaughton @kcristiano

@civibot
Copy link

civibot bot commented Jun 20, 2020

(Standard links)

public function checkPHPIntlExists() {
$messages = [];
if (!extension_loaded('intl')) {
$messages[] = CRM_Utils_Check_Message(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be $messages[] = new CRM_Utils_Check_Message(. It gives an error 500 currently.

@demeritcowboy
Copy link
Contributor

By the way php-intl is disabled by default in windows, but I guess depends on the hosting. It's easy enough to enable.

@seamuslee001
Copy link
Contributor Author

@demeritcowboy fixed now

@demeritcowboy
Copy link
Contributor

Great. It's working now.

@eileenmcnaughton eileenmcnaughton merged commit 27a4777 into civicrm:5.27 Jun 21, 2020
@eileenmcnaughton eileenmcnaughton deleted the intl_check branch June 21, 2020 21:13
@eileenmcnaughton
Copy link
Contributor

@seamuslee001 I've merged this based on @demeritcowboy's review - but I think we should probably re-add handling for when the extension is not present where we have started to use this library - as a precaution (it can be as hacky as it always was...)

@agh1
Copy link
Contributor

agh1 commented Jul 1, 2020

A lot of folks have a deep hatred for the system check because they feel it's always playing gotcha with them. I'm putting this at the top of the features list in the release notes so people are aware of this, but I'm worried that unless someone reads the release notes, they'll upgrade, see no mention of this, and then have this warning appear to users.

At a minimum, a system check that declares something to be a problem when it wasn't an actual problem before should be accompanied by an upgrade message.

I also agree with @eileenmcnaughton that we'll need to take precautions for people who go into 5.28 without php-intl. It's unreasonable to expect everyone to have updated to 5.27 and seen the warning.

@MegaphoneJon
Copy link
Contributor

@agh1 @seamuslee001 I just looked and it doesn't seem like the installer is checking for the presence of php-intl. Though I'm also not sure if the checkRequirements event fires on upgrade. Either way, it seems like we need to add a check in the installer like the one for php-mbstring.

@agh1
Copy link
Contributor

agh1 commented Jul 1, 2020

@MegaphoneJon has a good point about the installer. I just opened #17728 to offer a pre-upgrade message explaining what's going on.

@MegaphoneJon
Copy link
Contributor

Thanks @agh1! I don't think this will prevent an upgrade to 5.28 - nor will it prevent a fresh install of 5.28 where this PHP extension doesn't exist. It seems like we need both. I'm willing to do the latter if someone else can do the former?

@agh1
Copy link
Contributor

agh1 commented Jul 1, 2020

You're right. I have been more focused on 5.27. It looks from @eileenmcnaughton's comment above that she wanted to be sure that someone on 5.28 without php-intl at least won't have things exploding. That's probably the best course, since any code to prevent an upgrade to 5.28 would be shipped in 5.28, and that means you've already swapped out your old version. We always say to back up before upgrading, but it's not great to rely upon rolling back the code as someone's only recourse. I don't know the first thing about what dev/translation#28 is going to be used for, so this should probably be left to someone involved with that. I'll comment on that ticket to cross-reference.

@eileenmcnaughton
Copy link
Contributor

@agh1 @seamuslee001 @MegaphoneJon at the moment there will be a fatal error in 5.28 subtractCurrencies function without php-intl enabled. I think we actually need to detect the presence of the extension in that function & fall back to the old handling. Ditto when we switch over the more prevalent money functions. We don't want to support both forever but I foresee a minimum of 6 months where we do.

That patch isn't done yet but assuming the rc is cut before it is it should target the rc.

@eileenmcnaughton
Copy link
Contributor

See #17759

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.

5 participants