Passed
Push — master ( 0571fd...48a8f0 )
by Blizzz
19:19 queued 08:57
created
core/Command/TwoFactorAuth/Cleanup.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -33,29 +33,29 @@
 block discarded – undo
33 33
 
34 34
 class Cleanup extends Base {
35 35
 
36
-	/** @var IRegistry */
37
-	private $registry;
36
+    /** @var IRegistry */
37
+    private $registry;
38 38
 
39
-	public function __construct(IRegistry $registry) {
40
-		parent::__construct();
39
+    public function __construct(IRegistry $registry) {
40
+        parent::__construct();
41 41
 
42
-		$this->registry = $registry;
43
-	}
42
+        $this->registry = $registry;
43
+    }
44 44
 
45
-	protected function configure() {
46
-		parent::configure();
45
+    protected function configure() {
46
+        parent::configure();
47 47
 
48
-		$this->setName('twofactorauth:cleanup');
49
-		$this->setDescription('Clean up the two-factor user-provider association of an uninstalled/removed provider');
50
-		$this->addArgument('provider-id', InputArgument::REQUIRED);
51
-	}
48
+        $this->setName('twofactorauth:cleanup');
49
+        $this->setDescription('Clean up the two-factor user-provider association of an uninstalled/removed provider');
50
+        $this->addArgument('provider-id', InputArgument::REQUIRED);
51
+    }
52 52
 
53
-	protected function execute(InputInterface $input, OutputInterface $output) {
54
-		$providerId = $input->getArgument('provider-id');
53
+    protected function execute(InputInterface $input, OutputInterface $output) {
54
+        $providerId = $input->getArgument('provider-id');
55 55
 
56
-		$this->registry->cleanUp($providerId);
56
+        $this->registry->cleanUp($providerId);
57 57
 
58
-		$output->writeln("<info>All user-provider associations for provider <options=bold>$providerId</> have been removed.</info>");
59
-	}
58
+        $output->writeln("<info>All user-provider associations for provider <options=bold>$providerId</> have been removed.</info>");
59
+    }
60 60
 
61 61
 }
Please login to merge, or discard this patch.
core/Command/TwoFactorAuth/Disable.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -32,42 +32,42 @@
 block discarded – undo
32 32
 
33 33
 class Disable extends Base {
34 34
 
35
-	/** @var ProviderManager */
36
-	private $manager;
35
+    /** @var ProviderManager */
36
+    private $manager;
37 37
 
38
-	/** @var IUserManager */
39
-	protected $userManager;
38
+    /** @var IUserManager */
39
+    protected $userManager;
40 40
 
41
-	public function __construct(ProviderManager $manager, IUserManager $userManager) {
42
-		parent::__construct('twofactorauth:disable');
43
-		$this->manager = $manager;
44
-		$this->userManager = $userManager;
45
-	}
41
+    public function __construct(ProviderManager $manager, IUserManager $userManager) {
42
+        parent::__construct('twofactorauth:disable');
43
+        $this->manager = $manager;
44
+        $this->userManager = $userManager;
45
+    }
46 46
 
47
-	protected function configure() {
48
-		parent::configure();
47
+    protected function configure() {
48
+        parent::configure();
49 49
 
50
-		$this->setName('twofactorauth:disable');
51
-		$this->setDescription('Disable two-factor authentication for a user');
52
-		$this->addArgument('uid', InputArgument::REQUIRED);
53
-		$this->addArgument('provider_id', InputArgument::REQUIRED);
54
-	}
50
+        $this->setName('twofactorauth:disable');
51
+        $this->setDescription('Disable two-factor authentication for a user');
52
+        $this->addArgument('uid', InputArgument::REQUIRED);
53
+        $this->addArgument('provider_id', InputArgument::REQUIRED);
54
+    }
55 55
 
56
-	protected function execute(InputInterface $input, OutputInterface $output) {
57
-		$uid = $input->getArgument('uid');
58
-		$providerId = $input->getArgument('provider_id');
59
-		$user = $this->userManager->get($uid);
60
-		if (is_null($user)) {
61
-			$output->writeln("<error>Invalid UID</error>");
62
-			return 1;
63
-		}
64
-		if ($this->manager->tryDisableProviderFor($providerId, $user)) {
65
-			$output->writeln("Two-factor provider <options=bold>$providerId</> disabled for user <options=bold>$uid</>.");
66
-			return 0;
67
-		} else {
68
-			$output->writeln("<error>The provider does not support this operation.</error>");
69
-			return 2;
70
-		}
71
-	}
56
+    protected function execute(InputInterface $input, OutputInterface $output) {
57
+        $uid = $input->getArgument('uid');
58
+        $providerId = $input->getArgument('provider_id');
59
+        $user = $this->userManager->get($uid);
60
+        if (is_null($user)) {
61
+            $output->writeln("<error>Invalid UID</error>");
62
+            return 1;
63
+        }
64
+        if ($this->manager->tryDisableProviderFor($providerId, $user)) {
65
+            $output->writeln("Two-factor provider <options=bold>$providerId</> disabled for user <options=bold>$uid</>.");
66
+            return 0;
67
+        } else {
68
+            $output->writeln("<error>The provider does not support this operation.</error>");
69
+            return 2;
70
+        }
71
+    }
72 72
 
73 73
 }
