@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | $this->loadContext('assembly'); |
| 74 | 74 | |
| 75 | 75 | $nodes = $this->nodes; |
| 76 | - usort($nodes, function (IFile $a, IFile $b) { |
|
| 76 | + usort($nodes, function(IFile $a, IFile $b) { |
|
| 77 | 77 | return strnatcmp($a->getName(), $b->getName()); |
| 78 | 78 | }); |
| 79 | 79 | $this->nodes = array_values($nodes); |
| 80 | - $this->size = array_reduce($this->nodes, function ($size, IFile $file) { |
|
| 80 | + $this->size = array_reduce($this->nodes, function($size, IFile $file) { |
|
| 81 | 81 | return $size + $file->getSize(); |
| 82 | 82 | }, 0); |
| 83 | 83 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | fclose($this->currentStream); |
| 157 | 157 | $currentNodeSize = $this->nodes[$this->currentNode]->getSize(); |
| 158 | 158 | if ($this->currentNodeRead < $currentNodeSize) { |
| 159 | - throw new \Exception('Stream from assembly node shorter than expected, got ' . $this->currentNodeRead . ' bytes, expected ' . $currentNodeSize); |
|
| 159 | + throw new \Exception('Stream from assembly node shorter than expected, got '.$this->currentNodeRead.' bytes, expected '.$currentNodeSize); |
|
| 160 | 160 | } |
| 161 | 161 | $this->currentNode++; |
| 162 | 162 | $this->currentNodeRead = 0; |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | if (isset($context[$name])) { |
| 254 | 254 | $context = $context[$name]; |
| 255 | 255 | } else { |
| 256 | - throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set'); |
|
| 256 | + throw new \BadMethodCallException('Invalid context, "'.$name.'" options not set'); |
|
| 257 | 257 | } |
| 258 | 258 | if (isset($context['nodes']) and is_array($context['nodes'])) { |
| 259 | 259 | $this->nodes = $context['nodes']; |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | |
| 86 | 86 | public function getAuthorizedAppConfig(): array { |
| 87 | 87 | return [ |
| 88 | - 'dav' => ['/(' . implode('|', array_keys(self::defaults)) . ')/'] |
|
| 88 | + 'dav' => ['/('.implode('|', array_keys(self::defaults)).')/'] |
|
| 89 | 89 | ]; |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -31,12 +31,12 @@ |
||
| 31 | 31 | if (is_object($link)) { |
| 32 | 32 | return spl_object_id($link); |
| 33 | 33 | } elseif (is_resource($link)) { |
| 34 | - return (int)$link; |
|
| 34 | + return (int) $link; |
|
| 35 | 35 | } elseif (is_array($link) && isset($link[0])) { |
| 36 | 36 | if (is_object($link[0])) { |
| 37 | 37 | return spl_object_id($link[0]); |
| 38 | 38 | } elseif (is_resource($link[0])) { |
| 39 | - return (int)$link[0]; |
|
| 39 | + return (int) $link[0]; |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | throw new \RuntimeException('No resource provided'); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } catch (\DomainException $e) { |
| 150 | 150 | throw new OCSForbiddenException($e->getMessage(), $e); |
| 151 | 151 | } catch (Exception $e) { |
| 152 | - $this->logger->error('Error when updating flow with id ' . $id, ['exception' => $e]); |
|
| 152 | + $this->logger->error('Error when updating flow with id '.$id, ['exception' => $e]); |
|
| 153 | 153 | throw new OCSException('An internal error occurred', $e->getCode(), $e); |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | } catch (\DomainException $e) { |
| 169 | 169 | throw new OCSForbiddenException($e->getMessage(), $e); |
| 170 | 170 | } catch (Exception $e) { |
| 171 | - $this->logger->error('Error when deleting flow with id ' . $id, ['exception' => $e]); |
|
| 171 | + $this->logger->error('Error when deleting flow with id '.$id, ['exception' => $e]); |
|
| 172 | 172 | throw new OCSException('An internal error occurred', $e->getCode(), $e); |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -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 | } |