Differential D11454 Diff 27586 src/infrastructure/storage/management/workflow/PhabricatorStorageManagementQuickstartWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/storage/management/workflow/PhabricatorStorageManagementQuickstartWorkflow.php
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | public function execute(PhutilArgumentParser $args) { | ||||
$dump = Filesystem::readFile($tmp); | $dump = Filesystem::readFile($tmp); | ||||
$dump = str_replace( | $dump = str_replace( | ||||
$namespace, | $namespace, | ||||
'{$NAMESPACE}', | '{$NAMESPACE}', | ||||
$dump); | $dump); | ||||
// NOTE: This is a hack. We can not use `binary` for these columns, because | // NOTE: This is a hack. We can not use `binary` for these columns, because | ||||
// they are a part of a fulltext index. | // they are a part of a fulltext index. This regex is avoiding matching a | ||||
// possible NOT NULL at the end of the line. | |||||
$old = $dump; | $old = $dump; | ||||
$dump = preg_replace( | $dump = preg_replace( | ||||
'/`corpus` longtext CHARACTER SET .* COLLATE .*,/mi', | '/`corpus` longtext CHARACTER SET .*? COLLATE \S+,/mi', | ||||
'`corpus` longtext CHARACTER SET {$CHARSET_FULLTEXT} '. | '`corpus` longtext CHARACTER SET {$CHARSET_FULLTEXT} '. | ||||
'COLLATE {$COLLATE_FULLTEXT},', | 'COLLATE {$COLLATE_FULLTEXT},', | ||||
$dump); | $dump); | ||||
if ($dump == $old) { | if ($dump == $old) { | ||||
// If we didn't make any changes, yell about it. We'll produce an invalid | // If we didn't make any changes, yell about it. We'll produce an invalid | ||||
// dump otherwise. | // dump otherwise. | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
pht('Failed to apply hack to adjust FULLTEXT search column!')); | pht('Failed to apply hack to adjust FULLTEXT search column!')); | ||||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |