@@ -186,29 +186,29 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) { |
188 | 188 | //fix types |
189 | - $data['name'] = (string)$data['name']; |
|
190 | - $data['path'] = (string)$data['path']; |
|
191 | - $data['fileid'] = (int)$data['fileid']; |
|
192 | - $data['parent'] = (int)$data['parent']; |
|
189 | + $data['name'] = (string) $data['name']; |
|
190 | + $data['path'] = (string) $data['path']; |
|
191 | + $data['fileid'] = (int) $data['fileid']; |
|
192 | + $data['parent'] = (int) $data['parent']; |
|
193 | 193 | $data['size'] = 0 + $data['size']; |
194 | 194 | $data['unencrypted_size'] = 0 + ($data['unencrypted_size'] ?? 0); |
195 | - $data['mtime'] = (int)$data['mtime']; |
|
196 | - $data['storage_mtime'] = (int)$data['storage_mtime']; |
|
197 | - $data['encryptedVersion'] = (int)$data['encrypted']; |
|
198 | - $data['encrypted'] = (bool)$data['encrypted']; |
|
195 | + $data['mtime'] = (int) $data['mtime']; |
|
196 | + $data['storage_mtime'] = (int) $data['storage_mtime']; |
|
197 | + $data['encryptedVersion'] = (int) $data['encrypted']; |
|
198 | + $data['encrypted'] = (bool) $data['encrypted']; |
|
199 | 199 | $data['storage_id'] = $data['storage']; |
200 | - $data['storage'] = (int)$data['storage']; |
|
200 | + $data['storage'] = (int) $data['storage']; |
|
201 | 201 | $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']); |
202 | 202 | $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']); |
203 | 203 | if ($data['storage_mtime'] == 0) { |
204 | 204 | $data['storage_mtime'] = $data['mtime']; |
205 | 205 | } |
206 | - $data['permissions'] = (int)$data['permissions']; |
|
206 | + $data['permissions'] = (int) $data['permissions']; |
|
207 | 207 | if (isset($data['creation_time'])) { |
208 | - $data['creation_time'] = (int)$data['creation_time']; |
|
208 | + $data['creation_time'] = (int) $data['creation_time']; |
|
209 | 209 | } |
210 | 210 | if (isset($data['upload_time'])) { |
211 | - $data['upload_time'] = (int)$data['upload_time']; |
|
211 | + $data['upload_time'] = (int) $data['upload_time']; |
|
212 | 212 | } |
213 | 213 | return new CacheEntry($data); |
214 | 214 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $files = $result->fetchAll(); |
242 | 242 | $result->closeCursor(); |
243 | 243 | |
244 | - return array_map(function (array $data) { |
|
244 | + return array_map(function(array $data) { |
|
245 | 245 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
246 | 246 | }, $files); |
247 | 247 | } |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | |
371 | 371 | $query->update('filecache') |
372 | 372 | ->whereFileId($id) |
373 | - ->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) { |
|
373 | + ->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) { |
|
374 | 374 | return $query->expr()->orX( |
375 | 375 | $query->expr()->neq($key, $query->createNamedParameter($value)), |
376 | 376 | $query->expr()->isNull($key) |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $query = $this->getQueryBuilder(); |
400 | 400 | $query->update('filecache_extended') |
401 | 401 | ->whereFileId($id) |
402 | - ->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) { |
|
402 | + ->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) { |
|
403 | 403 | return $query->expr()->orX( |
404 | 404 | $query->expr()->neq($key, $query->createNamedParameter($value)), |
405 | 405 | $query->expr()->isNull($key) |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | $id = $result->fetchOne(); |
497 | 497 | $result->closeCursor(); |
498 | 498 | |
499 | - return $id === false ? -1 : (int)$id; |
|
499 | + return $id === false ? -1 : (int) $id; |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | /** |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | return -1; |
511 | 511 | } else { |
512 | 512 | $parent = $this->getParentPath($file); |
513 | - return (int)$this->getId($parent); |
|
513 | + return (int) $this->getId($parent); |
|
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | */ |
570 | 570 | private function getSubFolders(ICacheEntry $entry) { |
571 | 571 | $children = $this->getFolderContentsById($entry->getId()); |
572 | - return array_filter($children, function ($child) { |
|
572 | + return array_filter($children, function($child) { |
|
573 | 573 | return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; |
574 | 574 | }); |
575 | 575 | } |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | // and collecting all folder ids to later use to delete the filecache entries |
589 | 589 | while ($entryId = array_pop($queue)) { |
590 | 590 | $children = $this->getFolderContentsById($entryId); |
591 | - $childIds = array_map(function (ICacheEntry $cacheEntry) { |
|
591 | + $childIds = array_map(function(ICacheEntry $cacheEntry) { |
|
592 | 592 | return $cacheEntry->getId(); |
593 | 593 | }, $children); |
594 | 594 | |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | } |
603 | 603 | |
604 | 604 | /** @var ICacheEntry[] $childFolders */ |
605 | - $childFolders = array_filter($children, function ($child) { |
|
605 | + $childFolders = array_filter($children, function($child) { |
|
606 | 606 | return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; |
607 | 607 | }); |
608 | 608 | foreach ($childFolders as $folder) { |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | |
659 | 659 | $sourceData = $sourceCache->get($sourcePath); |
660 | 660 | if ($sourceData === false) { |
661 | - throw new \Exception('Invalid source storage path: ' . $sourcePath); |
|
661 | + throw new \Exception('Invalid source storage path: '.$sourcePath); |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | $sourceId = $sourceData['fileid']; |
@@ -668,10 +668,10 @@ discard block |
||
668 | 668 | [$targetStorageId, $targetPath] = $this->getMoveInfo($targetPath); |
669 | 669 | |
670 | 670 | if (is_null($sourceStorageId) || $sourceStorageId === false) { |
671 | - throw new \Exception('Invalid source storage id: ' . $sourceStorageId); |
|
671 | + throw new \Exception('Invalid source storage id: '.$sourceStorageId); |
|
672 | 672 | } |
673 | 673 | if (is_null($targetStorageId) || $targetStorageId === false) { |
674 | - throw new \Exception('Invalid target storage id: ' . $targetStorageId); |
|
674 | + throw new \Exception('Invalid target storage id: '.$targetStorageId); |
|
675 | 675 | } |
676 | 676 | |
677 | 677 | $this->connection->beginTransaction(); |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | ->set('path_hash', $fun->md5($newPathFunction)) |
691 | 691 | ->set('path', $newPathFunction) |
692 | 692 | ->where($query->expr()->eq('storage', $query->createNamedParameter($sourceStorageId, IQueryBuilder::PARAM_INT))) |
693 | - ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath) . '/%'))); |
|
693 | + ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath).'/%'))); |
|
694 | 694 | |
695 | 695 | try { |
696 | 696 | $query->execute(); |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | $result->closeCursor(); |
770 | 770 | |
771 | 771 | if ($size !== false) { |
772 | - if ((int)$size === -1) { |
|
772 | + if ((int) $size === -1) { |
|
773 | 773 | return self::SHALLOW; |
774 | 774 | } else { |
775 | 775 | return self::COMPLETE; |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | */ |
804 | 804 | public function searchByMime($mimetype) { |
805 | 805 | if (strpos($mimetype, '/') === false) { |
806 | - $operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%'); |
|
806 | + $operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype.'/%'); |
|
807 | 807 | } else { |
808 | 808 | $operator = new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', $mimetype); |
809 | 809 | } |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | ->andWhere($query->expr()->lt('size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))); |
854 | 854 | |
855 | 855 | $result = $query->execute(); |
856 | - $size = (int)$result->fetchOne(); |
|
856 | + $size = (int) $result->fetchOne(); |
|
857 | 857 | $result->closeCursor(); |
858 | 858 | |
859 | 859 | return $size; |
@@ -886,14 +886,14 @@ discard block |
||
886 | 886 | $result->closeCursor(); |
887 | 887 | |
888 | 888 | if ($rows) { |
889 | - $sizes = array_map(function (array $row) { |
|
890 | - return (int)$row['size']; |
|
889 | + $sizes = array_map(function(array $row) { |
|
890 | + return (int) $row['size']; |
|
891 | 891 | }, $rows); |
892 | - $unencryptedOnlySizes = array_map(function (array $row) { |
|
893 | - return (int)$row['unencrypted_size']; |
|
892 | + $unencryptedOnlySizes = array_map(function(array $row) { |
|
893 | + return (int) $row['unencrypted_size']; |
|
894 | 894 | }, $rows); |
895 | - $unencryptedSizes = array_map(function (array $row) { |
|
896 | - return (int)(($row['unencrypted_size'] > 0) ? $row['unencrypted_size'] : $row['size']); |
|
895 | + $unencryptedSizes = array_map(function(array $row) { |
|
896 | + return (int) (($row['unencrypted_size'] > 0) ? $row['unencrypted_size'] : $row['size']); |
|
897 | 897 | }, $rows); |
898 | 898 | |
899 | 899 | $sum = array_sum($sizes); |
@@ -952,8 +952,8 @@ discard block |
||
952 | 952 | $files = $result->fetchAll(\PDO::FETCH_COLUMN); |
953 | 953 | $result->closeCursor(); |
954 | 954 | |
955 | - return array_map(function ($id) { |
|
956 | - return (int)$id; |
|
955 | + return array_map(function($id) { |
|
956 | + return (int) $id; |
|
957 | 957 | }, $files); |
958 | 958 | } |
959 | 959 | |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | } |
985 | 985 | |
986 | 986 | // Make sure Oracle does not continue with null for empty strings |
987 | - return (string)$path; |
|
987 | + return (string) $path; |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | /** |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | return null; |
1009 | 1009 | } |
1010 | 1010 | |
1011 | - return (string)$path; |
|
1011 | + return (string) $path; |
|
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | /** |
@@ -1069,12 +1069,12 @@ discard block |
||
1069 | 1069 | $data = $this->cacheEntryToArray($sourceEntry); |
1070 | 1070 | $fileId = $this->put($targetPath, $data); |
1071 | 1071 | if ($fileId <= 0) { |
1072 | - throw new \RuntimeException("Failed to copy to " . $targetPath . " from cache with source data " . json_encode($data) . " "); |
|
1072 | + throw new \RuntimeException("Failed to copy to ".$targetPath." from cache with source data ".json_encode($data)." "); |
|
1073 | 1073 | } |
1074 | 1074 | if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) { |
1075 | 1075 | $folderContent = $sourceCache->getFolderContentsById($sourceEntry->getId()); |
1076 | 1076 | foreach ($folderContent as $subEntry) { |
1077 | - $subTargetPath = $targetPath . '/' . $subEntry->getName(); |
|
1077 | + $subTargetPath = $targetPath.'/'.$subEntry->getName(); |
|
1078 | 1078 | $this->copyFromCache($sourceCache, $subEntry, $subTargetPath); |
1079 | 1079 | } |
1080 | 1080 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | if (PHP_VERSION_ID < 80000) { |
30 | 30 | http_response_code(500); |
31 | 31 | echo 'This version of Nextcloud requires at least PHP 8.0<br/>'; |
32 | - echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'; |
|
32 | + echo 'You are currently running '.PHP_VERSION.'. Please update your PHP version.'; |
|
33 | 33 | exit(1); |
34 | 34 | } |
35 | 35 | |
@@ -37,6 +37,6 @@ discard block |
||
37 | 37 | if (PHP_VERSION_ID >= 80300) { |
38 | 38 | http_response_code(500); |
39 | 39 | echo 'This version of Nextcloud is not compatible with PHP>=8.3.<br/>'; |
40 | - echo 'You are currently running ' . PHP_VERSION . '.'; |
|
40 | + echo 'You are currently running '.PHP_VERSION.'.'; |
|
41 | 41 | exit(1); |
42 | 42 | } |