@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | $query = $this->connection->prepare('SELECT `lock` from `*PREFIX*file_locks` WHERE `key` = ?'); |
| 156 | 156 | $query->execute([$path]); |
| 157 | - $lockValue = (int)$query->fetchColumn(); |
|
| 157 | + $lockValue = (int) $query->fetchColumn(); |
|
| 158 | 158 | if ($type === self::LOCK_SHARED) { |
| 159 | 159 | if ($this->isLocallyLocked($path)) { |
| 160 | 160 | // if we have a shared lock we kept open locally but it's released we always have at least 1 shared lock in the db |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | // since we keep shared locks we need to manually clean those |
| 293 | 293 | $lockedPaths = array_keys($this->sharedLocks); |
| 294 | - $lockedPaths = array_filter($lockedPaths, function ($path) { |
|
| 294 | + $lockedPaths = array_filter($lockedPaths, function($path) { |
|
| 295 | 295 | return $this->sharedLocks[$path]; |
| 296 | 296 | }); |
| 297 | 297 | |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | interface IDBConnection { |
| 48 | 48 | |
| 49 | - const ADD_MISSING_INDEXES_EVENT = self::class . '::ADD_MISSING_INDEXES'; |
|
| 50 | - const CHECK_MISSING_INDEXES_EVENT = self::class . '::CHECK_MISSING_INDEXES'; |
|
| 49 | + const ADD_MISSING_INDEXES_EVENT = self::class.'::ADD_MISSING_INDEXES'; |
|
| 50 | + const CHECK_MISSING_INDEXES_EVENT = self::class.'::CHECK_MISSING_INDEXES'; |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Gets the QueryBuilder for the connection. |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @return \Doctrine\DBAL\Driver\Statement The prepared statement. |
| 66 | 66 | * @since 6.0.0 |
| 67 | 67 | */ |
| 68 | - public function prepare($sql, $limit=null, $offset=null); |
|
| 68 | + public function prepare($sql, $limit = null, $offset = null); |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Executes an, optionally parameterized, SQL query. |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @return int number of inserted rows |
| 133 | 133 | * @since 16.0.0 |
| 134 | 134 | */ |
| 135 | - public function insertIgnoreConflict(string $table,array $values) : int; |
|
| 135 | + public function insertIgnoreConflict(string $table, array $values) : int; |
|
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | 138 | * Insert or update a row value |
@@ -31,21 +31,21 @@ |
||
| 31 | 31 | |
| 32 | 32 | const UNIX_TIMESTAMP_REPLACEMENT = 'cast(extract(epoch from current_timestamp) as integer)'; |
| 33 | 33 | public function fixupStatement($statement) { |
| 34 | - $statement = str_replace( '`', '"', $statement ); |
|
| 35 | - $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement ); |
|
| 34 | + $statement = str_replace('`', '"', $statement); |
|
| 35 | + $statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement); |
|
| 36 | 36 | return $statement; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * @suppress SqlInjectionChecker |
| 41 | 41 | */ |
| 42 | - public function insertIgnoreConflict(string $table,array $values) : int { |
|
| 42 | + public function insertIgnoreConflict(string $table, array $values) : int { |
|
| 43 | 43 | $builder = $this->conn->getQueryBuilder(); |
| 44 | 44 | $builder->insert($table); |
| 45 | - foreach($values as $key => $value) { |
|
| 45 | + foreach ($values as $key => $value) { |
|
| 46 | 46 | $builder->setValue($key, $builder->createNamedParameter($value)); |
| 47 | 47 | } |
| 48 | - $queryString = $builder->getSQL() . ' ON CONFLICT DO NOTHING'; |
|
| 48 | + $queryString = $builder->getSQL().' ON CONFLICT DO NOTHING'; |
|
| 49 | 49 | return $this->conn->executeUpdate($queryString, $builder->getParameters(), $builder->getParameterTypes()); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function lockTable($tableName) { |
| 70 | 70 | $this->conn->beginTransaction(); |
| 71 | - $this->conn->executeUpdate('LOCK TABLE `' .$tableName . '` IN EXCLUSIVE MODE'); |
|
| 71 | + $this->conn->executeUpdate('LOCK TABLE `'.$tableName.'` IN EXCLUSIVE MODE'); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -98,14 +98,14 @@ discard block |
||
| 98 | 98 | if (empty($compare)) { |
| 99 | 99 | $compare = array_keys($input); |
| 100 | 100 | } |
| 101 | - $query = 'INSERT INTO `' .$table . '` (`' |
|
| 102 | - . implode('`,`', array_keys($input)) . '`) SELECT ' |
|
| 103 | - . str_repeat('?,', count($input)-1).'? ' // Is there a prettier alternative? |
|
| 104 | - . 'FROM `' . $table . '` WHERE '; |
|
| 101 | + $query = 'INSERT INTO `'.$table.'` (`' |
|
| 102 | + . implode('`,`', array_keys($input)).'`) SELECT ' |
|
| 103 | + . str_repeat('?,', count($input) - 1).'? ' // Is there a prettier alternative? |
|
| 104 | + . 'FROM `'.$table.'` WHERE '; |
|
| 105 | 105 | |
| 106 | 106 | $inserts = array_values($input); |
| 107 | - foreach($compare as $key) { |
|
| 108 | - $query .= '`' . $key . '`'; |
|
| 107 | + foreach ($compare as $key) { |
|
| 108 | + $query .= '`'.$key.'`'; |
|
| 109 | 109 | if (is_null($input[$key])) { |
| 110 | 110 | $query .= ' IS NULL AND '; |
| 111 | 111 | } else { |
@@ -130,15 +130,15 @@ discard block |
||
| 130 | 130 | /** |
| 131 | 131 | * @suppress SqlInjectionChecker |
| 132 | 132 | */ |
| 133 | - public function insertIgnoreConflict(string $table,array $values) : int { |
|
| 133 | + public function insertIgnoreConflict(string $table, array $values) : int { |
|
| 134 | 134 | try { |
| 135 | 135 | $builder = $this->conn->getQueryBuilder(); |
| 136 | 136 | $builder->insert($table); |
| 137 | - foreach($values as $key => $value) { |
|
| 137 | + foreach ($values as $key => $value) { |
|
| 138 | 138 | $builder->setValue($key, $builder->createNamedParameter($value)); |
| 139 | 139 | } |
| 140 | 140 | return $builder->execute(); |
| 141 | - } catch(UniqueConstraintViolationException $e) { |
|
| 141 | + } catch (UniqueConstraintViolationException $e) { |
|
| 142 | 142 | return 0; |
| 143 | 143 | } |
| 144 | 144 | } |