@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | /** @var Folder $folder $results */ |
| 150 | 150 | $results = $folder->search($query); |
| 151 | 151 | |
| 152 | - return array_map(function (Node $node) { |
|
| 152 | + return array_map(function(Node $node) { |
|
| 153 | 153 | if ($node instanceof Folder) { |
| 154 | 154 | return new SearchResult(new \OCA\DAV\Connector\Sabre\Directory($this->view, $node, $this->tree, $this->shareManager), $this->getHrefForNode($node)); |
| 155 | 155 | } else { |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | * @return string |
| 164 | 164 | */ |
| 165 | 165 | private function getHrefForNode(Node $node) { |
| 166 | - $base = '/files/' . $this->user->getUID(); |
|
| 167 | - return $base . $this->view->getRelativePath($node->getPath()); |
|
| 166 | + $base = '/files/'.$this->user->getUID(); |
|
| 167 | + return $base.$this->view->getRelativePath($node->getPath()); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -204,19 +204,19 @@ discard block |
||
| 204 | 204 | case Operator::OPERATION_LESS_THAN: |
| 205 | 205 | case Operator::OPERATION_IS_LIKE: |
| 206 | 206 | if (count($operator->arguments) !== 2) { |
| 207 | - throw new \InvalidArgumentException('Invalid number of arguments for ' . $trimmedType . ' operation'); |
|
| 207 | + throw new \InvalidArgumentException('Invalid number of arguments for '.$trimmedType.' operation'); |
|
| 208 | 208 | } |
| 209 | 209 | if (gettype($operator->arguments[0]) !== 'string') { |
| 210 | - throw new \InvalidArgumentException('Invalid argument 1 for ' . $trimmedType . ' operation, expected property'); |
|
| 210 | + throw new \InvalidArgumentException('Invalid argument 1 for '.$trimmedType.' operation, expected property'); |
|
| 211 | 211 | } |
| 212 | 212 | if (!($operator->arguments[1] instanceof Literal)) { |
| 213 | - throw new \InvalidArgumentException('Invalid argument 2 for ' . $trimmedType . ' operation, expected literal'); |
|
| 213 | + throw new \InvalidArgumentException('Invalid argument 2 for '.$trimmedType.' operation, expected literal'); |
|
| 214 | 214 | } |
| 215 | 215 | return new SearchComparison($trimmedType, $this->mapPropertyNameToCollumn($operator->arguments[0]), $this->castValue($operator->arguments[0], $operator->arguments[1]->value)); |
| 216 | 216 | case Operator::OPERATION_IS_COLLECTION: |
| 217 | 217 | return new SearchComparison('eq', 'mimetype', ICacheEntry::DIRECTORY_MIMETYPE); |
| 218 | 218 | default: |
| 219 | - throw new \InvalidArgumentException('Unsupported operation ' . $trimmedType. ' (' . $operator->type . ')'); |
|
| 219 | + throw new \InvalidArgumentException('Unsupported operation '.$trimmedType.' ('.$operator->type.')'); |
|
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | 222 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | case FilesPlugin::SIZE_PROPERTYNAME: |
| 243 | 243 | return 'size'; |
| 244 | 244 | default: |
| 245 | - throw new \InvalidArgumentException('Unsupported property for search or order: ' . $propertyName); |
|
| 245 | + throw new \InvalidArgumentException('Unsupported property for search or order: '.$propertyName); |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | if (!$this->isValidPath($path)) { |
| 56 | 56 | throw new NotPermittedException('Invalid path'); |
| 57 | 57 | } |
| 58 | - return $this->path . $this->normalizePath($path); |
|
| 58 | + return $this->path.$this->normalizePath($path); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | if ($path === $this->path) { |
| 70 | 70 | return '/'; |
| 71 | - } else if (strpos($path, $this->path . '/') !== 0) { |
|
| 71 | + } else if (strpos($path, $this->path.'/') !== 0) { |
|
| 72 | 72 | return null; |
| 73 | 73 | } else { |
| 74 | 74 | $path = substr($path, strlen($this->path)); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @return bool |
| 84 | 84 | */ |
| 85 | 85 | public function isSubNode($node) { |
| 86 | - return strpos($node->getPath(), $this->path . '/') === 0; |
|
| 86 | + return strpos($node->getPath(), $this->path.'/') === 0; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | public function getDirectoryListing() { |
| 96 | 96 | $folderContent = $this->view->getDirectoryContent($this->path); |
| 97 | 97 | |
| 98 | - return array_map(function (FileInfo $info) { |
|
| 98 | + return array_map(function(FileInfo $info) { |
|
| 99 | 99 | if ($info->getMimetype() === 'httpd/unix-directory') { |
| 100 | 100 | return new Folder($this->root, $this->view, $info->getPath(), $info); |
| 101 | 101 | } else { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function search($query) { |
| 198 | 198 | if (is_string($query)) { |
| 199 | - return $this->searchCommon('search', array('%' . $query . '%')); |
|
| 199 | + return $this->searchCommon('search', array('%'.$query.'%')); |
|
| 200 | 200 | } else { |
| 201 | 201 | return $this->searchCommon('searchQuery', array($query)); |
| 202 | 202 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $internalPath = $mount->getInternalPath($this->path); |
| 237 | 237 | $internalPath = rtrim($internalPath, '/'); |
| 238 | 238 | if ($internalPath !== '') { |
| 239 | - $internalPath = $internalPath . '/'; |
|
| 239 | + $internalPath = $internalPath.'/'; |
|
| 240 | 240 | } |
| 241 | 241 | $internalRootLength = strlen($internalPath); |
| 242 | 242 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $result['internalPath'] = $result['path']; |
| 249 | 249 | $result['path'] = substr($result['path'], $internalRootLength); |
| 250 | 250 | $result['storage'] = $storage; |
| 251 | - $files[] = new \OC\Files\FileInfo($this->path . '/' . $result['path'], $storage, $result['internalPath'], $result, $mount); |
|
| 251 | + $files[] = new \OC\Files\FileInfo($this->path.'/'.$result['path'], $storage, $result['internalPath'], $result, $mount); |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
@@ -262,14 +262,14 @@ discard block |
||
| 262 | 262 | $results = call_user_func_array(array($cache, $method), $args); |
| 263 | 263 | foreach ($results as $result) { |
| 264 | 264 | $result['internalPath'] = $result['path']; |
| 265 | - $result['path'] = $relativeMountPoint . $result['path']; |
|
| 265 | + $result['path'] = $relativeMountPoint.$result['path']; |
|
| 266 | 266 | $result['storage'] = $storage; |
| 267 | - $files[] = new \OC\Files\FileInfo($this->path . '/' . $result['path'], $storage, $result['internalPath'], $result, $mount); |
|
| 267 | + $files[] = new \OC\Files\FileInfo($this->path.'/'.$result['path'], $storage, $result['internalPath'], $result, $mount); |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - return array_map(function (FileInfo $file) { |
|
| 272 | + return array_map(function(FileInfo $file) { |
|
| 273 | 273 | return $this->createNode($file->getPath(), $file); |
| 274 | 274 | }, $files); |
| 275 | 275 | } |
@@ -280,16 +280,16 @@ discard block |
||
| 280 | 280 | */ |
| 281 | 281 | public function getById($id) { |
| 282 | 282 | $mountCache = $this->root->getUserMountCache(); |
| 283 | - $mountsContainingFile = $mountCache->getMountsForFileId((int)$id); |
|
| 283 | + $mountsContainingFile = $mountCache->getMountsForFileId((int) $id); |
|
| 284 | 284 | $mounts = $this->root->getMountsIn($this->path); |
| 285 | 285 | $mounts[] = $this->root->getMount($this->path); |
| 286 | 286 | /** @var IMountPoint[] $folderMounts */ |
| 287 | - $folderMounts = array_combine(array_map(function (IMountPoint $mountPoint) { |
|
| 287 | + $folderMounts = array_combine(array_map(function(IMountPoint $mountPoint) { |
|
| 288 | 288 | return $mountPoint->getMountPoint(); |
| 289 | 289 | }, $mounts), $mounts); |
| 290 | 290 | |
| 291 | 291 | /** @var ICachedMountInfo[] $mountsContainingFile */ |
| 292 | - $mountsContainingFile = array_values(array_filter($mountsContainingFile, function (ICachedMountInfo $cachedMountInfo) use ($folderMounts) { |
|
| 292 | + $mountsContainingFile = array_values(array_filter($mountsContainingFile, function(ICachedMountInfo $cachedMountInfo) use ($folderMounts) { |
|
| 293 | 293 | return isset($folderMounts[$cachedMountInfo->getMountPoint()]); |
| 294 | 294 | })); |
| 295 | 295 | |
@@ -300,25 +300,25 @@ discard block |
||
| 300 | 300 | // we only need to get the cache info once, since all mounts we found point to the same storage |
| 301 | 301 | |
| 302 | 302 | $mount = $folderMounts[$mountsContainingFile[0]->getMountPoint()]; |
| 303 | - $cacheEntry = $mount->getStorage()->getCache()->get((int)$id); |
|
| 303 | + $cacheEntry = $mount->getStorage()->getCache()->get((int) $id); |
|
| 304 | 304 | if (!$cacheEntry) { |
| 305 | 305 | return []; |
| 306 | 306 | } |
| 307 | 307 | // cache jails will hide the "true" internal path |
| 308 | - $internalPath = ltrim($mountsContainingFile[0]->getRootInternalPath() . '/' . $cacheEntry->getPath(), '/'); |
|
| 308 | + $internalPath = ltrim($mountsContainingFile[0]->getRootInternalPath().'/'.$cacheEntry->getPath(), '/'); |
|
| 309 | 309 | |
| 310 | - $nodes = array_map(function (ICachedMountInfo $cachedMountInfo) use ($cacheEntry, $folderMounts, $internalPath) { |
|
| 310 | + $nodes = array_map(function(ICachedMountInfo $cachedMountInfo) use ($cacheEntry, $folderMounts, $internalPath) { |
|
| 311 | 311 | $mount = $folderMounts[$cachedMountInfo->getMountPoint()]; |
| 312 | 312 | $pathRelativeToMount = substr($internalPath, strlen($cachedMountInfo->getRootInternalPath())); |
| 313 | 313 | $pathRelativeToMount = ltrim($pathRelativeToMount, '/'); |
| 314 | - $absolutePath = $cachedMountInfo->getMountPoint() . $pathRelativeToMount; |
|
| 314 | + $absolutePath = $cachedMountInfo->getMountPoint().$pathRelativeToMount; |
|
| 315 | 315 | return $this->root->createNode($absolutePath, new \OC\Files\FileInfo( |
| 316 | 316 | $absolutePath, $mount->getStorage(), $cacheEntry->getPath(), $cacheEntry, $mount, |
| 317 | 317 | \OC::$server->getUserManager()->get($mount->getStorage()->getOwner($pathRelativeToMount)) |
| 318 | 318 | )); |
| 319 | 319 | }, $mountsContainingFile); |
| 320 | 320 | |
| 321 | - return array_filter($nodes, function (Node $node) { |
|
| 321 | + return array_filter($nodes, function(Node $node) { |
|
| 322 | 322 | return $this->getRelativePath($node->getPath()); |
| 323 | 323 | }); |
| 324 | 324 | } |
@@ -362,10 +362,10 @@ discard block |
||
| 362 | 362 | $mounts = $this->root->getMountsIn($this->path); |
| 363 | 363 | $mounts[] = $this->getMountPoint(); |
| 364 | 364 | |
| 365 | - $mounts = array_filter($mounts, function (IMountPoint $mount) { |
|
| 365 | + $mounts = array_filter($mounts, function(IMountPoint $mount) { |
|
| 366 | 366 | return $mount->getStorage(); |
| 367 | 367 | }); |
| 368 | - $storageIds = array_map(function (IMountPoint $mount) { |
|
| 368 | + $storageIds = array_map(function(IMountPoint $mount) { |
|
| 369 | 369 | return $mount->getStorage()->getCache()->getNumericStorageId(); |
| 370 | 370 | }, $mounts); |
| 371 | 371 | /** @var IMountPoint[] $mountMap */ |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | $result = $query->execute()->fetchAll(); |
| 392 | 392 | |
| 393 | - $files = array_filter(array_map(function (array $entry) use ($mountMap, $mimetypeLoader) { |
|
| 393 | + $files = array_filter(array_map(function(array $entry) use ($mountMap, $mimetypeLoader) { |
|
| 394 | 394 | $mount = $mountMap[$entry['storage']]; |
| 395 | 395 | $entry['internalPath'] = $entry['path']; |
| 396 | 396 | $entry['mimetype'] = $mimetypeLoader->getMimetypeById($entry['mimetype']); |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | return $this->root->createNode($fileInfo->getPath(), $fileInfo); |
| 404 | 404 | }, $result)); |
| 405 | 405 | |
| 406 | - return array_values(array_filter($files, function (Node $node) { |
|
| 406 | + return array_values(array_filter($files, function(Node $node) { |
|
| 407 | 407 | $relative = $this->getRelativePath($node->getPath()); |
| 408 | 408 | return $relative !== null && $relative !== '/'; |
| 409 | 409 | })); |
@@ -417,13 +417,13 @@ discard block |
||
| 417 | 417 | $rootLength = strlen($jailRoot) + 1; |
| 418 | 418 | if ($path === $jailRoot) { |
| 419 | 419 | return $mount->getMountPoint(); |
| 420 | - } else if (substr($path, 0, $rootLength) === $jailRoot . '/') { |
|
| 421 | - return $mount->getMountPoint() . substr($path, $rootLength); |
|
| 420 | + } else if (substr($path, 0, $rootLength) === $jailRoot.'/') { |
|
| 421 | + return $mount->getMountPoint().substr($path, $rootLength); |
|
| 422 | 422 | } else { |
| 423 | 423 | return null; |
| 424 | 424 | } |
| 425 | 425 | } else { |
| 426 | - return $mount->getMountPoint() . $path; |
|
| 426 | + return $mount->getMountPoint().$path; |
|
| 427 | 427 | } |
| 428 | 428 | } |
| 429 | 429 | } |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | case ISearchBinaryOperator::OPERATOR_OR: |
| 78 | 78 | return $expr->orX($this->searchOperatorToDBExpr($builder, $operator->getArguments()[0]), $this->searchOperatorToDBExpr($builder, $operator->getArguments()[1])); |
| 79 | 79 | default: |
| 80 | - throw new \InvalidArgumentException('Invalid operator type: ' . $operator->getType()); |
|
| 80 | + throw new \InvalidArgumentException('Invalid operator type: '.$operator->getType()); |
|
| 81 | 81 | } |
| 82 | 82 | } else if ($operator instanceof ISearchComparison) { |
| 83 | 83 | return $this->searchComparisonToDBExpr($builder, $operator, self::$searchOperatorMap); |
| 84 | 84 | } else { |
| 85 | - throw new \InvalidArgumentException('Invalid operator type: ' . get_class($operator)); |
|
| 85 | + throw new \InvalidArgumentException('Invalid operator type: '.get_class($operator)); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $queryOperator = $operatorMap[$type]; |
| 95 | 95 | return $builder->expr()->$queryOperator($field, $this->getParameterForValue($builder, $value)); |
| 96 | 96 | } else { |
| 97 | - throw new \InvalidArgumentException('Invalid operator type: ' . $comparison->getType()); |
|
| 97 | + throw new \InvalidArgumentException('Invalid operator type: '.$comparison->getType()); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $type = ISearchComparison::COMPARE_EQUAL; |
| 114 | 114 | } |
| 115 | 115 | if (strpos($value, '%') !== false) { |
| 116 | - throw new \InvalidArgumentException('Unsupported query value for mimetype: ' . $value . ', only values in the format "mime/type" or "mime/%" are supported'); |
|
| 116 | + throw new \InvalidArgumentException('Unsupported query value for mimetype: '.$value.', only values in the format "mime/type" or "mime/%" are supported'); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -135,14 +135,14 @@ discard block |
||
| 135 | 135 | ]; |
| 136 | 136 | |
| 137 | 137 | if (!isset($types[$operator->getField()])) { |
| 138 | - throw new \InvalidArgumentException('Unsupported comparison field ' . $operator->getField()); |
|
| 138 | + throw new \InvalidArgumentException('Unsupported comparison field '.$operator->getField()); |
|
| 139 | 139 | } |
| 140 | 140 | $type = $types[$operator->getField()]; |
| 141 | 141 | if (gettype($operator->getValue()) !== $type) { |
| 142 | - throw new \InvalidArgumentException('Invalid type for field ' . $operator->getField()); |
|
| 142 | + throw new \InvalidArgumentException('Invalid type for field '.$operator->getField()); |
|
| 143 | 143 | } |
| 144 | 144 | if (!in_array($operator->getType(), $comparisons[$operator->getField()])) { |
| 145 | - throw new \InvalidArgumentException('Unsupported comparison for field ' . $operator->getField() . ': ' . $operator->getType()); |
|
| 145 | + throw new \InvalidArgumentException('Unsupported comparison for field '.$operator->getField().': '.$operator->getType()); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -161,20 +161,20 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) { |
| 163 | 163 | //fix types |
| 164 | - $data['fileid'] = (int)$data['fileid']; |
|
| 165 | - $data['parent'] = (int)$data['parent']; |
|
| 164 | + $data['fileid'] = (int) $data['fileid']; |
|
| 165 | + $data['parent'] = (int) $data['parent']; |
|
| 166 | 166 | $data['size'] = 0 + $data['size']; |
| 167 | - $data['mtime'] = (int)$data['mtime']; |
|
| 168 | - $data['storage_mtime'] = (int)$data['storage_mtime']; |
|
| 169 | - $data['encryptedVersion'] = (int)$data['encrypted']; |
|
| 170 | - $data['encrypted'] = (bool)$data['encrypted']; |
|
| 167 | + $data['mtime'] = (int) $data['mtime']; |
|
| 168 | + $data['storage_mtime'] = (int) $data['storage_mtime']; |
|
| 169 | + $data['encryptedVersion'] = (int) $data['encrypted']; |
|
| 170 | + $data['encrypted'] = (bool) $data['encrypted']; |
|
| 171 | 171 | $data['storage_id'] = $data['storage']; |
| 172 | 172 | $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']); |
| 173 | 173 | $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']); |
| 174 | 174 | if ($data['storage_mtime'] == 0) { |
| 175 | 175 | $data['storage_mtime'] = $data['mtime']; |
| 176 | 176 | } |
| 177 | - $data['permissions'] = (int)$data['permissions']; |
|
| 177 | + $data['permissions'] = (int) $data['permissions']; |
|
| 178 | 178 | return new CacheEntry($data); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -208,12 +208,12 @@ discard block |
||
| 208 | 208 | if ($file['storage_mtime'] == 0) { |
| 209 | 209 | $file['storage_mtime'] = $file['mtime']; |
| 210 | 210 | } |
| 211 | - $file['permissions'] = (int)$file['permissions']; |
|
| 212 | - $file['mtime'] = (int)$file['mtime']; |
|
| 213 | - $file['storage_mtime'] = (int)$file['storage_mtime']; |
|
| 211 | + $file['permissions'] = (int) $file['permissions']; |
|
| 212 | + $file['mtime'] = (int) $file['mtime']; |
|
| 213 | + $file['storage_mtime'] = (int) $file['storage_mtime']; |
|
| 214 | 214 | $file['size'] = 0 + $file['size']; |
| 215 | 215 | } |
| 216 | - return array_map(function (array $data) { |
|
| 216 | + return array_map(function(array $data) { |
|
| 217 | 217 | return new CacheEntry($data); |
| 218 | 218 | }, $files); |
| 219 | 219 | } else { |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $queryParts[] = '`storage`'; |
| 274 | 274 | $params[] = $this->getNumericStorageId(); |
| 275 | 275 | |
| 276 | - $queryParts = array_map(function ($item) { |
|
| 276 | + $queryParts = array_map(function($item) { |
|
| 277 | 277 | return trim($item, "`"); |
| 278 | 278 | }, $queryParts); |
| 279 | 279 | $values = array_combine($queryParts, $params); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | 'path_hash', |
| 283 | 283 | ]) |
| 284 | 284 | ) { |
| 285 | - return (int)$this->connection->lastInsertId('*PREFIX*filecache'); |
|
| 285 | + return (int) $this->connection->lastInsertId('*PREFIX*filecache'); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | // The file was created in the mean time |
@@ -320,10 +320,10 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | // don't update if the data we try to set is the same as the one in the record |
| 322 | 322 | // some databases (Postgres) don't like superfluous updates |
| 323 | - $sql = 'UPDATE `*PREFIX*filecache` SET ' . implode(' = ?, ', $queryParts) . '=? ' . |
|
| 324 | - 'WHERE (' . |
|
| 325 | - implode(' <> ? OR ', $queryParts) . ' <> ? OR ' . |
|
| 326 | - implode(' IS NULL OR ', $queryParts) . ' IS NULL' . |
|
| 323 | + $sql = 'UPDATE `*PREFIX*filecache` SET '.implode(' = ?, ', $queryParts).'=? '. |
|
| 324 | + 'WHERE ('. |
|
| 325 | + implode(' <> ? OR ', $queryParts).' <> ? OR '. |
|
| 326 | + implode(' IS NULL OR ', $queryParts).' IS NULL'. |
|
| 327 | 327 | ') AND `fileid` = ? '; |
| 328 | 328 | $this->connection->executeQuery($sql, $params); |
| 329 | 329 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | } |
| 376 | 376 | $params[] = $value; |
| 377 | - $queryParts[] = '`' . $name . '`'; |
|
| 377 | + $queryParts[] = '`'.$name.'`'; |
|
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | return array($queryParts, $params); |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | return -1; |
| 417 | 417 | } else { |
| 418 | 418 | $parent = $this->getParentPath($file); |
| 419 | - return (int)$this->getId($parent); |
|
| 419 | + return (int) $this->getId($parent); |
|
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | */ |
| 463 | 463 | private function getSubFolders($entry) { |
| 464 | 464 | $children = $this->getFolderContentsById($entry['fileid']); |
| 465 | - return array_filter($children, function ($child) { |
|
| 465 | + return array_filter($children, function($child) { |
|
| 466 | 466 | return $child['mimetype'] === 'httpd/unix-directory'; |
| 467 | 467 | }); |
| 468 | 468 | } |
@@ -529,14 +529,14 @@ discard block |
||
| 529 | 529 | if ($sourceData['mimetype'] === 'httpd/unix-directory') { |
| 530 | 530 | //find all child entries |
| 531 | 531 | $sql = 'SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path` LIKE ?'; |
| 532 | - $result = $this->connection->executeQuery($sql, [$sourceStorageId, $this->connection->escapeLikeParameter($sourcePath) . '/%']); |
|
| 532 | + $result = $this->connection->executeQuery($sql, [$sourceStorageId, $this->connection->escapeLikeParameter($sourcePath).'/%']); |
|
| 533 | 533 | $childEntries = $result->fetchAll(); |
| 534 | 534 | $sourceLength = strlen($sourcePath); |
| 535 | 535 | $this->connection->beginTransaction(); |
| 536 | 536 | $query = $this->connection->prepare('UPDATE `*PREFIX*filecache` SET `storage` = ?, `path` = ?, `path_hash` = ? WHERE `fileid` = ?'); |
| 537 | 537 | |
| 538 | 538 | foreach ($childEntries as $child) { |
| 539 | - $newTargetPath = $targetPath . substr($child['path'], $sourceLength); |
|
| 539 | + $newTargetPath = $targetPath.substr($child['path'], $sourceLength); |
|
| 540 | 540 | $query->execute([$targetStorageId, $newTargetPath, md5($newTargetPath), $child['fileid']]); |
| 541 | 541 | } |
| 542 | 542 | $this->connection->executeQuery($moveSql, [$targetStorageId, $targetPath, md5($targetPath), basename($targetPath), $newParentId, $sourceId]); |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | $sql = 'SELECT `size` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` = ?'; |
| 581 | 581 | $result = $this->connection->executeQuery($sql, array($this->getNumericStorageId(), $pathHash)); |
| 582 | 582 | if ($row = $result->fetch()) { |
| 583 | - if ((int)$row['size'] === -1) { |
|
| 583 | + if ((int) $row['size'] === -1) { |
|
| 584 | 584 | return self::SHALLOW; |
| 585 | 585 | } else { |
| 586 | 586 | return self::COMPLETE; |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | $row['mimepart'] = $this->mimetypeLoader->getMimetypeById($row['mimepart']); |
| 630 | 630 | $files[] = $row; |
| 631 | 631 | } |
| 632 | - return array_map(function (array $data) { |
|
| 632 | + return array_map(function(array $data) { |
|
| 633 | 633 | return new CacheEntry($data); |
| 634 | 634 | }, $files); |
| 635 | 635 | } |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | $where = '`mimepart` = ?'; |
| 649 | 649 | } |
| 650 | 650 | $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`, `permissions`, `checksum` |
| 651 | - FROM `*PREFIX*filecache` WHERE ' . $where . ' AND `storage` = ?'; |
|
| 651 | + FROM `*PREFIX*filecache` WHERE ' . $where.' AND `storage` = ?'; |
|
| 652 | 652 | $mimetype = $this->mimetypeLoader->getId($mimetype); |
| 653 | 653 | $result = $this->connection->executeQuery($sql, array($mimetype, $this->getNumericStorageId())); |
| 654 | 654 | |
@@ -684,20 +684,20 @@ discard block |
||
| 684 | 684 | * @return ICacheEntry[] file data |
| 685 | 685 | */ |
| 686 | 686 | public function searchByTag($tag, $userId) { |
| 687 | - $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, ' . |
|
| 688 | - '`mimetype`, `mimepart`, `size`, `mtime`, ' . |
|
| 689 | - '`encrypted`, `etag`, `permissions`, `checksum` ' . |
|
| 690 | - 'FROM `*PREFIX*filecache` `file`, ' . |
|
| 691 | - '`*PREFIX*vcategory_to_object` `tagmap`, ' . |
|
| 692 | - '`*PREFIX*vcategory` `tag` ' . |
|
| 687 | + $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, '. |
|
| 688 | + '`mimetype`, `mimepart`, `size`, `mtime`, '. |
|
| 689 | + '`encrypted`, `etag`, `permissions`, `checksum` '. |
|
| 690 | + 'FROM `*PREFIX*filecache` `file`, '. |
|
| 691 | + '`*PREFIX*vcategory_to_object` `tagmap`, '. |
|
| 692 | + '`*PREFIX*vcategory` `tag` '. |
|
| 693 | 693 | // JOIN filecache to vcategory_to_object |
| 694 | - 'WHERE `file`.`fileid` = `tagmap`.`objid` ' . |
|
| 694 | + 'WHERE `file`.`fileid` = `tagmap`.`objid` '. |
|
| 695 | 695 | // JOIN vcategory_to_object to vcategory |
| 696 | - 'AND `tagmap`.`type` = `tag`.`type` ' . |
|
| 697 | - 'AND `tagmap`.`categoryid` = `tag`.`id` ' . |
|
| 696 | + 'AND `tagmap`.`type` = `tag`.`type` '. |
|
| 697 | + 'AND `tagmap`.`categoryid` = `tag`.`id` '. |
|
| 698 | 698 | // conditions |
| 699 | - 'AND `file`.`storage` = ? ' . |
|
| 700 | - 'AND `tag`.`type` = \'files\' ' . |
|
| 699 | + 'AND `file`.`storage` = ? '. |
|
| 700 | + 'AND `tag`.`type` = \'files\' '. |
|
| 701 | 701 | 'AND `tag`.`uid` = ? '; |
| 702 | 702 | if (is_int($tag)) { |
| 703 | 703 | $sql .= 'AND `tag`.`id` = ? '; |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | while ($row = $result->fetch()) { |
| 717 | 717 | $files[] = $row; |
| 718 | 718 | } |
| 719 | - return array_map(function (array $data) { |
|
| 719 | + return array_map(function(array $data) { |
|
| 720 | 720 | return new CacheEntry($data); |
| 721 | 721 | }, $files); |
| 722 | 722 | } |
@@ -752,8 +752,8 @@ discard block |
||
| 752 | 752 | } |
| 753 | 753 | if (isset($entry['mimetype']) && $entry['mimetype'] === 'httpd/unix-directory') { |
| 754 | 754 | $id = $entry['fileid']; |
| 755 | - $sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 ' . |
|
| 756 | - 'FROM `*PREFIX*filecache` ' . |
|
| 755 | + $sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 '. |
|
| 756 | + 'FROM `*PREFIX*filecache` '. |
|
| 757 | 757 | 'WHERE `parent` = ? AND `storage` = ?'; |
| 758 | 758 | $result = $this->connection->executeQuery($sql, array($id, $this->getNumericStorageId())); |
| 759 | 759 | if ($row = $result->fetch()) { |