Skip to content

Commit

Permalink
Fix database schema manager
Browse files Browse the repository at this point in the history
1. Prepare the utf8mb4 conversion check table before the changeset is
created to avoid SQL error about not existing table when running schema
updates on a pre-3.5.0 database after having updated the files only to
3.5.0.
2. Run the conversion only if no unfixed database problems remained
after changeset fix().
  • Loading branch information
richard67 committed Mar 29, 2016
1 parent cbccc08 commit 15a97f6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions administrator/components/com_installer/models/database.php
Expand Up @@ -42,6 +42,10 @@ protected function populateState($ordering = null, $direction = null)
$this->setState('extension_message', $app->getUserState('com_installer.extension_message'));
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message', '');

// Prepare the utf8mb4 conversion check table
$this->prepareUtf8mb4StatusTable();

parent::populateState('name', 'asc');
}

Expand All @@ -67,9 +71,16 @@ public function fix()
$installer->deleteUnexistingFiles();
$this->fixDefaultTextFilters();

// Finally make sure the database is converted to utf8mb4 or, if not suported
// by the server, compatible to it
$this->convertTablesToUtf8mb4();
/*
* Finally, if the schema updates succeeded, make sure the database is
* converted to utf8mb4 or, if not suported by the server, compatible to it.
*/
$statusArray = $changeSet->getStatus();

if (count($statusArray['error']) == 0)
{
$this->convertTablesToUtf8mb4();
}
}

/**
Expand Down

0 comments on commit 15a97f6

Please sign in to comment.