@@ -188,29 +188,29 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) { |
190 | 190 | //fix types |
191 | - $data['name'] = (string)$data['name']; |
|
192 | - $data['path'] = (string)$data['path']; |
|
193 | - $data['fileid'] = (int)$data['fileid']; |
|
194 | - $data['parent'] = (int)$data['parent']; |
|
191 | + $data['name'] = (string) $data['name']; |
|
192 | + $data['path'] = (string) $data['path']; |
|
193 | + $data['fileid'] = (int) $data['fileid']; |
|
194 | + $data['parent'] = (int) $data['parent']; |
|
195 | 195 | $data['size'] = Util::numericToNumber($data['size']); |
196 | 196 | $data['unencrypted_size'] = Util::numericToNumber($data['unencrypted_size'] ?? 0); |
197 | - $data['mtime'] = (int)$data['mtime']; |
|
198 | - $data['storage_mtime'] = (int)$data['storage_mtime']; |
|
199 | - $data['encryptedVersion'] = (int)$data['encrypted']; |
|
200 | - $data['encrypted'] = (bool)$data['encrypted']; |
|
197 | + $data['mtime'] = (int) $data['mtime']; |
|
198 | + $data['storage_mtime'] = (int) $data['storage_mtime']; |
|
199 | + $data['encryptedVersion'] = (int) $data['encrypted']; |
|
200 | + $data['encrypted'] = (bool) $data['encrypted']; |
|
201 | 201 | $data['storage_id'] = $data['storage']; |
202 | - $data['storage'] = (int)$data['storage']; |
|
202 | + $data['storage'] = (int) $data['storage']; |
|
203 | 203 | $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']); |
204 | 204 | $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']); |
205 | 205 | if ($data['storage_mtime'] == 0) { |
206 | 206 | $data['storage_mtime'] = $data['mtime']; |
207 | 207 | } |
208 | - $data['permissions'] = (int)$data['permissions']; |
|
208 | + $data['permissions'] = (int) $data['permissions']; |
|
209 | 209 | if (isset($data['creation_time'])) { |
210 | - $data['creation_time'] = (int)$data['creation_time']; |
|
210 | + $data['creation_time'] = (int) $data['creation_time']; |
|
211 | 211 | } |
212 | 212 | if (isset($data['upload_time'])) { |
213 | - $data['upload_time'] = (int)$data['upload_time']; |
|
213 | + $data['upload_time'] = (int) $data['upload_time']; |
|
214 | 214 | } |
215 | 215 | return new CacheEntry($data); |
216 | 216 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $files = $result->fetchAll(); |
244 | 244 | $result->closeCursor(); |
245 | 245 | |
246 | - return array_map(function (array $data) { |
|
246 | + return array_map(function(array $data) { |
|
247 | 247 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
248 | 248 | }, $files); |
249 | 249 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | |
373 | 373 | $query->update('filecache') |
374 | 374 | ->whereFileId($id) |
375 | - ->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) { |
|
375 | + ->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) { |
|
376 | 376 | return $query->expr()->orX( |
377 | 377 | $query->expr()->neq($key, $query->createNamedParameter($value)), |
378 | 378 | $query->expr()->isNull($key) |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $query = $this->getQueryBuilder(); |
402 | 402 | $query->update('filecache_extended') |
403 | 403 | ->whereFileId($id) |
404 | - ->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) { |
|
404 | + ->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) { |
|
405 | 405 | return $query->expr()->orX( |
406 | 406 | $query->expr()->neq($key, $query->createNamedParameter($value)), |
407 | 407 | $query->expr()->isNull($key) |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | $id = $result->fetchOne(); |
499 | 499 | $result->closeCursor(); |
500 | 500 | |
501 | - return $id === false ? -1 : (int)$id; |
|
501 | + return $id === false ? -1 : (int) $id; |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | /** |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | return -1; |
513 | 513 | } else { |
514 | 514 | $parent = $this->getParentPath($file); |
515 | - return (int)$this->getId($parent); |
|
515 | + return (int) $this->getId($parent); |
|
516 | 516 | } |
517 | 517 | } |
518 | 518 | |
@@ -579,10 +579,10 @@ discard block |
||
579 | 579 | // and collecting all folder ids to later use to delete the filecache entries |
580 | 580 | while ($entryId = array_pop($queue)) { |
581 | 581 | $children = $this->getFolderContentsById($entryId); |
582 | - $childIds = array_map(function (ICacheEntry $cacheEntry) { |
|
582 | + $childIds = array_map(function(ICacheEntry $cacheEntry) { |
|
583 | 583 | return $cacheEntry->getId(); |
584 | 584 | }, $children); |
585 | - $childPaths = array_map(function (ICacheEntry $cacheEntry) { |
|
585 | + $childPaths = array_map(function(ICacheEntry $cacheEntry) { |
|
586 | 586 | return $cacheEntry->getPath(); |
587 | 587 | }, $children); |
588 | 588 | |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | } |
600 | 600 | |
601 | 601 | /** @var ICacheEntry[] $childFolders */ |
602 | - $childFolders = array_filter($children, function ($child) { |
|
602 | + $childFolders = array_filter($children, function($child) { |
|
603 | 603 | return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; |
604 | 604 | }); |
605 | 605 | foreach ($childFolders as $folder) { |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | |
670 | 670 | $sourceData = $sourceCache->get($sourcePath); |
671 | 671 | if ($sourceData === false) { |
672 | - throw new \Exception('Invalid source storage path: ' . $sourcePath); |
|
672 | + throw new \Exception('Invalid source storage path: '.$sourcePath); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | $sourceId = $sourceData['fileid']; |
@@ -679,10 +679,10 @@ discard block |
||
679 | 679 | [$targetStorageId, $targetPath] = $this->getMoveInfo($targetPath); |
680 | 680 | |
681 | 681 | if (is_null($sourceStorageId) || $sourceStorageId === false) { |
682 | - throw new \Exception('Invalid source storage id: ' . $sourceStorageId); |
|
682 | + throw new \Exception('Invalid source storage id: '.$sourceStorageId); |
|
683 | 683 | } |
684 | 684 | if (is_null($targetStorageId) || $targetStorageId === false) { |
685 | - throw new \Exception('Invalid target storage id: ' . $targetStorageId); |
|
685 | + throw new \Exception('Invalid target storage id: '.$targetStorageId); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | $this->connection->beginTransaction(); |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | ->set('path_hash', $fun->md5($newPathFunction)) |
702 | 702 | ->set('path', $newPathFunction) |
703 | 703 | ->where($query->expr()->eq('storage', $query->createNamedParameter($sourceStorageId, IQueryBuilder::PARAM_INT))) |
704 | - ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath) . '/%'))); |
|
704 | + ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath).'/%'))); |
|
705 | 705 | |
706 | 706 | // when moving from an encrypted storage to a non-encrypted storage remove the `encrypted` mark |
707 | 707 | if ($sourceCache->hasEncryptionWrapper() && !$this->hasEncryptionWrapper()) { |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | $result->closeCursor(); |
792 | 792 | |
793 | 793 | if ($size !== false) { |
794 | - if ((int)$size === -1) { |
|
794 | + if ((int) $size === -1) { |
|
795 | 795 | return self::SHALLOW; |
796 | 796 | } else { |
797 | 797 | return self::COMPLETE; |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | */ |
826 | 826 | public function searchByMime($mimetype) { |
827 | 827 | if (!str_contains($mimetype, '/')) { |
828 | - $operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%'); |
|
828 | + $operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype.'/%'); |
|
829 | 829 | } else { |
830 | 830 | $operator = new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', $mimetype); |
831 | 831 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | ->andWhere($query->expr()->lt('size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))); |
876 | 876 | |
877 | 877 | $result = $query->execute(); |
878 | - $size = (int)$result->fetchOne(); |
|
878 | + $size = (int) $result->fetchOne(); |
|
879 | 879 | $result->closeCursor(); |
880 | 880 | |
881 | 881 | return $size; |
@@ -924,13 +924,13 @@ discard block |
||
924 | 924 | $result->closeCursor(); |
925 | 925 | |
926 | 926 | if ($rows) { |
927 | - $sizes = array_map(function (array $row) { |
|
927 | + $sizes = array_map(function(array $row) { |
|
928 | 928 | return Util::numericToNumber($row['size']); |
929 | 929 | }, $rows); |
930 | - $unencryptedOnlySizes = array_map(function (array $row) { |
|
930 | + $unencryptedOnlySizes = array_map(function(array $row) { |
|
931 | 931 | return Util::numericToNumber($row['unencrypted_size']); |
932 | 932 | }, $rows); |
933 | - $unencryptedSizes = array_map(function (array $row) { |
|
933 | + $unencryptedSizes = array_map(function(array $row) { |
|
934 | 934 | return Util::numericToNumber(($row['unencrypted_size'] > 0) ? $row['unencrypted_size'] : $row['size']); |
935 | 935 | }, $rows); |
936 | 936 | |
@@ -997,8 +997,8 @@ discard block |
||
997 | 997 | $files = $result->fetchAll(\PDO::FETCH_COLUMN); |
998 | 998 | $result->closeCursor(); |
999 | 999 | |
1000 | - return array_map(function ($id) { |
|
1001 | - return (int)$id; |
|
1000 | + return array_map(function($id) { |
|
1001 | + return (int) $id; |
|
1002 | 1002 | }, $files); |
1003 | 1003 | } |
1004 | 1004 | |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | // Make sure Oracle does not continue with null for empty strings |
1032 | - return (string)$path; |
|
1032 | + return (string) $path; |
|
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | /** |
@@ -1053,7 +1053,7 @@ discard block |
||
1053 | 1053 | return null; |
1054 | 1054 | } |
1055 | 1055 | |
1056 | - return (string)$path; |
|
1056 | + return (string) $path; |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | /** |
@@ -1120,12 +1120,12 @@ discard block |
||
1120 | 1120 | |
1121 | 1121 | $fileId = $this->put($targetPath, $data); |
1122 | 1122 | if ($fileId <= 0) { |
1123 | - throw new \RuntimeException("Failed to copy to " . $targetPath . " from cache with source data " . json_encode($data) . " "); |
|
1123 | + throw new \RuntimeException("Failed to copy to ".$targetPath." from cache with source data ".json_encode($data)." "); |
|
1124 | 1124 | } |
1125 | 1125 | if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) { |
1126 | 1126 | $folderContent = $sourceCache->getFolderContentsById($sourceEntry->getId()); |
1127 | 1127 | foreach ($folderContent as $subEntry) { |
1128 | - $subTargetPath = $targetPath . '/' . $subEntry->getName(); |
|
1128 | + $subTargetPath = $targetPath.'/'.$subEntry->getName(); |
|
1129 | 1129 | $this->copyFromCache($sourceCache, $subEntry, $subTargetPath); |
1130 | 1130 | } |
1131 | 1131 | } |