Check for Antelope and convert to Barracuda
This commit is contained in:
parent
16ff943ed3
commit
01c6179feb
4 changed files with 16 additions and 5 deletions
|
@ -54,7 +54,7 @@ Commands
|
|||
dryrun Show database update schema queries without running them
|
||||
update Update database schema
|
||||
dumpsql Dump database schema
|
||||
toinnodb Convert all tables from MyISAM to InnoDB
|
||||
toinnodb Convert all tables from MyISAM or InnoDB in the Antelope file format to InnoDB in the Barracuda file format
|
||||
|
||||
Options
|
||||
-h|--help|-? Show help information
|
||||
|
|
|
@ -49,7 +49,7 @@ class DBStructure
|
|||
private static $definition = [];
|
||||
|
||||
/**
|
||||
* Converts all tables from MyISAM to InnoDB
|
||||
* Converts all tables from MyISAM/InnoDB Antelope to InnoDB Barracuda
|
||||
*/
|
||||
public static function convertToInnoDB()
|
||||
{
|
||||
|
@ -59,13 +59,19 @@ class DBStructure
|
|||
['engine' => 'MyISAM', 'table_schema' => DBA::databaseName()]
|
||||
);
|
||||
|
||||
$tables = array_merge($tables, DBA::selectToArray(
|
||||
['information_schema' => 'tables'],
|
||||
['table_name'],
|
||||
['engine' => 'InnoDB', 'ROW_FORMAT' => ['COMPACT', 'REDUNDANT'], 'table_schema' => DBA::databaseName()]
|
||||
));
|
||||
|
||||
if (!DBA::isResult($tables)) {
|
||||
echo DI::l10n()->t('There are no tables on MyISAM.') . "\n";
|
||||
echo DI::l10n()->t('There are no tables on MyISAM or InnoDB with the Antelope file format.') . "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($tables AS $table) {
|
||||
$sql = "ALTER TABLE " . DBA::quoteIdentifier($table['table_name']) . " engine=InnoDB;";
|
||||
$sql = "ALTER TABLE " . DBA::quoteIdentifier($table['table_name']) . " ENGINE=InnoDB ROW_FORMAT=DYNAMIC;";
|
||||
echo $sql . "\n";
|
||||
|
||||
$result = DBA::e($sql);
|
||||
|
|
|
@ -1957,7 +1957,7 @@ class Item
|
|||
// There are duplicates. We delete our just created entry.
|
||||
Logger::info('Delete duplicated item', ['id' => $current_post, 'uri' => $item['uri'], 'uid' => $item['uid'], 'guid' => $item['guid']]);
|
||||
|
||||
// Yes, we could do a rollback here - but we are having many users with MyISAM.
|
||||
// Yes, we could do a rollback here - but we possibly are still having users with MyISAM.
|
||||
DBA::delete('item', ['id' => $current_post]);
|
||||
DBA::commit();
|
||||
return 0;
|
||||
|
|
|
@ -50,6 +50,11 @@ class Summary extends BaseAdmin
|
|||
$warningtext[] = DI::l10n()->t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php bin/console.php dbstructure toinnodb</tt> of your Friendica installation for an automatic conversion.<br />', 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
|
||||
}
|
||||
|
||||
// are there InnoDB tables in Antelope in the DB? If so, trigger a warning message
|
||||
if (DBA::count(['information_schema' => 'tables'], ['ENGINE' => 'InnoDB', 'ROW_FORMAT' => ['COMPACT', 'REDUNDANT'], 'table_schema' => DBA::databaseName()])) {
|
||||
$warningtext[] = DI::l10n()->t('Your DB still runs with InnoDB tables in the Antelope file format. You should change the file format to Barracuda. Friendica is using features that are not provided by the Antelope format. See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php bin/console.php dbstructure toinnodb</tt> of your Friendica installation for an automatic conversion.<br />', 'https://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html');
|
||||
}
|
||||
|
||||
// Check if github.com/friendica/master/VERSION is higher then
|
||||
// the local version of Friendica. Check is opt-in, source may be master or devel branch
|
||||
if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') {
|
||||
|
|
Loading…
Reference in a new issue