Make WordPress Core


Ignore:
Timestamp:
05/23/2016 05:53:02 AM (9 years ago)
Author:
pento
Message:

Database: Obey locale-specific utf8 collation settings.

Some sites prefer to use locale-specific location settings. For example, the Swedish WordPress package use utf8_swedish_ci, instead of utf8_unicode_ci. When upgrading the connection to utf8mb4, we were overriding this to be utf8mb4_unicode_ci, instead of maintaining the use of the _swedish_ci variant.

The locale-specific collations do have extra collation rules just for that language, so it's useful to maintain compatibility.

Fixes #32405.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r37518 r37521  
    758758        }
    759759
    760         if ( 'utf8mb4' === $this->charset && ( ! $this->collate || stripos( $this->collate, 'utf8_' ) === 0 ) ) {
    761             $this->collate = 'utf8mb4_unicode_ci';
     760        if ( 'utf8mb4' === $this->charset ) {
     761            // _general_ is outdated, so we can upgrade it to _unicode_, instead.
     762            if ( ! $this->collate || 'utf8_general_ci' === $this->collate ) {
     763                $this->collate = 'utf8mb4_unicode_ci';
     764            } else {
     765                $this->collate = str_replace( 'utf8_', 'utf8mb4_', $this->collate );
     766            }
    762767        }
    763768    }
Note: See TracChangeset for help on using the changeset viewer.