@@ -59,19 +59,19 @@ |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | while ($mount = $mounts->fetch()) { |
62 | - $config = $this->getStorageConfig((int)$mount['mount_id']); |
|
62 | + $config = $this->getStorageConfig((int) $mount['mount_id']); |
|
63 | 63 | $hostname = $config['hostname']; |
64 | 64 | $bucket = $config['bucket']; |
65 | 65 | $key = $config['key']; |
66 | - $oldId = Storage::adjustStorageId('amazon::' . $bucket); |
|
67 | - $newId = Storage::adjustStorageId('amazon::external::' . md5($hostname . ':' . $bucket . ':' . $key)); |
|
66 | + $oldId = Storage::adjustStorageId('amazon::'.$bucket); |
|
67 | + $newId = Storage::adjustStorageId('amazon::external::'.md5($hostname.':'.$bucket.':'.$key)); |
|
68 | 68 | try { |
69 | 69 | $qb->setParameter('oldId', $oldId); |
70 | 70 | $qb->setParameter('newId', $newId); |
71 | 71 | $qb->execute(); |
72 | - $this->logger->info('Migrated s3 storage id for mount with id ' . $mount['mount_id'] . ' to ' . $newId); |
|
72 | + $this->logger->info('Migrated s3 storage id for mount with id '.$mount['mount_id'].' to '.$newId); |
|
73 | 73 | } catch (Exception $e) { |
74 | - $this->logger->error('Failed to migrate external s3 storage id for mount with id ' . $mount['mount_id'], [ |
|
74 | + $this->logger->error('Failed to migrate external s3 storage id for mount with id '.$mount['mount_id'], [ |
|
75 | 75 | 'exception' => $e |
76 | 76 | ]); |
77 | 77 | } |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public function listTrashRoot(IUser $user): array { |
46 | - $items = array_reduce($this->getBackends(), function (array $items, ITrashBackend $backend) use ($user) { |
|
46 | + $items = array_reduce($this->getBackends(), function(array $items, ITrashBackend $backend) use ($user) { |
|
47 | 47 | return array_merge($items, $backend->listTrashRoot($user)); |
48 | 48 | }, []); |
49 | - usort($items, function (ITrashItem $a, ITrashItem $b) { |
|
49 | + usort($items, function(ITrashItem $a, ITrashItem $b) { |
|
50 | 50 | return $b->getDeletedTime() - $a->getDeletedTime(); |
51 | 51 | }); |
52 | 52 | return $items; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getBackendForStorage(IStorage $storage): ITrashBackend { |
77 | 77 | $fullType = get_class($storage); |
78 | - $foundType = array_reduce(array_keys($this->backends), function ($type, $registeredType) use ($storage) { |
|
78 | + $foundType = array_reduce(array_keys($this->backends), function($type, $registeredType) use ($storage) { |
|
79 | 79 | if ( |
80 | 80 | $storage->instanceOfStorage($registeredType) && |
81 | 81 | ($type === '' || is_subclass_of($registeredType, $type)) |
@@ -33,10 +33,10 @@ |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | // Prevent writing invalid mtime (timezone-proof) |
36 | - if ((int)$mtimeFromRequest <= 24 * 60 * 60) { |
|
36 | + if ((int) $mtimeFromRequest <= 24 * 60 * 60) { |
|
37 | 37 | throw new \InvalidArgumentException('X-OC-MTime header must be a valid positive integer'); |
38 | 38 | } |
39 | 39 | |
40 | - return (int)$mtimeFromRequest; |
|
40 | + return (int) $mtimeFromRequest; |
|
41 | 41 | } |
42 | 42 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | if (isset($parsedUrl['port']) && $parsedUrl['port']) { |
73 | - return $this->isTrustedDomain($parsedUrl['host'] . ':' . $parsedUrl['port']); |
|
73 | + return $this->isTrustedDomain($parsedUrl['host'].':'.$parsedUrl['port']); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | return $this->isTrustedDomain($parsedUrl['host']); |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | if (gettype($trusted) !== 'string') { |
107 | 107 | break; |
108 | 108 | } |
109 | - $regex = '/^' . implode('[-\.a-zA-Z0-9]*', array_map(function ($v) { |
|
109 | + $regex = '/^'.implode('[-\.a-zA-Z0-9]*', array_map(function($v) { |
|
110 | 110 | return preg_quote($v, '/'); |
111 | - }, explode('*', $trusted))) . '$/i'; |
|
111 | + }, explode('*', $trusted))).'$/i'; |
|
112 | 112 | if (preg_match($regex, $domain) || preg_match($regex, $domainWithPort)) { |
113 | 113 | return true; |
114 | 114 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | protected function getPath(string $user, string $path): string { |
96 | 96 | $node = $this->rootFolder->getUserFolder($user)->get($path); |
97 | - return 'files/' . md5($node->getStorage()->getId() . '::' . trim($node->getInternalPath(), '/')); |
|
97 | + return 'files/'.md5($node->getStorage()->getId().'::'.trim($node->getInternalPath(), '/')); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | try { |
127 | 127 | $lockingProvider->acquireLock($path, $type); |
128 | - $this->config->setAppValue('testing', 'locking_' . $path, (string)$type); |
|
128 | + $this->config->setAppValue('testing', 'locking_'.$path, (string) $type); |
|
129 | 129 | return new DataResponse(); |
130 | 130 | } catch (LockedException $e) { |
131 | 131 | throw new OCSException('', Http::STATUS_LOCKED, $e); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | try { |
150 | 150 | $lockingProvider->changeLock($path, $type); |
151 | - $this->config->setAppValue('testing', 'locking_' . $path, (string)$type); |
|
151 | + $this->config->setAppValue('testing', 'locking_'.$path, (string) $type); |
|
152 | 152 | return new DataResponse(); |
153 | 153 | } catch (LockedException $e) { |
154 | 154 | throw new OCSException('', Http::STATUS_LOCKED, $e); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | try { |
173 | 173 | $lockingProvider->releaseLock($path, $type); |
174 | - $this->config->deleteAppValue('testing', 'locking_' . $path); |
|
174 | + $this->config->deleteAppValue('testing', 'locking_'.$path); |
|
175 | 175 | return new DataResponse(); |
176 | 176 | } catch (LockedException $e) { |
177 | 177 | throw new OCSException('', Http::STATUS_LOCKED, $e); |
@@ -206,12 +206,12 @@ discard block |
||
206 | 206 | if (strpos($lock, 'locking_') === 0) { |
207 | 207 | $path = substr($lock, strlen('locking_')); |
208 | 208 | |
209 | - if ($type === ILockingProvider::LOCK_EXCLUSIVE && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_EXCLUSIVE) { |
|
210 | - $lockingProvider->releaseLock($path, (int)$this->config->getAppValue('testing', $lock)); |
|
211 | - } elseif ($type === ILockingProvider::LOCK_SHARED && (int)$this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_SHARED) { |
|
212 | - $lockingProvider->releaseLock($path, (int)$this->config->getAppValue('testing', $lock)); |
|
209 | + if ($type === ILockingProvider::LOCK_EXCLUSIVE && (int) $this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_EXCLUSIVE) { |
|
210 | + $lockingProvider->releaseLock($path, (int) $this->config->getAppValue('testing', $lock)); |
|
211 | + } elseif ($type === ILockingProvider::LOCK_SHARED && (int) $this->config->getAppValue('testing', $lock) === ILockingProvider::LOCK_SHARED) { |
|
212 | + $lockingProvider->releaseLock($path, (int) $this->config->getAppValue('testing', $lock)); |
|
213 | 213 | } else { |
214 | - $lockingProvider->releaseLock($path, (int)$this->config->getAppValue('testing', $lock)); |
|
214 | + $lockingProvider->releaseLock($path, (int) $this->config->getAppValue('testing', $lock)); |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 | } |
@@ -214,7 +214,7 @@ |
||
214 | 214 | |
215 | 215 | while ($nextcloudId = array_shift($idList)) { |
216 | 216 | $update->setParameter('nextcloudId', $nextcloudId); |
217 | - $update->setParameter('invalidatedUuid', 'invalidated_' . \bin2hex(\random_bytes(6))); |
|
217 | + $update->setParameter('invalidatedUuid', 'invalidated_'.\bin2hex(\random_bytes(6))); |
|
218 | 218 | try { |
219 | 219 | $update->executeStatement(); |
220 | 220 | $this->logger->warning( |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | |
129 | 129 | sort($serverConnections); |
130 | 130 | $lastKey = array_pop($serverConnections); |
131 | - $lastNumber = (int)str_replace('s', '', $lastKey); |
|
132 | - return 's' . str_pad((string)($lastNumber + 1), 2, '0', STR_PAD_LEFT); |
|
131 | + $lastNumber = (int) str_replace('s', '', $lastKey); |
|
132 | + return 's'.str_pad((string) ($lastNumber + 1), 2, '0', STR_PAD_LEFT); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | private function getServersConfig(string $value): array { |
136 | - $regex = '/' . $value . '$/S'; |
|
136 | + $regex = '/'.$value.'$/S'; |
|
137 | 137 | |
138 | 138 | $keys = $this->config->getAppKeys('user_ldap'); |
139 | 139 | $result = []; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $query = $this->connection->getQueryBuilder(); |
161 | 161 | $query->delete('appconfig') |
162 | 162 | ->where($query->expr()->eq('appid', $query->createNamedParameter('user_ldap'))) |
163 | - ->andWhere($query->expr()->like('configkey', $query->createNamedParameter((string)$prefix . '%'))) |
|
163 | + ->andWhere($query->expr()->like('configkey', $query->createNamedParameter((string) $prefix.'%'))) |
|
164 | 164 | ->andWhere($query->expr()->notIn('configkey', $query->createNamedParameter([ |
165 | 165 | 'enabled', |
166 | 166 | 'installed_version', |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } |
226 | 226 | |
227 | 227 | if (!is_string($dn)) { |
228 | - throw new \LogicException('String expected ' . \gettype($dn) . ' given'); |
|
228 | + throw new \LogicException('String expected '.\gettype($dn).' given'); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | if (($sanitizedDn = $this->sanitizeDnCache->get($dn)) !== null) { |
@@ -53,6 +53,6 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | public function getPath(): string { |
56 | - return $this->getMountPoint() . $this->getInternalPath(); |
|
56 | + return $this->getMountPoint().$this->getInternalPath(); |
|
57 | 57 | } |
58 | 58 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | foreach ($directoryRange as $child) { |
68 | 68 | $mountPoints[] = new MountPoint( |
69 | 69 | AppdataPreviewObjectStoreStorage::class, |
70 | - '/appdata_' . $instanceId . '/preview/' . $parent . '/' . $child, |
|
70 | + '/appdata_'.$instanceId.'/preview/'.$parent.'/'.$child, |
|
71 | 71 | $this->getMultiBucketObjectStore($i), |
72 | 72 | $loader, |
73 | 73 | null, |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | $fakeRootStorage = new ObjectStoreStorage($rootStorageArguments); |
83 | 83 | $fakeRootStorageJail = new Jail([ |
84 | 84 | 'storage' => $fakeRootStorage, |
85 | - 'root' => '/appdata_' . $instanceId . '/preview', |
|
85 | + 'root' => '/appdata_'.$instanceId.'/preview', |
|
86 | 86 | ]); |
87 | 87 | |
88 | 88 | // add a fallback location to be able to fetch existing previews from the old bucket |
89 | 89 | $mountPoints[] = new MountPoint( |
90 | 90 | $fakeRootStorageJail, |
91 | - '/appdata_' . $instanceId . '/preview/old-multibucket', |
|
91 | + '/appdata_'.$instanceId.'/preview/old-multibucket', |
|
92 | 92 | null, |
93 | 93 | $loader, |
94 | 94 | null, |