Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-01-03 17:28:31 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-01-08 13:45:19 +0300
commit8b64e92b9262d2a2eec6345685ce421050f95c66 (patch)
treedd51490b8a184b2643414d11867a9fa450aa5065 /core/Command/Db
parent84e6e9f7cf19207041925eaa237d24e1c12c2c2d (diff)
Bump doctrine/dbal from 2.12.0 to 3.0.0
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/Command/Db')
-rw-r--r--core/Command/Db/AddMissingColumns.php5
-rw-r--r--core/Command/Db/AddMissingIndices.php5
-rw-r--r--core/Command/Db/AddMissingPrimaryKeys.php5
-rw-r--r--core/Command/Db/ConvertFilecacheBigInt.php8
-rw-r--r--core/Command/Db/ConvertMysqlToMB4.php4
-rw-r--r--core/Command/Db/ConvertType.php31
-rw-r--r--core/Command/Db/Migrations/ExecuteCommand.php13
-rw-r--r--core/Command/Db/Migrations/GenerateCommand.php8
-rw-r--r--core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php4
-rw-r--r--core/Command/Db/Migrations/MigrateCommand.php8
-rw-r--r--core/Command/Db/Migrations/StatusCommand.php9
11 files changed, 52 insertions, 48 deletions
diff --git a/core/Command/Db/AddMissingColumns.php b/core/Command/Db/AddMissingColumns.php
index 3ace75b4eef..4b7fa039956 100644
--- a/core/Command/Db/AddMissingColumns.php
+++ b/core/Command/Db/AddMissingColumns.php
@@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OC\Core\Command\Db;
+use OC\DB\Connection;
use OC\DB\SchemaWrapper;
use OCP\IDBConnection;
use Symfony\Component\Console\Command\Command;
@@ -44,13 +45,13 @@ use Symfony\Component\EventDispatcher\GenericEvent;
*/
class AddMissingColumns extends Command {
- /** @var IDBConnection */
+ /** @var Connection */
private $connection;
/** @var EventDispatcherInterface */
private $dispatcher;
- public function __construct(IDBConnection $connection, EventDispatcherInterface $dispatcher) {
+ public function __construct(Connection $connection, EventDispatcherInterface $dispatcher) {
parent::__construct();
$this->connection = $connection;
diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php
index 5cbd6ee405d..1acff55fa40 100644
--- a/core/Command/Db/AddMissingIndices.php
+++ b/core/Command/Db/AddMissingIndices.php
@@ -33,6 +33,7 @@ declare(strict_types=1);
namespace OC\Core\Command\Db;
+use OC\DB\Connection;
use OC\DB\SchemaWrapper;
use OCP\IDBConnection;
use Symfony\Component\Console\Command\Command;
@@ -51,13 +52,13 @@ use Symfony\Component\EventDispatcher\GenericEvent;
*/
class AddMissingIndices extends Command {
- /** @var IDBConnection */
+ /** @var Connection */
private $connection;
/** @var EventDispatcherInterface */
private $dispatcher;
- public function __construct(IDBConnection $connection, EventDispatcherInterface $dispatcher) {
+ public function __construct(Connection $connection, EventDispatcherInterface $dispatcher) {
parent::__construct();
$this->connection = $connection;
diff --git a/core/Command/Db/AddMissingPrimaryKeys.php b/core/Command/Db/AddMissingPrimaryKeys.php
index ef3d6a05f2e..7113ecb210f 100644
--- a/core/Command/Db/AddMissingPrimaryKeys.php
+++ b/core/Command/Db/AddMissingPrimaryKeys.php
@@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OC\Core\Command\Db;
+use OC\DB\Connection;
use OC\DB\SchemaWrapper;
use OCP\IDBConnection;
use Symfony\Component\Console\Command\Command;
@@ -44,13 +45,13 @@ use Symfony\Component\EventDispatcher\GenericEvent;
*/
class AddMissingPrimaryKeys extends Command {
- /** @var IDBConnection */
+ /** @var Connection */
private $connection;
/** @var EventDispatcherInterface */
private $dispatcher;
- public function __construct(IDBConnection $connection, EventDispatcherInterface $dispatcher) {
+ public function __construct(Connection $connection, EventDispatcherInterface $dispatcher) {
parent::__construct();
$this->connection = $connection;
diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php
index 77f5034315c..6001de6fb9e 100644
--- a/core/Command/Db/ConvertFilecacheBigInt.php
+++ b/core/Command/Db/ConvertFilecacheBigInt.php
@@ -34,8 +34,8 @@ namespace OC\Core\Command\Db;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
+use OC\DB\Connection;
use OC\DB\SchemaWrapper;
-use OCP\IDBConnection;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -43,13 +43,13 @@ use Symfony\Component\Console\Question\ConfirmationQuestion;
class ConvertFilecacheBigInt extends Command {
- /** @var IDBConnection */
+ /** @var Connection */
private $connection;
/**
- * @param IDBConnection $connection
+ * @param Connection $connection
*/
- public function __construct(IDBConnection $connection) {
+ public function __construct(Connection $connection) {
$this->connection = $connection;
parent::__construct();
}
diff --git a/core/Command/Db/ConvertMysqlToMB4.php b/core/Command/Db/ConvertMysqlToMB4.php
index 4305f446286..55633ea9941 100644
--- a/core/Command/Db/ConvertMysqlToMB4.php
+++ b/core/Command/Db/ConvertMysqlToMB4.php
@@ -24,7 +24,7 @@
namespace OC\Core\Command\Db;
-use Doctrine\DBAL\Platforms\MySqlPlatform;
+use Doctrine\DBAL\Platforms\MySQLPlatform;
use OC\DB\MySqlTools;
use OC\Migration\ConsoleOutput;
use OC\Repair\Collation;
@@ -70,7 +70,7 @@ class ConvertMysqlToMB4 extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
- if (!$this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
+ if (!$this->connection->getDatabasePlatform() instanceof MySQLPlatform) {
$output->writeln("This command is only valid for MySQL/MariaDB databases.");
return 1;
}
diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php
index d89d57ff601..32b7492d967 100644
--- a/core/Command/Db/ConvertType.php
+++ b/core/Command/Db/ConvertType.php
@@ -33,9 +33,10 @@
namespace OC\Core\Command\Db;
-use Doctrine\DBAL\DBALException;
+use Doctrine\DBAL\Exception;
+use Doctrine\DBAL\Schema\AbstractAsset;
use Doctrine\DBAL\Schema\Table;
-use Doctrine\DBAL\Types\Type;
+use Doctrine\DBAL\Types\Types;
use OC\DB\Connection;
use OC\DB\ConnectionFactory;
use OC\DB\MigrationService;
@@ -52,6 +53,8 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
+use function preg_match;
+use function preg_quote;
class ConvertType extends Command implements CompletionAwareInterface {
/**
@@ -192,7 +195,8 @@ class ConvertType extends Command implements CompletionAwareInterface {
$this->validateInput($input, $output);
$this->readPassword($input, $output);
- $fromDB = \OC::$server->getDatabaseConnection();
+ /** @var Connection $fromDB */
+ $fromDB = \OC::$server->get(Connection::class);
$toDB = $this->getToDBConnection($input, $output);
if ($input->getOption('clear-schema')) {
@@ -283,9 +287,14 @@ class ConvertType extends Command implements CompletionAwareInterface {
}
protected function getTables(Connection $db) {
- $filterExpression = '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/';
- $db->getConfiguration()->
- setFilterSchemaAssetsExpression($filterExpression);
+ $db->getConfiguration()->setSchemaAssetsFilter(function ($asset) {
+ /** @var string|AbstractAsset $asset */
+ $filterExpression = '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/';
+ if ($asset instanceof AbstractAsset) {
+ return preg_match($filterExpression, $asset->getName()) !== false;
+ }
+ return preg_match($filterExpression, $asset) !== false;
+ });
return $db->getSchemaManager()->listTableNames();
}
@@ -309,7 +318,7 @@ class ConvertType extends Command implements CompletionAwareInterface {
$query->select($query->func()->count('*', 'num_entries'))
->from($table->getName());
$result = $query->execute();
- $count = $result->fetchColumn();
+ $count = $result->fetchOne();
$result->closeCursor();
$numChunks = ceil($count / $chunkSize);
@@ -330,7 +339,7 @@ class ConvertType extends Command implements CompletionAwareInterface {
try {
$orderColumns = $table->getPrimaryKeyColumns();
- } catch (DBALException $e) {
+ } catch (Exception $e) {
$orderColumns = [];
foreach ($table->getColumns() as $column) {
$orderColumns[] = $column->getName();
@@ -384,11 +393,11 @@ class ConvertType extends Command implements CompletionAwareInterface {
$type = $table->getColumn($columnName)->getType()->getName();
switch ($type) {
- case Type::BLOB:
- case Type::TEXT:
+ case Types::BLOB:
+ case Types::TEXT:
$this->columnTypes[$tableName][$columnName] = IQueryBuilder::PARAM_LOB;
break;
- case Type::BOOLEAN:
+ case Types::BOOLEAN:
$this->columnTypes[$tableName][$columnName] = IQueryBuilder::PARAM_BOOL;
break;
default:
diff --git a/core/Command/Db/Migrations/ExecuteCommand.php b/core/Command/Db/Migrations/ExecuteCommand.php
index 95f1acd14fe..cc3f7d67fc0 100644
--- a/core/Command/Db/Migrations/ExecuteCommand.php
+++ b/core/Command/Db/Migrations/ExecuteCommand.php
@@ -23,11 +23,10 @@
namespace OC\Core\Command\Db\Migrations;
+use OC\DB\Connection;
use OC\DB\MigrationService;
use OC\Migration\ConsoleOutput;
-use OCP\App\IAppManager;
use OCP\IConfig;
-use OCP\IDBConnection;
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Command\Command;
@@ -37,23 +36,19 @@ use Symfony\Component\Console\Output\OutputInterface;
class ExecuteCommand extends Command implements CompletionAwareInterface {
- /** @var IDBConnection */
+ /** @var Connection */
private $connection;
/** @var IConfig */
private $config;
- /** @var IAppManager */
- protected $appManager;
-
/**
* ExecuteCommand constructor.
*
- * @param IDBConnection $connection
+ * @param Connection $connection
* @param IConfig $config
- * @param IAppManager $appManager
*/
- public function __construct(IDBConnection $connection, IAppManager $appManager, IConfig $config) {
+ public function __construct(Connection $connection, IConfig $config) {
$this->connection = $connection;
$this->config = $config;
diff --git a/core/Command/Db/Migrations/GenerateCommand.php b/core/Command/Db/Migrations/GenerateCommand.php
index fcafa9431c3..48fc59e77fb 100644
--- a/core/Command/Db/Migrations/GenerateCommand.php
+++ b/core/Command/Db/Migrations/GenerateCommand.php
@@ -25,10 +25,10 @@
namespace OC\Core\Command\Db\Migrations;
+use OC\DB\Connection;
use OC\DB\MigrationService;
use OC\Migration\ConsoleOutput;
use OCP\App\IAppManager;
-use OCP\IDBConnection;
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Command\Command;
@@ -83,17 +83,17 @@ class {{classname}} extends SimpleMigrationStep {
}
';
- /** @var IDBConnection */
+ /** @var Connection */
protected $connection;
/** @var IAppManager */
protected $appManager;
/**
- * @param IDBConnection $connection
+ * @param Connection $connection
* @param IAppManager $appManager
*/
- public function __construct(IDBConnection $connection, IAppManager $appManager) {
+ public function __construct(Connection $connection, IAppManager $appManager) {
$this->connection = $connection;
$this->appManager = $appManager;
diff --git a/core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php b/core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php
index 71349c0fa51..9101957a97c 100644
--- a/core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php
+++ b/core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php
@@ -26,12 +26,12 @@
namespace OC\Core\Command\Db\Migrations;
use Doctrine\DBAL\Schema\Schema;
+use OC\DB\Connection;
use OC\DB\MDB2SchemaReader;
use OC\DB\MigrationService;
use OC\Migration\ConsoleOutput;
use OCP\App\IAppManager;
use OCP\IConfig;
-use OCP\IDBConnection;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -40,7 +40,7 @@ class GenerateFromSchemaFileCommand extends GenerateCommand {
/** @var IConfig */
protected $config;
- public function __construct(IConfig $config, IAppManager $appManager, IDBConnection $connection) {
+ public function __construct(IConfig $config, IAppManager $appManager, Connection $connection) {
parent::__construct($connection, $appManager);
$this->config = $config;
}
diff --git a/core/Command/Db/Migrations/MigrateCommand.php b/core/Command/Db/Migrations/MigrateCommand.php
index 229288c794a..218c8aaf518 100644
--- a/core/Command/Db/Migrations/MigrateCommand.php
+++ b/core/Command/Db/Migrations/MigrateCommand.php
@@ -22,9 +22,9 @@
namespace OC\Core\Command\Db\Migrations;
+use OC\DB\Connection;
use OC\DB\MigrationService;
use OC\Migration\ConsoleOutput;
-use OCP\IDBConnection;
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Command\Command;
@@ -34,13 +34,13 @@ use Symfony\Component\Console\Output\OutputInterface;
class MigrateCommand extends Command implements CompletionAwareInterface {
- /** @var IDBConnection */
+ /** @var Connection */
private $connection;
/**
- * @param IDBConnection $connection
+ * @param Connection $connection
*/
- public function __construct(IDBConnection $connection) {
+ public function __construct(Connection $connection) {
$this->connection = $connection;
parent::__construct();
}
diff --git a/core/Command/Db/Migrations/StatusCommand.php b/core/Command/Db/Migrations/StatusCommand.php
index 83763ee79b3..6c78bcd180c 100644
--- a/core/Command/Db/Migrations/StatusCommand.php
+++ b/core/Command/Db/Migrations/StatusCommand.php
@@ -24,9 +24,9 @@
namespace OC\Core\Command\Db\Migrations;
+use OC\DB\Connection;
use OC\DB\MigrationService;
use OC\Migration\ConsoleOutput;
-use OCP\IDBConnection;
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Command\Command;
@@ -36,13 +36,10 @@ use Symfony\Component\Console\Output\OutputInterface;
class StatusCommand extends Command implements CompletionAwareInterface {
- /** @var IDBConnection */
+ /** @var Connection */
private $connection;
- /**
- * @param IDBConnection $connection
- */
- public function __construct(IDBConnection $connection) {
+ public function __construct(Connection $connection) {
$this->connection = $connection;
parent::__construct();
}