Please login to merge, or discard this patch.
core/Command/TwoFactorAuth/Enable.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -31,42 +31,42 @@
 block discarded – undo
31 31
 
32 32
 class Enable extends Base {
33 33
 
34
-	/** @var ProviderManager */
35
-	private $manager;
34
+    /** @var ProviderManager */
35
+    private $manager;
36 36
 
37
-	/** @var IUserManager */
38
-	protected $userManager;
37
+    /** @var IUserManager */
38
+    protected $userManager;
39 39
 
40
-	public function __construct(ProviderManager $manager, IUserManager $userManager) {
41
-		parent::__construct('twofactorauth:enable');
42
-		$this->manager = $manager;
43
-		$this->userManager = $userManager;
44
-	}
40
+    public function __construct(ProviderManager $manager, IUserManager $userManager) {
41
+        parent::__construct('twofactorauth:enable');
42
+        $this->manager = $manager;
43
+        $this->userManager = $userManager;
44
+    }
45 45
 
46
-	protected function configure() {
47
-		parent::configure();
46
+    protected function configure() {
47
+        parent::configure();
48 48
 
49
-		$this->setName('twofactorauth:enable');
50
-		$this->setDescription('Enable two-factor authentication for a user');
51
-		$this->addArgument('uid', InputArgument::REQUIRED);
52
-		$this->addArgument('provider_id', InputArgument::REQUIRED);
53
-	}
49
+        $this->setName('twofactorauth:enable');
50
+        $this->setDescription('Enable two-factor authentication for a user');
51
+        $this->addArgument('uid', InputArgument::REQUIRED);
52
+        $this->addArgument('provider_id', InputArgument::REQUIRED);
53
+    }
54 54
 
55
-	protected function execute(InputInterface $input, OutputInterface $output) {
56
-		$uid = $input->getArgument('uid');
57
-		$providerId = $input->getArgument('provider_id');
58
-		$user = $this->userManager->get($uid);
59
-		if (is_null($user)) {
60
-			$output->writeln("<error>Invalid UID</error>");
61
-			return 1;
62
-		}
63
-		if ($this->manager->tryEnableProviderFor($providerId, $user)) {
64
-			$output->writeln("Two-factor provider <options=bold>$providerId</> enabled for user <options=bold>$uid</>.");
65
-			return 0;
66
-		} else {
67
-			$output->writeln("<error>The provider does not support this operation.</error>");
68
-			return 2;
69
-		}
70
-	}
55
+    protected function execute(InputInterface $input, OutputInterface $output) {
56
+        $uid = $input->getArgument('uid');
57
+        $providerId = $input->getArgument('provider_id');
58
+        $user = $this->userManager->get($uid);
59
+        if (is_null($user)) {
60
+            $output->writeln("<error>Invalid UID</error>");
61
+            return 1;
62
+        }
63
+        if ($this->manager->tryEnableProviderFor($providerId, $user)) {
64
+            $output->writeln("Two-factor provider <options=bold>$providerId</> enabled for user <options=bold>$uid</>.");
65
+            return 0;
66
+        } else {
67
+            $output->writeln("<error>The provider does not support this operation.</error>");
68
+            return 2;
69
+        }
70
+    }
71 71
 
72 72
 }
Please login to merge, or discard this patch.
lib/public/Authentication/TwoFactorAuth/IProvidesIcons.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -34,22 +34,22 @@
 block discarded – undo
34 34
  */
35 35
 interface IProvidesIcons extends IProvider {
36 36
 
37
-	/**
38
-	 * Get the path to the light (white) icon of this provider
39
-	 *
40
-	 * @return String
41
-	 *
42
-	 * @since 15.0.0
43
-	 */
44
-	public function getLightIcon(): String;
37
+    /**
38
+     * Get the path to the light (white) icon of this provider
39
+     *
40
+     * @return String
41
+     *
42
+     * @since 15.0.0
43
+     */
44
+    public function getLightIcon(): String;
45 45
 
46
-	/**
47
-	 * Get the path to the dark (black) icon of this provider
48
-	 *
49
-	 * @return String
50
-	 *
51
-	 * @since 15.0.0
52
-	 */
53
-	public function getDarkIcon(): String;
46
+    /**
47
+     * Get the path to the dark (black) icon of this provider
48
+     *
49
+     * @return String
50
+     *
51
+     * @since 15.0.0
52
+     */
53
+    public function getDarkIcon(): String;
54 54
 
55 55
 }
