Browse Source

Address comments

* fix URL to documentation
* improve logic of UTF8mb4 check
* fix connection parameter creation - it's done already in ConnectionFactory::createConnectionParams
* remove unused attributes of MDB2SchemaReader

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
tags/v12.0.0beta1
Morris Jobke 7 years ago
parent
commit
3329f44a76
No account linked to committer's email address

+ 1
- 1
core/Command/Db/ConvertMysqlToMB4.php View File

@@ -72,7 +72,7 @@ class ConvertMysqlToMB4 extends Command {
}

if (!$this->connection->supports4ByteText()) {
$url = $this->urlGenerator->linkToDocs('admin-db-conversion');
$url = $this->urlGenerator->linkToDocs('admin-mysql-utf8mb4');
$output->writeln("The database is not properly setup to use the charset utf8mb4.");
$output->writeln("Also check that the setting 'mysql.utf8mb4' is set to true in the config.php.");
$output->writeln("For more information please read the documentation at $url");

+ 1
- 4
lib/private/DB/Connection.php View File

@@ -419,9 +419,6 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
if (!$this->getDatabasePlatform() instanceof MySqlPlatform) {
return true;
}
if ($this->getParams()['charset'] === 'utf8mb4') {
return true;
}
return false;
return $this->getParams()['charset'] === 'utf8mb4';
}
}

+ 0
- 17
lib/private/DB/MDB2SchemaReader.php View File

@@ -38,10 +38,6 @@ use Doctrine\DBAL\Schema\Schema;
use OCP\IConfig;

class MDB2SchemaReader {
/**
* @var string $DBNAME
*/
protected $DBNAME;

/**
* @var string $DBTABLEPREFIX
@@ -53,9 +49,6 @@ class MDB2SchemaReader {
*/
protected $platform;

/** @var \Doctrine\DBAL\Schema\SchemaConfig $schemaConfig */
protected $schemaConfig;

/** @var IConfig */
protected $config;

@@ -66,7 +59,6 @@ class MDB2SchemaReader {
public function __construct(IConfig $config, AbstractPlatform $platform) {
$this->platform = $platform;
$this->config = $config;
$this->DBNAME = $config->getSystemValue('dbname', 'owncloud');
$this->DBTABLEPREFIX = $config->getSystemValue('dbtableprefix', 'oc_');
}

@@ -118,15 +110,6 @@ class MDB2SchemaReader {
$name = str_replace('*dbprefix*', $this->DBTABLEPREFIX, $name);
$name = $this->platform->quoteIdentifier($name);
$table = $schema->createTable($name);
$table->setSchemaConfig($this->schemaConfig);

if($this->platform instanceof MySqlPlatform && $this->config->getSystemValue('mysql.utf8mb4', false)) {
$table->addOption('charset', 'utf8mb4');
$table->addOption('collate', 'utf8mb4_bin');
$table->addOption('row_format', 'compressed');
} else {
$table->addOption('collate', 'utf8_bin');
}
break;
case 'create':
case 'overwrite':

Loading…
Cancel
Save