@@ -48,7 +48,7 @@ |
||
48 | 48 | public function iLike($x, $y, $type = null) { |
49 | 49 | $x = $this->helper->quoteColumnName($x); |
50 | 50 | $y = $this->helper->quoteColumnName($y); |
51 | - return $this->expressionBuilder->comparison($x, ' COLLATE ' . $this->charset . '_general_ci LIKE', $y); |
|
51 | + return $this->expressionBuilder->comparison($x, ' COLLATE '.$this->charset.'_general_ci LIKE', $y); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | public function castColumn($column, $type) { |
40 | 40 | if ($type === IQueryBuilder::PARAM_INT) { |
41 | 41 | $column = $this->helper->quoteColumnName($column); |
42 | - return new QueryFunction('CAST(' . $column . ' AS INT)'); |
|
42 | + return new QueryFunction('CAST('.$column.' AS INT)'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | return parent::castColumn($column, $type); |
@@ -48,7 +48,7 @@ |
||
48 | 48 | * @return null |
49 | 49 | */ |
50 | 50 | public function resynchronizeDatabaseSequences(Connection $conn) { |
51 | - $filterExpression = '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/'; |
|
51 | + $filterExpression = '/^'.preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')).'/'; |
|
52 | 52 | $databaseName = $conn->getDatabase(); |
53 | 53 | $conn->getConfiguration()->setFilterSchemaAssetsExpression($filterExpression); |
54 | 54 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | // fix default value in brackets - pg 9.4 is returning a negative default value in () |
38 | 38 | // see https://github.com/doctrine/dbal/issues/2427 |
39 | 39 | foreach ($tableDiff->changedColumns as $column) { |
40 | - $column->changedProperties = array_filter($column->changedProperties, function ($changedProperties) use ($column) { |
|
40 | + $column->changedProperties = array_filter($column->changedProperties, function($changedProperties) use ($column) { |
|
41 | 41 | if ($changedProperties !== 'default') { |
42 | 42 | return true; |
43 | 43 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function lockTable($tableName) { |
68 | 68 | $this->conn->beginTransaction(); |
69 | - $this->conn->executeUpdate('LOCK TABLE `' .$tableName . '` IN EXCLUSIVE MODE'); |
|
69 | + $this->conn->executeUpdate('LOCK TABLE `'.$tableName.'` IN EXCLUSIVE MODE'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | if (empty($compare)) { |
94 | 94 | $compare = array_keys($input); |
95 | 95 | } |
96 | - $query = 'INSERT INTO `' .$table . '` (`' |
|
97 | - . implode('`,`', array_keys($input)) . '`) SELECT ' |
|
98 | - . str_repeat('?,', count($input)-1).'? ' // Is there a prettier alternative? |
|
99 | - . 'FROM `' . $table . '` WHERE '; |
|
96 | + $query = 'INSERT INTO `'.$table.'` (`' |
|
97 | + . implode('`,`', array_keys($input)).'`) SELECT ' |
|
98 | + . str_repeat('?,', count($input) - 1).'? ' // Is there a prettier alternative? |
|
99 | + . 'FROM `'.$table.'` WHERE '; |
|
100 | 100 | |
101 | 101 | $inserts = array_values($input); |
102 | - foreach($compare as $key) { |
|
103 | - $query .= '`' . $key . '`'; |
|
102 | + foreach ($compare as $key) { |
|
103 | + $query .= '`'.$key.'`'; |
|
104 | 104 | if (is_null($input[$key])) { |
105 | 105 | $query .= ' IS NULL AND '; |
106 | 106 | } else { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param string $tableName |
35 | 35 | */ |
36 | 36 | public function lockTable($tableName) { |
37 | - $this->conn->executeUpdate('LOCK TABLES `' .$tableName . '` WRITE'); |
|
37 | + $this->conn->executeUpdate('LOCK TABLES `'.$tableName.'` WRITE'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function unlockTable() { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | public function fixupStatement($statement) { |
45 | - $statement = str_replace(' ILIKE ', ' COLLATE ' . $this->getCharset() . '_general_ci LIKE ', $statement); |
|
45 | + $statement = str_replace(' ILIKE ', ' COLLATE '.$this->getCharset().'_general_ci LIKE ', $statement); |
|
46 | 46 | return $statement; |
47 | 47 | } |
48 | 48 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $xml->addChild('name', $config->getSystemValue('dbname', 'owncloud')); |
44 | 44 | $xml->addChild('create', 'true'); |
45 | 45 | $xml->addChild('overwrite', 'false'); |
46 | - if($config->getSystemValue('dbtype', 'sqlite') === 'mysql' && $config->getSystemValue('mysql.utf8mb4', false)) { |
|
46 | + if ($config->getSystemValue('dbtype', 'sqlite') === 'mysql' && $config->getSystemValue('mysql.utf8mb4', false)) { |
|
47 | 47 | $xml->addChild('charset', 'utf8mb4'); |
48 | 48 | } else { |
49 | 49 | $xml->addChild('charset', 'utf8'); |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | |
52 | 52 | // FIX ME: bloody work around |
53 | 53 | if ($config->getSystemValue('dbtype', 'sqlite') === 'oci') { |
54 | - $filterExpression = '/^"' . preg_quote($conn->getPrefix()) . '/'; |
|
54 | + $filterExpression = '/^"'.preg_quote($conn->getPrefix()).'/'; |
|
55 | 55 | } else { |
56 | - $filterExpression = '/^' . preg_quote($conn->getPrefix()) . '/'; |
|
56 | + $filterExpression = '/^'.preg_quote($conn->getPrefix()).'/'; |
|
57 | 57 | } |
58 | 58 | $conn->getConfiguration()->setFilterSchemaAssetsExpression($filterExpression); |
59 | 59 | |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | private static function saveTable($table, $xml) { |
72 | 72 | $xml->addChild('name', $table->getName()); |
73 | 73 | $declaration = $xml->addChild('declaration'); |
74 | - foreach($table->getColumns() as $column) { |
|
74 | + foreach ($table->getColumns() as $column) { |
|
75 | 75 | self::saveColumn($column, $declaration->addChild('field')); |
76 | 76 | } |
77 | - foreach($table->getIndexes() as $index) { |
|
77 | + foreach ($table->getIndexes() as $index) { |
|
78 | 78 | if ($index->getName() == 'PRIMARY') { |
79 | 79 | $autoincrement = false; |
80 | - foreach($index->getColumns() as $column) { |
|
80 | + foreach ($index->getColumns() as $column) { |
|
81 | 81 | if ($table->getColumn($column)->getAutoincrement()) { |
82 | 82 | $autoincrement = true; |
83 | 83 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | private static function saveColumn($column, $xml) { |
98 | 98 | $xml->addChild('name', $column->getName()); |
99 | - switch($column->getType()) { |
|
99 | + switch ($column->getType()) { |
|
100 | 100 | case 'SmallInt': |
101 | 101 | case 'Integer': |
102 | 102 | case 'BigInt': |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | elseif ($index->isUnique()) { |
170 | 170 | $xml->addChild('unique', 'true'); |
171 | 171 | } |
172 | - foreach($index->getColumns() as $column) { |
|
172 | + foreach ($index->getColumns() as $column) { |
|
173 | 173 | $field = $xml->addChild('field'); |
174 | 174 | $field->addChild('name', $column); |
175 | 175 | $field->addChild('sorting', 'ascending'); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return string |
138 | 138 | */ |
139 | 139 | protected function generateTemporaryTableName($name) { |
140 | - return $this->config->getSystemValue('dbtableprefix', 'oc_') . $name . '_' . $this->random->generate(13, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS); |
|
140 | + return $this->config->getSystemValue('dbtableprefix', 'oc_').$name.'_'.$this->random->generate(13, ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $indexName = $index->getName(); |
189 | 189 | } else { |
190 | 190 | // avoid conflicts in index names |
191 | - $indexName = $this->config->getSystemValue('dbtableprefix', 'oc_') . $this->random->generate(13, ISecureRandom::CHAR_LOWER); |
|
191 | + $indexName = $this->config->getSystemValue('dbtableprefix', 'oc_').$this->random->generate(13, ISecureRandom::CHAR_LOWER); |
|
192 | 192 | } |
193 | 193 | $newIndexes[] = new Index($indexName, $index->getColumns(), $index->isUnique(), $index->isPrimary()); |
194 | 194 | } |
@@ -268,15 +268,15 @@ discard block |
||
268 | 268 | $quotedSource = $this->connection->quoteIdentifier($sourceName); |
269 | 269 | $quotedTarget = $this->connection->quoteIdentifier($targetName); |
270 | 270 | |
271 | - $this->connection->exec('CREATE TABLE ' . $quotedTarget . ' (LIKE ' . $quotedSource . ')'); |
|
272 | - $this->connection->exec('INSERT INTO ' . $quotedTarget . ' SELECT * FROM ' . $quotedSource); |
|
271 | + $this->connection->exec('CREATE TABLE '.$quotedTarget.' (LIKE '.$quotedSource.')'); |
|
272 | + $this->connection->exec('INSERT INTO '.$quotedTarget.' SELECT * FROM '.$quotedSource); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
276 | 276 | * @param string $name |
277 | 277 | */ |
278 | 278 | protected function dropTable($name) { |
279 | - $this->connection->exec('DROP TABLE ' . $this->connection->quoteIdentifier($name)); |
|
279 | + $this->connection->exec('DROP TABLE '.$this->connection->quoteIdentifier($name)); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -284,30 +284,30 @@ discard block |
||
284 | 284 | * @return string |
285 | 285 | */ |
286 | 286 | protected function convertStatementToScript($statement) { |
287 | - $script = $statement . ';'; |
|
287 | + $script = $statement.';'; |
|
288 | 288 | $script .= PHP_EOL; |
289 | 289 | $script .= PHP_EOL; |
290 | 290 | return $script; |
291 | 291 | } |
292 | 292 | |
293 | 293 | protected function getFilterExpression() { |
294 | - return '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/'; |
|
294 | + return '/^'.preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')).'/'; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | protected function emit($sql, $step, $max) { |
298 | 298 | if ($this->noEmit) { |
299 | 299 | return; |
300 | 300 | } |
301 | - if(is_null($this->dispatcher)) { |
|
301 | + if (is_null($this->dispatcher)) { |
|
302 | 302 | return; |
303 | 303 | } |
304 | - $this->dispatcher->dispatch('\OC\DB\Migrator::executeSql', new GenericEvent($sql, [$step+1, $max])); |
|
304 | + $this->dispatcher->dispatch('\OC\DB\Migrator::executeSql', new GenericEvent($sql, [$step + 1, $max])); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | private function emitCheckStep($tableName, $step, $max) { |
308 | - if(is_null($this->dispatcher)) { |
|
308 | + if (is_null($this->dispatcher)) { |
|
309 | 309 | return; |
310 | 310 | } |
311 | - $this->dispatcher->dispatch('\OC\DB\Migrator::checkTable', new GenericEvent($tableName, [$step+1, $max])); |
|
311 | + $this->dispatcher->dispatch('\OC\DB\Migrator::checkTable', new GenericEvent($tableName, [$step + 1, $max])); |
|
312 | 312 | } |
313 | 313 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | * @return string |
64 | 64 | */ |
65 | 65 | private function buildTempDatabase() { |
66 | - $dataDir = $this->config->getSystemValue("datadirectory", \OC::$SERVERROOT . '/data'); |
|
66 | + $dataDir = $this->config->getSystemValue("datadirectory", \OC::$SERVERROOT.'/data'); |
|
67 | 67 | $tmpFile = uniqid("oc_"); |
68 | 68 | return "$dataDir/$tmpFile.db"; |
69 | 69 | } |