Please login to merge, or discard this patch.
apps/twofactor_backupcodes/lib/Migration/CheckBackupCodes.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@
 block discarded – undo
30 30
 
31 31
 class CheckBackupCodes implements IRepairStep {
32 32
 
33
-	/** @var IJobList */
34
-	private $jobList;
33
+    /** @var IJobList */
34
+    private $jobList;
35 35
 
36
-	public function __construct(IJobList $jobList) {
37
-		$this->jobList = $jobList;
38
-	}
36
+    public function __construct(IJobList $jobList) {
37
+        $this->jobList = $jobList;
38
+    }
39 39
 
40
-	public function getName(): string {
41
-		return 'Add background job to check for backup codes';
42
-	}
40
+    public function getName(): string {
41
+        return 'Add background job to check for backup codes';
42
+    }
43 43
 
44
-	public function run(IOutput $output) {
45
-		$this->jobList->add(\OCA\TwoFactorBackupCodes\BackgroundJob\CheckBackupCodes::class);
46
-	}
44
+    public function run(IOutput $output) {
45
+        $this->jobList->add(\OCA\TwoFactorBackupCodes\BackgroundJob\CheckBackupCodes::class);
46
+    }
47 47
 
48 48
 }
Please login to merge, or discard this patch.
lib/private/Setup/Sqlite.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,10 +64,10 @@
 block discarded – undo
64 64
 	public function setupDatabase($username) {
65 65
 		$datadir = $this->config->getValue(
66 66
 			'datadirectory',
67
-			\OC::$SERVERROOT . '/data'
67
+			\OC::$SERVERROOT.'/data'
68 68
 		);
69 69
 
70
-		$sqliteFile = $datadir . '/' . $this->dbName . 'db';
70
+		$sqliteFile = $datadir.'/'.$this->dbName.'db';
71 71
 		if (file_exists($sqliteFile)) {
72 72
 			unlink($sqliteFile);
73 73
 		}
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
 use OC\DB\ConnectionFactory;
27 27
 
28 28
 class Sqlite extends AbstractDatabase {
29
-	public $dbprettyname = 'Sqlite';
29
+    public $dbprettyname = 'Sqlite';
30 30
 
31
-	public function validate($config) {
32
-		return [];
33
-	}
31
+    public function validate($config) {
32
+        return [];
33
+    }
34 34
 
35
-	public function initialize($config) {
36
-		/*
35
+    public function initialize($config) {
36
+        /*
37 37
 		 * Web: When using web based installer its not possible to set dbname
38 38
 		 * or dbtableprefix. Defaults used from ConnectionFactory and dbtype = 'sqlite'
39 39
 		 * is written to config.php.
@@ -44,32 +44,32 @@  discard block
 block discarded – undo
44 44
 		 * in connection factory configuration is obtained from config.php.
45 45
 		 */
46 46
 
47
-		$this->dbName = empty($config['dbname'])
48
-			? ConnectionFactory::DEFAULT_DBNAME
49
-			: $config['dbname'];
47
+        $this->dbName = empty($config['dbname'])
48
+            ? ConnectionFactory::DEFAULT_DBNAME
49
+            : $config['dbname'];
50 50
 
51
-		$this->tablePrefix = empty($config['dbtableprefix'])
52
-			? ConnectionFactory::DEFAULT_DBTABLEPREFIX
53
-			: $config['dbtableprefix'];
51
+        $this->tablePrefix = empty($config['dbtableprefix'])
52
+            ? ConnectionFactory::DEFAULT_DBTABLEPREFIX
53
+            : $config['dbtableprefix'];
54 54
 
55
-		if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) {
56
-			$this->config->setValue('dbname', $this->dbName);
57
-		}
55
+        if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) {
56
+            $this->config->setValue('dbname', $this->dbName);
57
+        }
58 58
 
59
-		if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) {
60
-			$this->config->setValue('dbtableprefix', $this->tablePrefix);
61
-		}
62
-	}
59
+        if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) {
60
+            $this->config->setValue('dbtableprefix', $this->tablePrefix);
61
+        }
62
+    }
63 63
 
