@@ -172,21 +172,21 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) { |
| 174 | 174 | //fix types |
| 175 | - $data['fileid'] = (int)$data['fileid']; |
|
| 176 | - $data['parent'] = (int)$data['parent']; |
|
| 175 | + $data['fileid'] = (int) $data['fileid']; |
|
| 176 | + $data['parent'] = (int) $data['parent']; |
|
| 177 | 177 | $data['size'] = 0 + $data['size']; |
| 178 | - $data['mtime'] = (int)$data['mtime']; |
|
| 179 | - $data['storage_mtime'] = (int)$data['storage_mtime']; |
|
| 180 | - $data['encryptedVersion'] = (int)$data['encrypted']; |
|
| 181 | - $data['encrypted'] = (bool)$data['encrypted']; |
|
| 178 | + $data['mtime'] = (int) $data['mtime']; |
|
| 179 | + $data['storage_mtime'] = (int) $data['storage_mtime']; |
|
| 180 | + $data['encryptedVersion'] = (int) $data['encrypted']; |
|
| 181 | + $data['encrypted'] = (bool) $data['encrypted']; |
|
| 182 | 182 | $data['storage_id'] = $data['storage']; |
| 183 | - $data['storage'] = (int)$data['storage']; |
|
| 183 | + $data['storage'] = (int) $data['storage']; |
|
| 184 | 184 | $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']); |
| 185 | 185 | $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']); |
| 186 | 186 | if ($data['storage_mtime'] == 0) { |
| 187 | 187 | $data['storage_mtime'] = $data['mtime']; |
| 188 | 188 | } |
| 189 | - $data['permissions'] = (int)$data['permissions']; |
|
| 189 | + $data['permissions'] = (int) $data['permissions']; |
|
| 190 | 190 | if (isset($data['creation_time'])) { |
| 191 | 191 | $data['creation_time'] = (int) $data['creation_time']; |
| 192 | 192 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | ->orderBy('name', 'ASC'); |
| 222 | 222 | |
| 223 | 223 | $files = $query->execute()->fetchAll(); |
| 224 | - return array_map(function (array $data) { |
|
| 224 | + return array_map(function(array $data) { |
|
| 225 | 225 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 226 | 226 | }, $files); |
| 227 | 227 | } |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | |
| 350 | 350 | $query->update('filecache') |
| 351 | 351 | ->whereFileId($id) |
| 352 | - ->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) { |
|
| 352 | + ->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) { |
|
| 353 | 353 | return $query->expr()->orX( |
| 354 | 354 | $query->expr()->neq($key, $query->createNamedParameter($value)), |
| 355 | 355 | $query->expr()->isNull($key) |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $query = $this->getQueryBuilder(); |
| 379 | 379 | $query->update('filecache_extended') |
| 380 | 380 | ->whereFileId($id) |
| 381 | - ->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) { |
|
| 381 | + ->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) { |
|
| 382 | 382 | return $query->expr()->orX( |
| 383 | 383 | $query->expr()->neq($key, $query->createNamedParameter($value)), |
| 384 | 384 | $query->expr()->isNull($key) |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | ->wherePath($file); |
| 471 | 471 | |
| 472 | 472 | $id = $query->execute()->fetchColumn(); |
| 473 | - return $id === false ? -1 : (int)$id; |
|
| 473 | + return $id === false ? -1 : (int) $id; |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | /** |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | return -1; |
| 485 | 485 | } else { |
| 486 | 486 | $parent = $this->getParentPath($file); |
| 487 | - return (int)$this->getId($parent); |
|
| 487 | + return (int) $this->getId($parent); |
|
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | 490 | |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | */ |
| 542 | 542 | private function getSubFolders(ICacheEntry $entry) { |
| 543 | 543 | $children = $this->getFolderContentsById($entry->getId()); |
| 544 | - return array_filter($children, function ($child) { |
|
| 544 | + return array_filter($children, function($child) { |
|
| 545 | 545 | return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; |
| 546 | 546 | }); |
| 547 | 547 | } |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | // and collecting all folder ids to later use to delete the filecache entries |
| 561 | 561 | while ($entryId = array_pop($queue)) { |
| 562 | 562 | $children = $this->getFolderContentsById($entryId); |
| 563 | - $childIds = array_map(function (ICacheEntry $cacheEntry) { |
|
| 563 | + $childIds = array_map(function(ICacheEntry $cacheEntry) { |
|
| 564 | 564 | return $cacheEntry->getId(); |
| 565 | 565 | }, $children); |
| 566 | 566 | |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | $query->execute(); |
| 571 | 571 | |
| 572 | 572 | /** @var ICacheEntry[] $childFolders */ |
| 573 | - $childFolders = array_filter($children, function ($child) { |
|
| 573 | + $childFolders = array_filter($children, function($child) { |
|
| 574 | 574 | return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; |
| 575 | 575 | }); |
| 576 | 576 | foreach ($childFolders as $folder) { |
@@ -629,10 +629,10 @@ discard block |
||
| 629 | 629 | [$targetStorageId, $targetPath] = $this->getMoveInfo($targetPath); |
| 630 | 630 | |
| 631 | 631 | if (is_null($sourceStorageId) || $sourceStorageId === false) { |
| 632 | - throw new \Exception('Invalid source storage id: ' . $sourceStorageId); |
|
| 632 | + throw new \Exception('Invalid source storage id: '.$sourceStorageId); |
|
| 633 | 633 | } |
| 634 | 634 | if (is_null($targetStorageId) || $targetStorageId === false) { |
| 635 | - throw new \Exception('Invalid target storage id: ' . $targetStorageId); |
|
| 635 | + throw new \Exception('Invalid target storage id: '.$targetStorageId); |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | $this->connection->beginTransaction(); |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | ->set('path_hash', $fun->md5($newPathFunction)) |
| 652 | 652 | ->set('path', $newPathFunction) |
| 653 | 653 | ->where($query->expr()->eq('storage', $query->createNamedParameter($sourceStorageId, IQueryBuilder::PARAM_INT))) |
| 654 | - ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath) . '/%'))); |
|
| 654 | + ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath).'/%'))); |
|
| 655 | 655 | |
| 656 | 656 | try { |
| 657 | 657 | $query->execute(); |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | ->wherePath($file); |
| 716 | 716 | $size = $query->execute()->fetchColumn(); |
| 717 | 717 | if ($size !== false) { |
| 718 | - if ((int)$size === -1) { |
|
| 718 | + if ((int) $size === -1) { |
|
| 719 | 719 | return self::SHALLOW; |
| 720 | 720 | } else { |
| 721 | 721 | return self::COMPLETE; |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | ->whereStorageId() |
| 749 | 749 | ->andWhere($query->expr()->iLike('name', $query->createNamedParameter($pattern))); |
| 750 | 750 | |
| 751 | - return array_map(function (array $data) { |
|
| 751 | + return array_map(function(array $data) { |
|
| 752 | 752 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 753 | 753 | }, $query->execute()->fetchAll()); |
| 754 | 754 | } |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | private function searchResultToCacheEntries(Statement $result) { |
| 761 | 761 | $files = $result->fetchAll(); |
| 762 | 762 | |
| 763 | - return array_map(function (array $data) { |
|
| 763 | + return array_map(function(array $data) { |
|
| 764 | 764 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 765 | 765 | }, $files); |
| 766 | 766 | } |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | $query->andWhere($query->expr()->eq('mimepart', $query->createNamedParameter($mimeId, IQueryBuilder::PARAM_INT))); |
| 786 | 786 | } |
| 787 | 787 | |
| 788 | - return array_map(function (array $data) { |
|
| 788 | + return array_map(function(array $data) { |
|
| 789 | 789 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 790 | 790 | }, $query->execute()->fetchAll()); |
| 791 | 791 | } |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | ->whereParent($fileId) |
| 869 | 869 | ->andWhere($query->expr()->lt('size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))); |
| 870 | 870 | |
| 871 | - return (int)$query->execute()->fetchColumn(); |
|
| 871 | + return (int) $query->execute()->fetchColumn(); |
|
| 872 | 872 | } |
| 873 | 873 | return -1; |
| 874 | 874 | } |
@@ -923,8 +923,8 @@ discard block |
||
| 923 | 923 | ->from('filecache') |
| 924 | 924 | ->whereStorageId(); |
| 925 | 925 | |
| 926 | - return array_map(function ($id) { |
|
| 927 | - return (int)$id; |
|
| 926 | + return array_map(function($id) { |
|
| 927 | + return (int) $id; |
|
| 928 | 928 | }, $query->execute()->fetchAll(\PDO::FETCH_COLUMN)); |
| 929 | 929 | } |
| 930 | 930 | |