summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-12-22 10:43:56 +0100
committerMorris Jobke <hey@morrisjobke.de>2014-12-22 10:47:10 +0100
commitde25084defa361e6d85af1d469b4b59e8a69c694 (patch)
treedd284abc6192230ade3be822431bef8e93b5abff /lib
parentad8d55c3274e81dd4fd92b41ac5d6ef5c39febf3 (diff)
downloadnextcloud-server-de25084defa361e6d85af1d469b4b59e8a69c694.tar.gz
nextcloud-server-de25084defa361e6d85af1d469b4b59e8a69c694.zip
inject \OCP\IConfig instance in migrator
Diffstat (limited to 'lib')
-rw-r--r--lib/private/db/mdb2schemamanager.php12
-rw-r--r--lib/private/db/migrator.php8
-rw-r--r--lib/private/db/sqlitemigrator.php16
3 files changed, 13 insertions, 23 deletions
diff --git a/lib/private/db/mdb2schemamanager.php b/lib/private/db/mdb2schemamanager.php
index d90c8525a7b..358360d0b46 100644
--- a/lib/private/db/mdb2schemamanager.php
+++ b/lib/private/db/mdb2schemamanager.php
@@ -58,19 +58,19 @@ class MDB2SchemaManager {
public function getMigrator() {
$random = \OC::$server->getSecureRandom()->getMediumStrengthGenerator();
$platform = $this->conn->getDatabasePlatform();
+ $config = \OC::$server->getConfig();
if ($platform instanceof SqlitePlatform) {
- $config = \OC::$server->getConfig();
return new SQLiteMigrator($this->conn, $random, $config);
} else if ($platform instanceof OraclePlatform) {
- return new OracleMigrator($this->conn, $random);
+ return new OracleMigrator($this->conn, $random, $config);
} else if ($platform instanceof MySqlPlatform) {
- return new MySQLMigrator($this->conn, $random);
+ return new MySQLMigrator($this->conn, $random, $config);
} else if ($platform instanceof SQLServerPlatform) {
- return new MsSqlMigrator($this->conn, $random);
+ return new MsSqlMigrator($this->conn, $random, $config);
} else if ($platform instanceof PostgreSqlPlatform) {
- return new Migrator($this->conn, $random);
+ return new Migrator($this->conn, $random, $config);
} else {
- return new NoCheckMigrator($this->conn, $random);
+ return new NoCheckMigrator($this->conn, $random, $config);
}
}
diff --git a/lib/private/db/migrator.php b/lib/private/db/migrator.php
index 903e9b8a716..3a178f387ed 100644
--- a/lib/private/db/migrator.php
+++ b/lib/private/db/migrator.php
@@ -14,6 +14,7 @@ use \Doctrine\DBAL\Schema\Table;
use \Doctrine\DBAL\Schema\Schema;
use \Doctrine\DBAL\Schema\SchemaConfig;
use \Doctrine\DBAL\Schema\Comparator;
+use OCP\IConfig;
use OCP\Security\ISecureRandom;
class Migrator {
@@ -28,13 +29,18 @@ class Migrator {
*/
private $random;
+ /** @var IConfig */
+ protected $config;
+
/**
* @param \Doctrine\DBAL\Connection $connection
* @param ISecureRandom $random
+ * @param IConfig $config
*/
- public function __construct(\Doctrine\DBAL\Connection $connection, ISecureRandom $random) {
+ public function __construct(\Doctrine\DBAL\Connection $connection, ISecureRandom $random, IConfig $config) {
$this->connection = $connection;
$this->random = $random;
+ $this->config = $config;
}
/**
diff --git a/lib/private/db/sqlitemigrator.php b/lib/private/db/sqlitemigrator.php
index 848e4986571..42b65634645 100644
--- a/lib/private/db/sqlitemigrator.php
+++ b/lib/private/db/sqlitemigrator.php
@@ -10,26 +10,10 @@ namespace OC\DB;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\Schema;
-use OCP\Security\ISecureRandom;
class SQLiteMigrator extends Migrator {
/**
- * @var \OCP\IConfig
- */
- private $config;
-
- /**
- * @param \Doctrine\DBAL\Connection $connection
- * @param ISecureRandom $random
- * @param \OCP\IConfig $config
- */
- public function __construct(\Doctrine\DBAL\Connection $connection, ISecureRandom $random, \OCP\IConfig $config) {
- parent::__construct($connection, $random);
- $this->config = $config;
- }
-
- /**
* @param \Doctrine\DBAL\Schema\Schema $targetSchema
* @throws \OC\DB\MigrationException
*