64
-	public function setupDatabase($username) {
65
-		$datadir = $this->config->getValue(
66
-			'datadirectory',
67
-			\OC::$SERVERROOT . '/data'
68
-		);
64
+    public function setupDatabase($username) {
65
+        $datadir = $this->config->getValue(
66
+            'datadirectory',
67
+            \OC::$SERVERROOT . '/data'
68
+        );
69 69
 
70
-		$sqliteFile = $datadir . '/' . $this->dbName . 'db';
71
-		if (file_exists($sqliteFile)) {
72
-			unlink($sqliteFile);
73
-		}
74
-	}
70
+        $sqliteFile = $datadir . '/' . $this->dbName . 'db';
71
+        if (file_exists($sqliteFile)) {
72
+            unlink($sqliteFile);
73
+        }
74
+    }
75 75
 }
Please login to merge, or discard this patch.
lib/private/DB/ConnectionFactory.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 				if ($host === '') {
141 141
 					$additionalConnectionParams['dbname'] = $dbName; // use dbname as easy connect name
142 142
 				} else {
143
-					$additionalConnectionParams['dbname'] = '//' . $host . (!empty($port) ? ":{$port}" : "") . '/' . $dbName;
143
+					$additionalConnectionParams['dbname'] = '//'.$host.(!empty($port) ? ":{$port}" : "").'/'.$dbName;
144 144
 				}
145 145
 				unset($additionalConnectionParams['host']);
146 146
 				break;
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 		$name = $this->config->getValue('dbname', self::DEFAULT_DBNAME);
196 196
 
