Merge pull request #5145 from tractorcow/pulls/3.2/fulltext-bootstrapping

BUG Fix FulltextsearchEnable
This commit is contained in:
Daniel Hensby 2016-03-19 17:17:02 +00:00
commit cbdaf890dd
2 changed files with 13 additions and 13 deletions

View File

@ -310,15 +310,14 @@ abstract class DBSchemaManager {
// Check if options changed // Check if options changed
$tableOptionsChanged = false; $tableOptionsChanged = false;
if (isset($options[get_class($this)]) || true) { // Check for DB constant on the schema class
if (isset($options[get_class($this)])) { $dbIDName = sprintf('%s::ID', get_class($this));
if (preg_match('/ENGINE=([^\s]*)/', $options[get_class($this)], $alteredEngineMatches)) { $dbID = defined($dbIDName) ? constant($dbIDName) : null;
$alteredEngine = $alteredEngineMatches[1]; if ($dbID && isset($options[$dbID])) {
$tableStatus = $this->query(sprintf( if (preg_match('/ENGINE=([^\s]*)/', $options[$dbID], $alteredEngineMatches)) {
'SHOW TABLE STATUS LIKE \'%s\'', $table $alteredEngine = $alteredEngineMatches[1];
))->first(); $tableStatus = $this->query(sprintf('SHOW TABLE STATUS LIKE \'%s\'', $table))->first();
$tableOptionsChanged = ($tableStatus['Engine'] != $alteredEngine); $tableOptionsChanged = ($tableStatus['Engine'] != $alteredEngine);
}
} }
} }

View File

@ -84,7 +84,8 @@ class MySQLSchemaManager extends DBSchemaManager {
} }
} }
if ($alteredOptions && isset($alteredOptions[get_class($this)])) { $dbID = self::ID;
if ($alteredOptions && isset($alteredOptions[$dbID])) {
$indexList = $this->indexList($tableName); $indexList = $this->indexList($tableName);
$skip = false; $skip = false;
foreach ($indexList as $index) { foreach ($indexList as $index) {
@ -98,14 +99,14 @@ class MySQLSchemaManager extends DBSchemaManager {
sprintf( sprintf(
"Table %s options not changed to %s due to fulltextsearch index", "Table %s options not changed to %s due to fulltextsearch index",
$tableName, $tableName,
$alteredOptions[get_class($this)] $alteredOptions[$dbID]
), ),
"changed" "changed"
); );
} else { } else {
$this->query(sprintf("ALTER TABLE \"%s\" %s", $tableName, $alteredOptions[get_class($this)])); $this->query(sprintf("ALTER TABLE \"%s\" %s", $tableName, $alteredOptions[$dbID]));
$this->alterationMessage( $this->alterationMessage(
sprintf("Table %s options changed: %s", $tableName, $alteredOptions[get_class($this)]), sprintf("Table %s options changed: %s", $tableName, $alteredOptions[$dbID]),
"changed" "changed"
); );
} }