@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | } |
| 332 | 332 | if ($lock) { |
| 333 | 333 | if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { |
| 334 | - $this->storage->acquireLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); |
|
| 334 | + $this->storage->acquireLock('scanner::'.$path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); |
|
| 335 | 335 | $this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); |
| 336 | 336 | } |
| 337 | 337 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | if ($lock) { |
| 346 | 346 | if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { |
| 347 | 347 | $this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); |
| 348 | - $this->storage->releaseLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); |
|
| 348 | + $this->storage->releaseLock('scanner::'.$path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); |
|
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | 351 | } |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | $exceptionOccurred = false; |
| 436 | 436 | $childQueue = []; |
| 437 | 437 | foreach ($newChildren as $file) { |
| 438 | - $child = $path ? $path . '/' . $file : $file; |
|
| 438 | + $child = $path ? $path.'/'.$file : $file; |
|
| 439 | 439 | try { |
| 440 | 440 | $existingData = isset($existingChildren[$file]) ? $existingChildren[$file] : false; |
| 441 | 441 | $data = $this->scanFile($child, $reuse, $folderId, $existingData, $lock); |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | \OC::$server->getDatabaseConnection()->beginTransaction(); |
| 461 | 461 | } |
| 462 | 462 | \OC::$server->getLogger()->logException($ex, [ |
| 463 | - 'message' => 'Exception while scanning file "' . $child . '"', |
|
| 463 | + 'message' => 'Exception while scanning file "'.$child.'"', |
|
| 464 | 464 | 'level' => ILogger::DEBUG, |
| 465 | 465 | 'app' => 'core', |
| 466 | 466 | ]); |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | } |
| 475 | 475 | $removedChildren = \array_diff(array_keys($existingChildren), $newChildren); |
| 476 | 476 | foreach ($removedChildren as $childName) { |
| 477 | - $child = $path ? $path . '/' . $childName : $childName; |
|
| 477 | + $child = $path ? $path.'/'.$childName : $childName; |
|
| 478 | 478 | $this->removeFromCache($child); |
| 479 | 479 | } |
| 480 | 480 | if ($this->useTransactions) { |
@@ -514,13 +514,13 @@ discard block |
||
| 514 | 514 | */ |
| 515 | 515 | public function backgroundScan() { |
| 516 | 516 | if (!$this->cache->inCache('')) { |
| 517 | - $this->runBackgroundScanJob(function () { |
|
| 517 | + $this->runBackgroundScanJob(function() { |
|
| 518 | 518 | $this->scan('', self::SCAN_RECURSIVE, self::REUSE_ETAG); |
| 519 | 519 | }, ''); |
| 520 | 520 | } else { |
| 521 | 521 | $lastPath = null; |
| 522 | 522 | while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) { |
| 523 | - $this->runBackgroundScanJob(function () use ($path) { |
|
| 523 | + $this->runBackgroundScanJob(function() use ($path) { |
|
| 524 | 524 | $this->scan($path, self::SCAN_RECURSIVE_INCOMPLETE, self::REUSE_ETAG | self::REUSE_SIZE); |
| 525 | 525 | }, $path); |
| 526 | 526 | // FIXME: this won't proceed with the next item, needs revamping of getIncomplete() |
@@ -171,21 +171,21 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) { |
| 173 | 173 | //fix types |
| 174 | - $data['fileid'] = (int)$data['fileid']; |
|
| 175 | - $data['parent'] = (int)$data['parent']; |
|
| 174 | + $data['fileid'] = (int) $data['fileid']; |
|
| 175 | + $data['parent'] = (int) $data['parent']; |
|
| 176 | 176 | $data['size'] = 0 + $data['size']; |
| 177 | - $data['mtime'] = (int)$data['mtime']; |
|
| 178 | - $data['storage_mtime'] = (int)$data['storage_mtime']; |
|
| 179 | - $data['encryptedVersion'] = (int)$data['encrypted']; |
|
| 180 | - $data['encrypted'] = (bool)$data['encrypted']; |
|
| 177 | + $data['mtime'] = (int) $data['mtime']; |
|
| 178 | + $data['storage_mtime'] = (int) $data['storage_mtime']; |
|
| 179 | + $data['encryptedVersion'] = (int) $data['encrypted']; |
|
| 180 | + $data['encrypted'] = (bool) $data['encrypted']; |
|
| 181 | 181 | $data['storage_id'] = $data['storage']; |
| 182 | - $data['storage'] = (int)$data['storage']; |
|
| 182 | + $data['storage'] = (int) $data['storage']; |
|
| 183 | 183 | $data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']); |
| 184 | 184 | $data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']); |
| 185 | 185 | if ($data['storage_mtime'] == 0) { |
| 186 | 186 | $data['storage_mtime'] = $data['mtime']; |
| 187 | 187 | } |
| 188 | - $data['permissions'] = (int)$data['permissions']; |
|
| 188 | + $data['permissions'] = (int) $data['permissions']; |
|
| 189 | 189 | if (isset($data['creation_time'])) { |
| 190 | 190 | $data['creation_time'] = (int) $data['creation_time']; |
| 191 | 191 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | ->orderBy('name', 'ASC'); |
| 221 | 221 | |
| 222 | 222 | $files = $query->execute()->fetchAll(); |
| 223 | - return array_map(function (array $data) { |
|
| 223 | + return array_map(function(array $data) { |
|
| 224 | 224 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 225 | 225 | }, $files); |
| 226 | 226 | } |
@@ -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 | } |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | $childIds = array_map(function(ICacheEntry $cacheEntry) { |
| 558 | 558 | return $cacheEntry->getId(); |
| 559 | 559 | }, $children); |
| 560 | - $childFolders = array_filter($children, function ($child) { |
|
| 560 | + $childFolders = array_filter($children, function($child) { |
|
| 561 | 561 | return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER; |
| 562 | 562 | }); |
| 563 | 563 | foreach ($childFolders as $folder) { |
@@ -619,10 +619,10 @@ discard block |
||
| 619 | 619 | [$targetStorageId, $targetPath] = $this->getMoveInfo($targetPath); |
| 620 | 620 | |
| 621 | 621 | if (is_null($sourceStorageId) || $sourceStorageId === false) { |
| 622 | - throw new \Exception('Invalid source storage id: ' . $sourceStorageId); |
|
| 622 | + throw new \Exception('Invalid source storage id: '.$sourceStorageId); |
|
| 623 | 623 | } |
| 624 | 624 | if (is_null($targetStorageId) || $targetStorageId === false) { |
| 625 | - throw new \Exception('Invalid target storage id: ' . $targetStorageId); |
|
| 625 | + throw new \Exception('Invalid target storage id: '.$targetStorageId); |
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | $this->connection->beginTransaction(); |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | ->set('path_hash', $fun->md5($newPathFunction)) |
| 642 | 642 | ->set('path', $newPathFunction) |
| 643 | 643 | ->where($query->expr()->eq('storage', $query->createNamedParameter($sourceStorageId, IQueryBuilder::PARAM_INT))) |
| 644 | - ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath) . '/%'))); |
|
| 644 | + ->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath).'/%'))); |
|
| 645 | 645 | |
| 646 | 646 | try { |
| 647 | 647 | $query->execute(); |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | ->wherePath($file); |
| 706 | 706 | $size = $query->execute()->fetchColumn(); |
| 707 | 707 | if ($size !== false) { |
| 708 | - if ((int)$size === -1) { |
|
| 708 | + if ((int) $size === -1) { |
|
| 709 | 709 | return self::SHALLOW; |
| 710 | 710 | } else { |
| 711 | 711 | return self::COMPLETE; |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | ->whereStorageId() |
| 739 | 739 | ->andWhere($query->expr()->iLike('name', $query->createNamedParameter($pattern))); |
| 740 | 740 | |
| 741 | - return array_map(function (array $data) { |
|
| 741 | + return array_map(function(array $data) { |
|
| 742 | 742 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 743 | 743 | }, $query->execute()->fetchAll()); |
| 744 | 744 | } |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | private function searchResultToCacheEntries(Statement $result) { |
| 751 | 751 | $files = $result->fetchAll(); |
| 752 | 752 | |
| 753 | - return array_map(function (array $data) { |
|
| 753 | + return array_map(function(array $data) { |
|
| 754 | 754 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 755 | 755 | }, $files); |
| 756 | 756 | } |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | $query->andWhere($query->expr()->eq('mimepart', $query->createNamedParameter($mimeId, IQueryBuilder::PARAM_INT))); |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | - return array_map(function (array $data) { |
|
| 778 | + return array_map(function(array $data) { |
|
| 779 | 779 | return self::cacheEntryFromData($data, $this->mimetypeLoader); |
| 780 | 780 | }, $query->execute()->fetchAll()); |
| 781 | 781 | } |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | ->whereParent($fileId) |
| 859 | 859 | ->andWhere($query->expr()->lt('size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))); |
| 860 | 860 | |
| 861 | - return (int)$query->execute()->fetchColumn(); |
|
| 861 | + return (int) $query->execute()->fetchColumn(); |
|
| 862 | 862 | } |
| 863 | 863 | return -1; |
| 864 | 864 | } |
@@ -913,8 +913,8 @@ discard block |
||
| 913 | 913 | ->from('filecache') |
| 914 | 914 | ->whereStorageId(); |
| 915 | 915 | |
| 916 | - return array_map(function ($id) { |
|
| 917 | - return (int)$id; |
|
| 916 | + return array_map(function($id) { |
|
| 917 | + return (int) $id; |
|
| 918 | 918 | }, $query->execute()->fetchAll(\PDO::FETCH_COLUMN)); |
| 919 | 919 | } |
| 920 | 920 | |