aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/setup/abstractdatabase.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/setup/abstractdatabase.php')
-rw-r--r--lib/private/setup/abstractdatabase.php47
1 files changed, 32 insertions, 15 deletions
diff --git a/lib/private/setup/abstractdatabase.php b/lib/private/setup/abstractdatabase.php
index 13daf1782fc..1ec853c3b02 100644
--- a/lib/private/setup/abstractdatabase.php
+++ b/lib/private/setup/abstractdatabase.php
@@ -22,22 +22,39 @@
*/
namespace OC\Setup;
+use OCP\IConfig;
+use OCP\ILogger;
+use OCP\Security\ISecureRandom;
+
abstract class AbstractDatabase {
- /**
- * @var \OC_L10N
- */
+ /** @var \OC_L10N */
protected $trans;
+ /** @var string */
protected $dbDefinitionFile;
- protected $dbuser;
- protected $dbpassword;
- protected $dbname;
- protected $dbhost;
- protected $tableprefix;
+ /** @var string */
+ protected $dbUser;
+ /** @var string */
+ protected $dbPassword;
+ /** @var string */
+ protected $dbName;
+ /** @var string */
+ protected $dbHost;
+ /** @var string */
+ protected $tablePrefix;
+ /** @var IConfig */
+ protected $config;
+ /** @var ILogger */
+ protected $logger;
+ /** @var ISecureRandom */
+ protected $random;
- public function __construct($trans, $dbDefinitionFile) {
+ public function __construct($trans, $dbDefinitionFile, IConfig $config, ILogger $logger, ISecureRandom $random) {
$this->trans = $trans;
$this->dbDefinitionFile = $dbDefinitionFile;
+ $this->config = $config;
+ $this->logger = $logger;
+ $this->random = $random;
}
public function validate($config) {
@@ -61,17 +78,17 @@ abstract class AbstractDatabase {
$dbHost = !empty($config['dbhost']) ? $config['dbhost'] : 'localhost';
$dbTablePrefix = isset($config['dbtableprefix']) ? $config['dbtableprefix'] : 'oc_';
- \OC_Config::setValues([
+ $this->config->setSystemValues([
'dbname' => $dbName,
'dbhost' => $dbHost,
'dbtableprefix' => $dbTablePrefix,
]);
- $this->dbuser = $dbUser;
- $this->dbpassword = $dbPass;
- $this->dbname = $dbName;
- $this->dbhost = $dbHost;
- $this->tableprefix = $dbTablePrefix;
+ $this->dbUser = $dbUser;
+ $this->dbPassword = $dbPass;
+ $this->dbName = $dbName;
+ $this->dbHost = $dbHost;
+ $this->tablePrefix = $dbTablePrefix;
}
abstract public function setupDatabase($userName);