Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/schema/PhabricatorConfigSchemaQuery.php
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | public function loadExpectedSchema() { | ||||
$api = $this->getAPI(); | $api = $this->getAPI(); | ||||
if ($api->isCharacterSetAvailable('utf8mb4')) { | if ($api->isCharacterSetAvailable('utf8mb4')) { | ||||
// If utf8mb4 is available, we use it with the utf8mb4_unicode_ci | // If utf8mb4 is available, we use it with the utf8mb4_unicode_ci | ||||
// collation. This is most correct, and will sort properly. | // collation. This is most correct, and will sort properly. | ||||
$utf8_charset = 'utf8mb4'; | $utf8_charset = 'utf8mb4'; | ||||
$utf8_collate = 'utf8mb4_unicode_ci'; | $utf8_collation = 'utf8mb4_unicode_ci'; | ||||
} else { | } else { | ||||
// If utf8mb4 is not available, we use binary. This allows us to store | // If utf8mb4 is not available, we use binary. This allows us to store | ||||
// 4-byte unicode characters. This has some tradeoffs: | // 4-byte unicode characters. This has some tradeoffs: | ||||
// | // | ||||
// Unicode characters won't sort correctly. There's nothing we can do | // Unicode characters won't sort correctly. There's nothing we can do | ||||
// about this while still supporting 4-byte characters. | // about this while still supporting 4-byte characters. | ||||
// | // | ||||
// It's possible that strings will be truncated in the middle of a | // It's possible that strings will be truncated in the middle of a | ||||
// character on insert. We encourage users to set STRICT_ALL_TABLES | // character on insert. We encourage users to set STRICT_ALL_TABLES | ||||
// to prevent this. | // to prevent this. | ||||
$utf8_charset = 'binary'; | $utf8_charset = 'binary'; | ||||
$utf8_collate = 'binary'; | $utf8_collation = 'binary'; | ||||
} | } | ||||
$specs = id(new PhutilSymbolLoader()) | $specs = id(new PhutilSymbolLoader()) | ||||
->setAncestorClass('PhabricatorConfigSchemaSpec') | ->setAncestorClass('PhabricatorConfigSchemaSpec') | ||||
->loadObjects(); | ->loadObjects(); | ||||
$server_schema = new PhabricatorConfigServerSchema(); | $server_schema = new PhabricatorConfigServerSchema(); | ||||
foreach ($specs as $spec) { | foreach ($specs as $spec) { | ||||
$spec->setUTF8Charset($utf8_charset); | $spec | ||||
$spec->setUTF8Collate($utf8_collate); | ->setUTF8Collation($utf8_collation) | ||||
->setUTF8Charset($utf8_charset) | |||||
$spec->buildSchemata($server_schema); | ->setServer($server_schema) | ||||
->buildSchemata($server_schema); | |||||
} | } | ||||
return $server_schema; | return $server_schema; | ||||
} | } | ||||
public function buildComparisonSchema( | public function buildComparisonSchema( | ||||
PhabricatorConfigServerSchema $expect, | PhabricatorConfigServerSchema $expect, | ||||
PhabricatorConfigServerSchema $actual) { | PhabricatorConfigServerSchema $actual) { | ||||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |