@@ -182,21 +182,21 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) { |
| 184 | 184 | //fix types |
| 185 | - $data['fileid'] = (int)$data['fileid']; |
|
| 186 | - $data['parent'] = (int)$data['parent']; |
|
| 185 | + $data['fileid'] = (int) $data['fileid']; |
|
| 186 | + $data['parent'] = (int) $data['parent']; |
|
| 187 | 187 | $data['size'] = 0 + $data['size']; |
| 188 | - $data['mtime'] = (int)$data['mtime']; |
|
| 189 | - $data['storage_mtime'] = (int)$data['storage_mtime']; |
|
| 190 | - $data['encryptedVersion'] = (int)$data['encrypted']; |
|
| 191 | - $data['encrypted'] = (bool)$data['encrypted']; |
|
| 188 | + $data['mtime'] = (int) $data['mtime']; |
|
| 189 | + $data['storage_mtime'] = (int) $data['storage_mtime']; |
|
| 190 | + $data['encryptedVersion'] = (int) $data['encrypted']; |
|
| 191 | + $data['encrypted'] = (bool) $data['encrypted']; |
|
| 192 | 192 | $data['storage_id'] = $data['storage']; |
| 193 | - $data['storage'] = (int)$data['storage']; |
|
| 193 | + $data['storage'] = (int) $data['storage']; |
|
| 194 | 194 | $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']); |
| 195 | 195 | $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']); |
| 196 | 196 | if ($data['storage_mtime'] == 0) { |
| 197 | 197 | $data['storage_mtime'] = $data['mtime']; |
| 198 | 198 | } |
| 199 | - $data['permissions'] = (int)$data['permissions']; |
|
| 199 | + $data['permissions'] = (int) $data['permissions']; |
|
| 200 | 200 | if (isset($data['creation_time'])) { |
| 201 | 201 | $data['creation_time'] = (int) $data['creation_time']; |
| 202 | 202 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $files = $result->fetchAll(); |
| 235 | 235 | $result->closeCursor(); |
| 236 | 236 | |
| 237 | - return array_map(function (array $data) { |
|
| 237 | + return array_map(function(array $data) { |
|
| 238 | 238 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 239 | 239 | }, $files); |
| 240 | 240 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | |
| 364 | 364 | $query->update('filecache') |
| 365 | 365 | ->whereFileId($id) |
| 366 | - ->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) { |
|
| 366 | + ->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) { |
|
| 367 | 367 | return $query->expr()->orX( |
| 368 | 368 | $query->expr()->neq($key, $query->createNamedParameter($value)), |
| 369 | 369 | $query->expr()->isNull($key) |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $query = $this->getQueryBuilder(); |
| 393 | 393 | $query->update('filecache_extended') |
| 394 | 394 | ->whereFileId($id) |
| 395 | - ->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) { |
|
| 395 | + ->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) { |
|
| 396 | 396 | return $query->expr()->orX( |
| 397 | 397 | $query->expr()->neq($key, $query->createNamedParameter($value)), |
| 398 | 398 | $query->expr()->isNull($key) |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | $id = $result->fetchOne(); |
| 490 | 490 | $result->closeCursor(); |
| 491 | 491 | |
| 492 | - return $id === false ? -1 : (int)$id; |
|
| 492 | + return $id === false ? -1 : (int) $id; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | /** |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | return -1; |
| 504 | 504 | } else { |
| 505 | 505 | $parent = $this->getParentPath($file); |
| 506 | - return (int)$this->getId($parent); |
|
| 506 | + return (int) $this->getId($parent); |
|
| 507 | 507 | } |
| 508 | 508 | } |
| 509 | 509 | |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | */ |
| 563 | 563 | private function getSubFolders(ICacheEntry $entry) { |
| 564 | 564 | $children = $this->getFolderContentsById($entry->getId()); |
| 565 | - return array_filter($children, function ($child) { |
|
| 565 | + return array_filter($children, function($child) { |
|
| 566 | 566 | return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; |
| 567 | 567 | }); |
| 568 | 568 | } |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | // and collecting all folder ids to later use to delete the filecache entries |
| 582 | 582 | while ($entryId = array_pop($queue)) { |
| 583 | 583 | $children = $this->getFolderContentsById($entryId); |
| 584 | - $childIds = array_map(function (ICacheEntry $cacheEntry) { |
|
| 584 | + $childIds = array_map(function(ICacheEntry $cacheEntry) { |
|
| 585 | 585 | return $cacheEntry->getId(); |
| 586 | 586 | }, $children); |
| 587 | 587 | |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | $query->execute(); |
| 592 | 592 | |
| 593 | 593 | /** @var ICacheEntry[] $childFolders */ |
| 594 | - $childFolders = array_filter($children, function ($child) { |
|
| 594 | + $childFolders = array_filter($children, function($child) { |
|
| 595 | 595 | return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; |
| 596 | 596 | }); |
| 597 | 597 | foreach ($childFolders as $folder) { |
@@ -649,10 +649,10 @@ discard block |
||
| 649 | 649 | [$targetStorageId, $targetPath] = $this->getMoveInfo($targetPath); |
| 650 | 650 | |
| 651 | 651 | if (is_null($sourceStorageId) || $sourceStorageId === false) { |
| 652 | - throw new \Exception('Invalid source storage id: ' . $sourceStorageId); |
|
| 652 | + throw new \Exception('Invalid source storage id: '.$sourceStorageId); |
|
| 653 | 653 | } |
| 654 | 654 | if (is_null($targetStorageId) || $targetStorageId === false) { |
| 655 | - throw new \Exception('Invalid target storage id: ' . $targetStorageId); |
|
| 655 | + throw new \Exception('Invalid target storage id: '.$targetStorageId); |
|
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | $this->connection->beginTransaction(); |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | ->set('path_hash', $fun->md5($newPathFunction)) |
| 672 | 672 | ->set('path', $newPathFunction) |
| 673 | 673 | ->where($query->expr()->eq('storage', $query->createNamedParameter($sourceStorageId, IQueryBuilder::PARAM_INT))) |
| 674 | - ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath) . '/%'))); |
|
| 674 | + ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath).'/%'))); |
|
| 675 | 675 | |
| 676 | 676 | try { |
| 677 | 677 | $query->execute(); |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | $result->closeCursor(); |
| 751 | 751 | |
| 752 | 752 | if ($size !== false) { |
| 753 | - if ((int)$size === -1) { |
|
| 753 | + if ((int) $size === -1) { |
|
| 754 | 754 | return self::SHALLOW; |
| 755 | 755 | } else { |
| 756 | 756 | return self::COMPLETE; |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | $files = $result->fetchAll(); |
| 788 | 788 | $result->closeCursor(); |
| 789 | 789 | |
| 790 | - return array_map(function (array $data) { |
|
| 790 | + return array_map(function(array $data) { |
|
| 791 | 791 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 792 | 792 | }, $files); |
| 793 | 793 | } |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | private function searchResultToCacheEntries(IResult $result): array { |
| 800 | 800 | $files = $result->fetchAll(); |
| 801 | 801 | |
| 802 | - return array_map(function (array $data) { |
|
| 802 | + return array_map(function(array $data) { |
|
| 803 | 803 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 804 | 804 | }, $files); |
| 805 | 805 | } |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | $files = $result->fetchAll(); |
| 829 | 829 | $result->closeCursor(); |
| 830 | 830 | |
| 831 | - return array_map(function (array $data) { |
|
| 831 | + return array_map(function(array $data) { |
|
| 832 | 832 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 833 | 833 | }, $files); |
| 834 | 834 | } |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | ->andWhere($query->expr()->lt('size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))); |
| 915 | 915 | |
| 916 | 916 | $result = $query->execute(); |
| 917 | - $size = (int)$result->fetchOne(); |
|
| 917 | + $size = (int) $result->fetchOne(); |
|
| 918 | 918 | $result->closeCursor(); |
| 919 | 919 | |
| 920 | 920 | return $size; |
@@ -980,8 +980,8 @@ discard block |
||
| 980 | 980 | $files = $result->fetchAll(\PDO::FETCH_COLUMN); |
| 981 | 981 | $result->closeCursor(); |
| 982 | 982 | |
| 983 | - return array_map(function ($id) { |
|
| 984 | - return (int)$id; |
|
| 983 | + return array_map(function($id) { |
|
| 984 | + return (int) $id; |
|
| 985 | 985 | }, $files); |
| 986 | 986 | } |
| 987 | 987 | |
@@ -1092,12 +1092,12 @@ discard block |
||
| 1092 | 1092 | $data = $this->cacheEntryToArray($sourceEntry); |
| 1093 | 1093 | $fileId = $this->put($targetPath, $data); |
| 1094 | 1094 | if ($fileId <= 0) { |
| 1095 | - throw new \RuntimeException("Failed to copy to " . $targetPath . " from cache with source data " . json_encode($data) . " "); |
|
| 1095 | + throw new \RuntimeException("Failed to copy to ".$targetPath." from cache with source data ".json_encode($data)." "); |
|
| 1096 | 1096 | } |
| 1097 | 1097 | if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) { |
| 1098 | 1098 | $folderContent = $sourceCache->getFolderContentsById($sourceEntry->getId()); |
| 1099 | 1099 | foreach ($folderContent as $subEntry) { |
| 1100 | - $subTargetPath = $targetPath . '/' . $subEntry->getName(); |
|
| 1100 | + $subTargetPath = $targetPath.'/'.$subEntry->getName(); |
|
| 1101 | 1101 | $this->copyFromCache($sourceCache, $subEntry, $subTargetPath); |
| 1102 | 1102 | } |
| 1103 | 1103 | } |