-
-
Notifications
You must be signed in to change notification settings - Fork 828
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
CRM-19968 SQL tweaks to make it more likely that reverting to single language w… #9783
Conversation
…ill actually work
Can one of the admins verify this patch? |
jenkins, test this please |
CRM/Core/I18n/Schema.php
Outdated
foreach ($locales as $loc) { | ||
$dropQueries[] = "ALTER TABLE {$table} DROP {$column}_{$loc}"; | ||
if (strcmp($loc,$retain) !== 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a space after the comma
jenkins, test this please |
CRM/Core/I18n/Schema.php
Outdated
foreach ($locales as $loc) { | ||
$dropQueries[] = "ALTER TABLE {$table} DROP {$column}_{$loc}"; | ||
if (strcmp($loc,$retain) !== 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you raised the spectre of MySQL 5.1 in JIRA - I'm not fussed, but easy to account for it?
I thought CiviCRM might already have status available to check but it seems we query MySQL for this as we need.
$mysql_version = CRM_CORE_DAO::singleValueQuery('SELECT VERSION()');
foreach ($locales as $loc) {
if (version_compare($mysql_version, '5.1', '>=')) {
$queries[] = "DROP VIEW IF EXISTS {$table}_{$loc}";
}
else {
$queries[] = "DROP VIEW {$table}_{$loc}";
}
}
There might also be a 😱 MySQL comment syntax which <5.1 will ignore? I kinda hate this as it's harder to read, but
foreach ($locales as $loc) {
$queries[] = "DROP VIEW /*!50100 IF EXISTS */ {$table}_{$loc}";
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep - it seems we do still support 5.1 https://wiki.civicrm.org/confluence/display/CRMDOC/Installation+and+Upgrades
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see now my initial comment misjudged @mattwire's intent - I believe he's saying we do curerntly support 5.1+ anyway, but we could use IF EXISTS
more with later MySQL versions to reduce some of that fragility (which I do think is an issue). I'll open that as a separate ticket in JIRA and copy these notes there.
@xurizaemon I think this can be merged? It looks like you reviewed it & @mattwire responded to your review? |
@xurizaemon @eileenmcnaughton I think we agreed that it improved the situation, but highlighted that further improvements could be made to reliability of SQL elsewhere in CiviCRM (and in this particular area of code) for which https://issues.civicrm.org/jira/browse/CRM-20031 was opened. However, as this is an improvement over what was there before it should be merged - @xurizaemon do you agree? |
I'm happy with this. |
Merging based on @xurizaemon review & comment above |
…ill actually work.
Disabling multiple languages is almost certain to fail on an existing reasonably well populated system due to row size constraints. This patch makes a couple of simple tweaks to the SQL queries so that it is much more likely to succeed!