Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #6163
Closes #6494
The upgrader & installer already had mechanisms to set proper collation (utf8_general_ci), but they weren't working under certain circumstances. Tidying up this existing logic is cleaner than trying to implement partial utf8mb4 support. Utf8mb4 support should wait for #6409 .
Upgrader:
If $db_character_set were not utf8, and, you were upgrading into a DB with a utf8mb4 default charset/collation, you would get key too long errors as reported in #6163 . Note for this to happen you must not be utf8 already, and you must not migrate to a new Settings file (because doing so sets $db_character_set to utf8....).
This change prevents you from falling back to the DB default, which might use utf8mb4 (for new tables only, like qanda).
Installer:
utf8_support is now a function, no longer a variable, so any empty check was erroneous (function exists vs what the function returned...). Fixing them still yielded complex if statements that were trying to determine if we were using utf8.
But... we're using utf8 in 2.1... So the if statements could go.
The bottom line is that in 2.1, the installer and the upgrader should NEVER fall back to using the db-level default collation/charset.