197 197
 		if ($this->normalizeType($type) === 'sqlite3') {
198
-			$dataDir = $this->config->getValue("datadirectory", \OC::$SERVERROOT . '/data');
199
-			$connectionParams['path'] = $dataDir . '/' . $name . '.db';
198
+			$dataDir = $this->config->getValue("datadirectory", \OC::$SERVERROOT.'/data');
199
+			$connectionParams['path'] = $dataDir.'/'.$name.'.db';
200 200
 		} else {
201 201
 			$host = $this->config->getValue('dbhost', '');
202 202
 			$connectionParams = array_merge($connectionParams, $this->splitHostFromPortAndSocket($host));
Please login to merge, or discard this patch.
Indentation   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -40,219 +40,219 @@
 block discarded – undo
40 40
  * Takes care of creating and configuring Doctrine connections.
41 41
  */
42 42
 class ConnectionFactory {
43
-	/** @var string default database name */
44
-	public const DEFAULT_DBNAME = 'owncloud';
43
+    /** @var string default database name */
44
+    public const DEFAULT_DBNAME = 'owncloud';
45 45
 
46
-	/** @var string default database table prefix */
47
-	public const DEFAULT_DBTABLEPREFIX = 'oc_';
46
+    /** @var string default database table prefix */
47
+    public const DEFAULT_DBTABLEPREFIX = 'oc_';
48 48
 
49
-	/**
50
-	 * @var array
51
-	 *
52
-	 * Array mapping DBMS type to default connection parameters passed to
53
-	 * \Doctrine\DBAL\DriverManager::getConnection().
54
-	 */
55
-	protected $defaultConnectionParams = [
56
-		'mysql' => [
57
-			'adapter' => AdapterMySQL::class,
58
-			'charset' => 'UTF8',
59
-			'driver' => 'pdo_mysql',
60
-			'wrapperClass' => Connection::class,
61
-		],
62
-		'oci' => [
63
-			'adapter' => AdapterOCI8::class,
64
-			'charset' => 'AL32UTF8',
65
-			'driver' => 'oci8',
66
-			'wrapperClass' => OracleConnection::class,
67
-		],
68
-		'pgsql' => [
69
-			'adapter' => AdapterPgSql::class,
70
-			'driver' => 'pdo_pgsql',
71
-			'wrapperClass' => Connection::class,
72
-		],
73
-		'sqlite3' => [
74
-			'adapter' => AdapterSqlite::class,
75
-			'driver' => 'pdo_sqlite',
76
-			'wrapperClass' => Connection::class,
77
-		],
78
-	];
49
+    /**
50
+     * @var array
51
+     *
52
+     * Array mapping DBMS type to default connection parameters passed to
53
+     * \Doctrine\DBAL\DriverManager::getConnection().
54
+     */
55
+    protected $defaultConnectionParams = [
56
+        'mysql' => [
57
+            'adapter' => AdapterMySQL::class,
58
+            'charset' => 'UTF8',
59
+            'driver' => 'pdo_mysql',
60
+            'wrapperClass' => Connection::class,
61
+        ],
62
+        'oci' => [
63
+            'adapter' => AdapterOCI8::class,
64
+            'charset' => 'AL32UTF8',
65
+            'driver' => 'oci8',
66
+            'wrapperClass' => OracleConnection::class,
67
+        ],
68
+        'pgsql' => [
69
+            'adapter' => AdapterPgSql::class,
70
+            'driver' => 'pdo_pgsql',
71
+            'wrapperClass' => Connection::class,
72
+        ],
73
+        'sqlite3' => [
74
+            'adapter' => AdapterSqlite::class,
75
+            'driver' => 'pdo_sqlite',
76
+            'wrapperClass' => Connection::class,
77
+        ],
78
+    ];
79 79
 
80
-	/** @var SystemConfig */
81
-	private $config;
80
+    /** @var SystemConfig */
81
+    private $config;
82 82
 
83
-	/**
84
-	 * ConnectionFactory constructor.
85
-	 *
86
-	 * @param SystemConfig $systemConfig
87
-	 */
88
-	public function __construct(SystemConfig $systemConfig) {
89
-		$this->config = $systemConfig;
90
-		if ($this->config->getValue('mysql.utf8mb4', false)) {
91
-			$this->defaultConnectionParams['mysql']['charset'] = 'utf8mb4';
92
-		}
93
-	}
83
+    /**
84
+     * ConnectionFactory constructor.
85
+     *
86
+     * @param SystemConfig $systemConfig
87
+     */
88
+    public function __construct(SystemConfig $systemConfig) {
89
+        $this->config = $systemConfig;
90
+        if ($this->config->getValue('mysql.utf8mb4', false)) {
91
+            $this->defaultConnectionParams['mysql']['charset'] = 'utf8mb4';
92
+        }
93
+    }
94 94
 
95
-	/**
96
-	 * @brief Get default connection parameters for a given DBMS.
97
-	 * @param string $type DBMS type
98
-	 * @throws \InvalidArgumentException If $type is invalid
99
-	 * @return array Default connection parameters.
100
-	 */
101
-	public function getDefaultConnectionParams($type) {
102
-		$normalizedType = $this->normalizeType($type);
103
-		if (!isset($this->defaultConnectionParams[$normalizedType])) {
104
-			throw new \InvalidArgumentException("Unsupported type: $type");
105
-		}
106
-		$result = $this->defaultConnectionParams[$normalizedType];
107
-		// \PDO::MYSQL_ATTR_FOUND_ROWS may not be defined, e.g. when the MySQL
108
-		// driver is missing. In this case, we won't be able to connect anyway.
109
-		if ($normalizedType === 'mysql' && defined('\PDO::MYSQL_ATTR_FOUND_ROWS')) {
110
-			$result['driverOptions'] = [
111
-				\PDO::MYSQL_ATTR_FOUND_ROWS => true,
112
-			];
113
-		}
114
-		return $result;
115
-	}
95
+    /**
96
+     * @brief Get default connection parameters for a given DBMS.
97
+     * @param string $type DBMS type
98
+     * @throws \InvalidArgumentException If $type is invalid
99
+     * @return array Default connection parameters.
100
+     */
101
+    public function getDefaultConnectionParams($type) {
102
+        $normalizedType = $this->normalizeType($type);
103
+        if (!isset($this->defaultConnectionParams[$normalizedType])) {
104
+            throw new \InvalidArgumentException("Unsupported type: $type");
105
+        }
106
+        $result = $this->defaultConnectionParams[$normalizedType];
107
+        // \PDO::MYSQL_ATTR_FOUND_ROWS may not be defined, e.g. when the MySQL
108
+        // driver is missing. In this case, we won't be able to connect anyway.
109
+        if ($normalizedType === 'mysql' && defined('\PDO::MYSQL_ATTR_FOUND_ROWS')) {
110
+            $result['driverOptions'] = [
111
+                \PDO::MYSQL_ATTR_FOUND_ROWS => true,
112
+            ];
113
+        }
114
+        return $result;
115
+    }
116 116
 
117
-	/**
118
-	 * @brief Get default connection parameters for a given DBMS.
119
-	 * @param string $type DBMS type
120
-	 * @param array $additionalConnectionParams Additional connection parameters
121
-	 * @return \OC\DB\Connection
122
-	 */
123
-	public function getConnection($type, $additionalConnectionParams) {
124
-		$normalizedType = $this->normalizeType($type);
125
-		$eventManager = new EventManager();
126
-		$eventManager->addEventSubscriber(new SetTransactionIsolationLevel());
127
-		switch ($normalizedType) {
128
-			case 'mysql':
129
-				$eventManager->addEventSubscriber(
130
-					new SQLSessionInit("SET SESSION AUTOCOMMIT=1"));
131
-				break;
132
-			case 'oci':
133
-				$eventManager->addEventSubscriber(new OracleSessionInit);
134
-				// the driverOptions are unused in dbal and need to be mapped to the parameters
135
-				if (isset($additionalConnectionParams['driverOptions'])) {
136
-					$additionalConnectionParams = array_merge($additionalConnectionParams, $additionalConnectionParams['driverOptions']);
137
-				}
138
-				$host = $additionalConnectionParams['host'];
139
-				$port = isset($additionalConnectionParams['port']) ? $additionalConnectionParams['port'] : null;
140
-				$dbName = $additionalConnectionParams['dbname'];
117
+    /**
118
+     * @brief Get default connection parameters for a given DBMS.
119
+     * @param string $type DBMS type
120
+     * @param array $additionalConnectionParams Additional connection parameters
121
+     * @return \OC\DB\Connection
122
+     */
123
+    public function getConnection($type, $additionalConnectionParams) {
124
+        $normalizedType = $this->normalizeType($type);
125
+        $eventManager = new EventManager();
126
+        $eventManager->addEventSubscriber(new SetTransactionIsolationLevel());
127
+        switch ($normalizedType) {
128
+            case 'mysql':
129
+                $eventManager->addEventSubscriber(
130
+                    new SQLSessionInit("SET SESSION AUTOCOMMIT=1"));
131
+                break;
132
+            case 'oci':
133
+                $eventManager->addEventSubscriber(new OracleSessionInit);
134
+                // the driverOptions are unused in dbal and need to be mapped to the parameters
135
+                if (isset($additionalConnectionParams['driverOptions'])) {
136
+                    $additionalConnectionParams = array_merge($additionalConnectionParams, $additionalConnectionParams['driverOptions']);
137
+                }
138
+                $host = $additionalConnectionParams['host'];
139
+                $port = isset($additionalConnectionParams['port']) ? $additionalConnectionParams['port'] : null;
140
+                $dbName = $additionalConnectionParams['dbname'];
141 141
 
142
-				// we set the connect string as dbname and unset the host to coerce doctrine into using it as connect string
143
-				if ($host === '') {
144
-					$additionalConnectionParams['dbname'] = $dbName; // use dbname as easy connect name
145
-				} else {
146
-					$additionalConnectionParams['dbname'] = '//' . $host . (!empty($port) ? ":{$port}" : "") . '/' . $dbName;
147
-				}
148
-				unset($additionalConnectionParams['host']);
149
-				break;
142
+                // we set the connect string as dbname and unset the host to coerce doctrine into using it as connect string
143
+                if ($host === '') {
144
+                    $additionalConnectionParams['dbname'] = $dbName; // use dbname as easy connect name
145
+                } else {
146
+                    $additionalConnectionParams['dbname'] = '//' . $host . (!empty($port) ? ":{$port}" : "") . '/' . $dbName;
147
+                }
148
+                unset($additionalConnectionParams['host']);
149
+                break;
150 150
 
151
-			case 'sqlite3':
152
-				$journalMode = $additionalConnectionParams['sqlite.journal_mode'];
153
-				$additionalConnectionParams['platform'] = new OCSqlitePlatform();
154
-				$eventManager->addEventSubscriber(new SQLiteSessionInit(true, $journalMode));
155
-				break;
156
-		}
157
-		/** @var Connection $connection */
158
-		$connection = DriverManager::getConnection(
159
-			array_merge($this->getDefaultConnectionParams($type), $additionalConnectionParams),
160
-			new Configuration(),
161
-			$eventManager
162
-		);
163
-		return $connection;
164
-	}
151
+            case 'sqlite3':
152
+                $journalMode = $additionalConnectionParams['sqlite.journal_mode'];
153
+                $additionalConnectionParams['platform'] = new OCSqlitePlatform();
154
+                $eventManager->addEventSubscriber(new SQLiteSessionInit(true, $journalMode));
155
+                break;
156
+        }
157
+        /** @var Connection $connection */
158
+        $connection = DriverManager::getConnection(
159
+            array_merge($this->getDefaultConnectionParams($type), $additionalConnectionParams),
160
+            new Configuration(),
161
+            $eventManager
162
+        );
163
+        return $connection;
164
+    }
165 165
 
166
-	/**
167
-	 * @brief Normalize DBMS type
168
-	 * @param string $type DBMS type
169
-	 * @return string Normalized DBMS type
170
-	 */
171
-	public function normalizeType($type) {
172
-		return $type === 'sqlite' ? 'sqlite3' : $type;
173
-	}
166
+    /**
167
+     * @brief Normalize DBMS type
168
+     * @param string $type DBMS type
169
+     * @return string Normalized DBMS type
170
+     */
171
+    public function normalizeType($type) {
172
+        return $type === 'sqlite' ? 'sqlite3' : $type;
173
+    }
174 174
 
175
-	/**
176
-	 * Checks whether the specified DBMS type is valid.
177
-	 *
178
-	 * @param string $type
179
-	 * @return bool
180
-	 */
181
-	public function isValidType($type) {
182
-		$normalizedType = $this->normalizeType($type);
183
-		return isset($this->defaultConnectionParams[$normalizedType]);
184
-	}
175
+    /**
176
+     * Checks whether the specified DBMS type is valid.
177
+     *
178
+     * @param string $type
179
+     * @return bool
180
+     */
181
+    public function isValidType($type) {
182
+        $normalizedType = $this->normalizeType($type);
183
+        return isset($this->defaultConnectionParams[$normalizedType]);
184
+    }
185 185
 
186
-	/**
187
-	 * Create the connection parameters for the config
188
-	 *
189
-	 * @return array
190
-	 */
191
-	public function createConnectionParams() {
192
-		$type = $this->config->getValue('dbtype', 'sqlite');
186
+    /**
187
+     * Create the connection parameters for the config
188
+     *
189
+     * @return array
190
+     */
191
+    public function createConnectionParams() {
192
+        $type = $this->config->getValue('dbtype', 'sqlite');
193 193
 
194
-		$connectionParams = [
195
-			'user' => $this->config->getValue('dbuser', ''),
196
-			'password' => $this->config->getValue('dbpassword', ''),
197
-		];
198
-		$name = $this->config->getValue('dbname', self::DEFAULT_DBNAME);
194
+        $connectionParams = [
195
+            'user' => $this->config->getValue('dbuser', ''),
196
+            'password' => $this->config->getValue('dbpassword', ''),
197
+        ];
198
+        $name = $this->config->getValue('dbname', self::DEFAULT_DBNAME);
199 199
 
200
-		if ($this->normalizeType($type) === 'sqlite3') {
201
-			$dataDir = $this->config->getValue("datadirectory", \OC::$SERVERROOT . '/data');
202
-			$connectionParams['path'] = $dataDir . '/' . $name . '.db';
203
-		} else {
204
-			$host = $this->config->getValue('dbhost', '');
205
-			$connectionParams = array_merge($connectionParams, $this->splitHostFromPortAndSocket($host));
206
-			$connectionParams['dbname'] = $name;
207
-		}
200
+        if ($this->normalizeType($type) === 'sqlite3') {
201
+            $dataDir = $this->config->getValue("datadirectory", \OC::$SERVERROOT . '/data');
202
+            $connectionParams['path'] = $dataDir . '/' . $name . '.db';
203
+        } else {
204
+            $host = $this->config->getValue('dbhost', '');
205
+            $connectionParams = array_merge($connectionParams, $this->splitHostFromPortAndSocket($host));
206
+            $connectionParams['dbname'] = $name;
207
+        }
208 208
 
209
-		$connectionParams['tablePrefix'] = $this->config->getValue('dbtableprefix', self::DEFAULT_DBTABLEPREFIX);
210
-		$connectionParams['sqlite.journal_mode'] = $this->config->getValue('sqlite.journal_mode', 'WAL');
209
+        $connectionParams['tablePrefix'] = $this->config->getValue('dbtableprefix', self::DEFAULT_DBTABLEPREFIX);
210
+        $connectionParams['sqlite.journal_mode'] = $this->config->getValue('sqlite.journal_mode', 'WAL');
211 211
 
212
-		//additional driver options, eg. for mysql ssl
213
-		$driverOptions = $this->config->getValue('dbdriveroptions', null);
214
-		if ($driverOptions) {
215
-			$connectionParams['driverOptions'] = $driverOptions;
216
-		}
212
+        //additional driver options, eg. for mysql ssl
213
+        $driverOptions = $this->config->getValue('dbdriveroptions', null);
214
+        if ($driverOptions) {
215
+            $connectionParams['driverOptions'] = $driverOptions;
216
+        }
217 217
 
218
-		// set default table creation options
219
-		$connectionParams['defaultTableOptions'] = [
220
-			'collate' => 'utf8_bin',
221
-			'tablePrefix' => $connectionParams['tablePrefix']
222
-		];
218
+        // set default table creation options
219
+        $connectionParams['defaultTableOptions'] = [
220
+            'collate' => 'utf8_bin',
221
+            'tablePrefix' => $connectionParams['tablePrefix']
222
+        ];
223 223
 
224
-		if ($this->config->getValue('mysql.utf8mb4', false)) {
225
-			$connectionParams['defaultTableOptions'] = [
226
-				'collate' => 'utf8mb4_bin',
227
-				'charset' => 'utf8mb4',
228
-				'row_format' => 'compressed',
229
-				'tablePrefix' => $connectionParams['tablePrefix']
230
-			];
231
-		}
224
+        if ($this->config->getValue('mysql.utf8mb4', false)) {
225
+            $connectionParams['defaultTableOptions'] = [
226
+                'collate' => 'utf8mb4_bin',
227
+                'charset' => 'utf8mb4',
228
+                'row_format' => 'compressed',
229
+                'tablePrefix' => $connectionParams['tablePrefix']
230
+            ];
231
+        }
232 232
 
233
-		return $connectionParams;
234
-	}
233
+        return $connectionParams;
234
+    }
235 235
 
236
-	/**
237
-	 * @param string $host
238
-	 * @return array
239
-	 */
240
-	protected function splitHostFromPortAndSocket($host): array {
241
-		$params = [
242
-			'host' => $host,
243
-		];
236
+    /**
237
+     * @param string $host
238
+     * @return array
239
+     */
240
+    protected function splitHostFromPortAndSocket($host): array {
241
+        $params = [
242
+            'host' => $host,
243
+        ];
244 244
 
245
-		$matches = [];
246
-		if (preg_match('/^(.*):([^\]:]+)$/', $host, $matches)) {
247
-			// Host variable carries a port or socket.
248
-			$params['host'] = $matches[1];
249
-			if (is_numeric($matches[2])) {
250
-				$params['port'] = (int) $matches[2];
251
-			} else {
252
-				$params['unix_socket'] = $matches[2];
253
-			}
254
-		}
245
+        $matches = [];
246
+        if (preg_match('/^(.*):([^\]:]+)$/', $host, $matches)) {
247
+            // Host variable carries a port or socket.
248
+            $params['host'] = $matches[1];
249
+            if (is_numeric($matches[2])) {
250
+                $params['port'] = (int) $matches[2];
251
+            } else {
252
+                $params['unix_socket'] = $matches[2];
253
+            }
254
+        }
255 255
 
256
-		return $params;
257
-	}
256
+        return $params;
257
+    }
258 258
 }
Please login to merge, or discard this patch.
core/Migrations/Version15000Date20180926101451.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 		$schema = $schemaClosure();
43 43
 
44 44
 		$table = $schema->getTable('authtoken');
45
-		$table->addColumn('password_invalid','boolean', [
45
+		$table->addColumn('password_invalid', 'boolean', [
46 46
 			'notnull' => true,
47 47
 			'default' => false,
48 48
 		]);
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -33,23 +33,23 @@
 block discarded – undo
33 33
 
34 34
 class Version15000Date20180926101451 extends SimpleMigrationStep {
35 35
 
36
-	/**
37
-	 * @param IOutput $output
38
-	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
39
-	 * @param array $options
40
-	 * @return null|ISchemaWrapper
41
-	 */
42
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
43
-		/** @var ISchemaWrapper $schema */
44
-		$schema = $schemaClosure();
45
-
46
-		$table = $schema->getTable('authtoken');
47
-		$table->addColumn('password_invalid','boolean', [
48
-			'notnull' => true,
49
-			'default' => false,
50
-		]);
51
-
52
-		return $schema;
53
-	}
36
+    /**
37
+     * @param IOutput $output
38
+     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
39
+     * @param array $options
40
+     * @return null|ISchemaWrapper
41
+     */
42
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
43
+        /** @var ISchemaWrapper $schema */
44
+        $schema = $schemaClosure();
45
+
46
+        $table = $schema->getTable('authtoken');
47
+        $table->addColumn('password_invalid','boolean', [
48
+            'notnull' => true,
49
+            'default' => false,
50
+        ]);
51
+
52
+        return $schema;
53
+    }
54 54
 
55 55
 }
Please login to merge, or discard this patch.
lib/public/Authentication/TwoFactorAuth/IPersonalProviderSettings.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@
 block discarded – undo
33 33
  */
34 34
 interface IPersonalProviderSettings {
35 35
 
36
-	/**
37
-	 * @return Template
38
-	 *
39
-	 * @since 15.0.0
40
-	 */
41
-	public function getBody(): Template;
36
+    /**
37
+     * @return Template
38
+     *
39
+     * @since 15.0.0
40
+     */
41
+    public function getBody(): Template;
42 42
 
43 43
 }
Please login to merge, or discard this patch.