@@ -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,21 +161,21 @@ 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 | - $data['storage'] = (int)$data['storage']; |
|
| 172 | + $data['storage'] = (int) $data['storage']; |
|
| 173 | 173 | $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']); |
| 174 | 174 | $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']); |
| 175 | 175 | if ($data['storage_mtime'] == 0) { |
| 176 | 176 | $data['storage_mtime'] = $data['mtime']; |
| 177 | 177 | } |
| 178 | - $data['permissions'] = (int)$data['permissions']; |
|
| 178 | + $data['permissions'] = (int) $data['permissions']; |
|
| 179 | 179 | return new CacheEntry($data); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | FROM `*PREFIX*filecache` WHERE `parent` = ? ORDER BY `name` ASC'; |
| 204 | 204 | $result = $this->connection->executeQuery($sql, [$fileId]); |
| 205 | 205 | $files = $result->fetchAll(); |
| 206 | - return array_map(function (array $data) { |
|
| 207 | - return self::cacheEntryFromData($data, $this->mimetypeLoader);; |
|
| 206 | + return array_map(function(array $data) { |
|
| 207 | + return self::cacheEntryFromData($data, $this->mimetypeLoader); ; |
|
| 208 | 208 | }, $files); |
| 209 | 209 | } else { |
| 210 | 210 | return array(); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $queryParts[] = '`storage`'; |
| 264 | 264 | $params[] = $this->getNumericStorageId(); |
| 265 | 265 | |
| 266 | - $queryParts = array_map(function ($item) { |
|
| 266 | + $queryParts = array_map(function($item) { |
|
| 267 | 267 | return trim($item, "`"); |
| 268 | 268 | }, $queryParts); |
| 269 | 269 | $values = array_combine($queryParts, $params); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | 'path_hash', |
| 273 | 273 | ]) |
| 274 | 274 | ) { |
| 275 | - return (int)$this->connection->lastInsertId('*PREFIX*filecache'); |
|
| 275 | + return (int) $this->connection->lastInsertId('*PREFIX*filecache'); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | // The file was created in the mean time |
@@ -310,10 +310,10 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | // don't update if the data we try to set is the same as the one in the record |
| 312 | 312 | // some databases (Postgres) don't like superfluous updates |
| 313 | - $sql = 'UPDATE `*PREFIX*filecache` SET ' . implode(' = ?, ', $queryParts) . '=? ' . |
|
| 314 | - 'WHERE (' . |
|
| 315 | - implode(' <> ? OR ', $queryParts) . ' <> ? OR ' . |
|
| 316 | - implode(' IS NULL OR ', $queryParts) . ' IS NULL' . |
|
| 313 | + $sql = 'UPDATE `*PREFIX*filecache` SET '.implode(' = ?, ', $queryParts).'=? '. |
|
| 314 | + 'WHERE ('. |
|
| 315 | + implode(' <> ? OR ', $queryParts).' <> ? OR '. |
|
| 316 | + implode(' IS NULL OR ', $queryParts).' IS NULL'. |
|
| 317 | 317 | ') AND `fileid` = ? '; |
| 318 | 318 | $this->connection->executeQuery($sql, $params); |
| 319 | 319 | |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | 366 | $params[] = $value; |
| 367 | - $queryParts[] = '`' . $name . '`'; |
|
| 367 | + $queryParts[] = '`'.$name.'`'; |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | return array($queryParts, $params); |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | return -1; |
| 407 | 407 | } else { |
| 408 | 408 | $parent = $this->getParentPath($file); |
| 409 | - return (int)$this->getId($parent); |
|
| 409 | + return (int) $this->getId($parent); |
|
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | */ |
| 453 | 453 | private function getSubFolders($entry) { |
| 454 | 454 | $children = $this->getFolderContentsById($entry['fileid']); |
| 455 | - return array_filter($children, function ($child) { |
|
| 455 | + return array_filter($children, function($child) { |
|
| 456 | 456 | return $child['mimetype'] === 'httpd/unix-directory'; |
| 457 | 457 | }); |
| 458 | 458 | } |
@@ -519,14 +519,14 @@ discard block |
||
| 519 | 519 | if ($sourceData['mimetype'] === 'httpd/unix-directory') { |
| 520 | 520 | //find all child entries |
| 521 | 521 | $sql = 'SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path` LIKE ?'; |
| 522 | - $result = $this->connection->executeQuery($sql, [$sourceStorageId, $this->connection->escapeLikeParameter($sourcePath) . '/%']); |
|
| 522 | + $result = $this->connection->executeQuery($sql, [$sourceStorageId, $this->connection->escapeLikeParameter($sourcePath).'/%']); |
|
| 523 | 523 | $childEntries = $result->fetchAll(); |
| 524 | 524 | $sourceLength = strlen($sourcePath); |
| 525 | 525 | $this->connection->beginTransaction(); |
| 526 | 526 | $query = $this->connection->prepare('UPDATE `*PREFIX*filecache` SET `storage` = ?, `path` = ?, `path_hash` = ? WHERE `fileid` = ?'); |
| 527 | 527 | |
| 528 | 528 | foreach ($childEntries as $child) { |
| 529 | - $newTargetPath = $targetPath . substr($child['path'], $sourceLength); |
|
| 529 | + $newTargetPath = $targetPath.substr($child['path'], $sourceLength); |
|
| 530 | 530 | $query->execute([$targetStorageId, $newTargetPath, md5($newTargetPath), $child['fileid']]); |
| 531 | 531 | } |
| 532 | 532 | $this->connection->executeQuery($moveSql, [$targetStorageId, $targetPath, md5($targetPath), basename($targetPath), $newParentId, $sourceId]); |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | $sql = 'SELECT `size` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` = ?'; |
| 571 | 571 | $result = $this->connection->executeQuery($sql, array($this->getNumericStorageId(), $pathHash)); |
| 572 | 572 | if ($row = $result->fetch()) { |
| 573 | - if ((int)$row['size'] === -1) { |
|
| 573 | + if ((int) $row['size'] === -1) { |
|
| 574 | 574 | return self::SHALLOW; |
| 575 | 575 | } else { |
| 576 | 576 | return self::COMPLETE; |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | private function searchResultToCacheEntries(Statement $result) { |
| 616 | 616 | $files = $result->fetchAll(); |
| 617 | 617 | |
| 618 | - return array_map(function (array $data) { |
|
| 618 | + return array_map(function(array $data) { |
|
| 619 | 619 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 620 | 620 | }, $files); |
| 621 | 621 | } |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | $where = '`mimepart` = ?'; |
| 635 | 635 | } |
| 636 | 636 | $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `storage_mtime`, `mtime`, `encrypted`, `etag`, `permissions`, `checksum` |
| 637 | - FROM `*PREFIX*filecache` WHERE ' . $where . ' AND `storage` = ?'; |
|
| 637 | + FROM `*PREFIX*filecache` WHERE ' . $where.' AND `storage` = ?'; |
|
| 638 | 638 | $mimetype = $this->mimetypeLoader->getId($mimetype); |
| 639 | 639 | $result = $this->connection->executeQuery($sql, array($mimetype, $this->getNumericStorageId())); |
| 640 | 640 | |
@@ -670,20 +670,20 @@ discard block |
||
| 670 | 670 | * @return ICacheEntry[] file data |
| 671 | 671 | */ |
| 672 | 672 | public function searchByTag($tag, $userId) { |
| 673 | - $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, ' . |
|
| 674 | - '`mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, ' . |
|
| 675 | - '`encrypted`, `etag`, `permissions`, `checksum` ' . |
|
| 676 | - 'FROM `*PREFIX*filecache` `file`, ' . |
|
| 677 | - '`*PREFIX*vcategory_to_object` `tagmap`, ' . |
|
| 678 | - '`*PREFIX*vcategory` `tag` ' . |
|
| 673 | + $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, '. |
|
| 674 | + '`mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, '. |
|
| 675 | + '`encrypted`, `etag`, `permissions`, `checksum` '. |
|
| 676 | + 'FROM `*PREFIX*filecache` `file`, '. |
|
| 677 | + '`*PREFIX*vcategory_to_object` `tagmap`, '. |
|
| 678 | + '`*PREFIX*vcategory` `tag` '. |
|
| 679 | 679 | // JOIN filecache to vcategory_to_object |
| 680 | - 'WHERE `file`.`fileid` = `tagmap`.`objid` ' . |
|
| 680 | + 'WHERE `file`.`fileid` = `tagmap`.`objid` '. |
|
| 681 | 681 | // JOIN vcategory_to_object to vcategory |
| 682 | - 'AND `tagmap`.`type` = `tag`.`type` ' . |
|
| 683 | - 'AND `tagmap`.`categoryid` = `tag`.`id` ' . |
|
| 682 | + 'AND `tagmap`.`type` = `tag`.`type` '. |
|
| 683 | + 'AND `tagmap`.`categoryid` = `tag`.`id` '. |
|
| 684 | 684 | // conditions |
| 685 | - 'AND `file`.`storage` = ? ' . |
|
| 686 | - 'AND `tag`.`type` = \'files\' ' . |
|
| 685 | + 'AND `file`.`storage` = ? '. |
|
| 686 | + 'AND `tag`.`type` = \'files\' '. |
|
| 687 | 687 | 'AND `tag`.`uid` = ? '; |
| 688 | 688 | if (is_int($tag)) { |
| 689 | 689 | $sql .= 'AND `tag`.`id` = ? '; |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | |
| 702 | 702 | $files = $result->fetchAll(); |
| 703 | 703 | |
| 704 | - return array_map(function (array $data) { |
|
| 704 | + return array_map(function(array $data) { |
|
| 705 | 705 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 706 | 706 | }, $files); |
| 707 | 707 | } |
@@ -737,8 +737,8 @@ discard block |
||
| 737 | 737 | } |
| 738 | 738 | if (isset($entry['mimetype']) && $entry['mimetype'] === 'httpd/unix-directory') { |
| 739 | 739 | $id = $entry['fileid']; |
| 740 | - $sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 ' . |
|
| 741 | - 'FROM `*PREFIX*filecache` ' . |
|
| 740 | + $sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 '. |
|
| 741 | + 'FROM `*PREFIX*filecache` '. |
|
| 742 | 742 | 'WHERE `parent` = ? AND `storage` = ?'; |
| 743 | 743 | $result = $this->connection->executeQuery($sql, array($id, $this->getNumericStorageId())); |
| 744 | 744 | if ($row = $result->fetch()) { |