@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $this->mkdir($path2); |
217 | 217 | while ($file = readdir($dir)) { |
218 | 218 | if (!Filesystem::isIgnoredDir($file)) { |
219 | - if (!$this->copy($path1 . '/' . $file, $path2 . '/' . $file)) { |
|
219 | + if (!$this->copy($path1.'/'.$file, $path2.'/'.$file)) { |
|
220 | 220 | return false; |
221 | 221 | } |
222 | 222 | } |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | if (is_resource($dh)) { |
268 | 268 | while (($file = readdir($dh)) !== false) { |
269 | 269 | if (!\OC\Files\Filesystem::isIgnoredDir($file)) { |
270 | - if ($this->is_dir($path . '/' . $file)) { |
|
271 | - mkdir($target . '/' . $file); |
|
272 | - $this->addLocalFolder($path . '/' . $file, $target . '/' . $file); |
|
270 | + if ($this->is_dir($path.'/'.$file)) { |
|
271 | + mkdir($target.'/'.$file); |
|
272 | + $this->addLocalFolder($path.'/'.$file, $target.'/'.$file); |
|
273 | 273 | } else { |
274 | - $tmp = $this->toTmpFile($path . '/' . $file); |
|
275 | - rename($tmp, $target . '/' . $file); |
|
274 | + $tmp = $this->toTmpFile($path.'/'.$file); |
|
275 | + rename($tmp, $target.'/'.$file); |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
@@ -291,10 +291,10 @@ discard block |
||
291 | 291 | while (($item = readdir($dh)) !== false) { |
292 | 292 | if (\OC\Files\Filesystem::isIgnoredDir($item)) continue; |
293 | 293 | if (strstr(strtolower($item), strtolower($query)) !== false) { |
294 | - $files[] = $dir . '/' . $item; |
|
294 | + $files[] = $dir.'/'.$item; |
|
295 | 295 | } |
296 | - if ($this->is_dir($dir . '/' . $item)) { |
|
297 | - $files = array_merge($files, $this->searchInDir($query, $dir . '/' . $item)); |
|
296 | + if ($this->is_dir($dir.'/'.$item)) { |
|
297 | + $files = array_merge($files, $this->searchInDir($query, $dir.'/'.$item)); |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | if (!isset($this->watcher)) { |
346 | 346 | $this->watcher = new Watcher($storage); |
347 | 347 | $globalPolicy = \OC::$server->getConfig()->getSystemValue('filesystem_check_changes', Watcher::CHECK_NEVER); |
348 | - $this->watcher->setPolicy((int)$this->getMountOption('filesystem_check_changes', $globalPolicy)); |
|
348 | + $this->watcher->setPolicy((int) $this->getMountOption('filesystem_check_changes', $globalPolicy)); |
|
349 | 349 | } |
350 | 350 | return $this->watcher; |
351 | 351 | } |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | */ |
420 | 420 | public function cleanPath($path) { |
421 | 421 | if (strlen($path) == 0 or $path[0] != '/') { |
422 | - $path = '/' . $path; |
|
422 | + $path = '/'.$path; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | $output = array(); |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | if (is_resource($dh)) { |
596 | 596 | while ($result and ($file = readdir($dh)) !== false) { |
597 | 597 | if (!Filesystem::isIgnoredDir($file)) { |
598 | - $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file); |
|
598 | + $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath.'/'.$file, $targetInternalPath.'/'.$file); |
|
599 | 599 | } |
600 | 600 | } |
601 | 601 | } |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | $this->getCache()->remove($targetInternalPath); |
622 | 622 | } |
623 | 623 | } |
624 | - return (bool)$result; |
|
624 | + return (bool) $result; |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | /** |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | ); |
702 | 702 | } |
703 | 703 | try { |
704 | - $provider->acquireLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type); |
|
704 | + $provider->acquireLock('files/'.md5($this->getId().'::'.trim($path, '/')), $type); |
|
705 | 705 | } catch (LockedException $e) { |
706 | 706 | if ($logger) { |
707 | 707 | $logger->logException($e); |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | ); |
734 | 734 | } |
735 | 735 | try { |
736 | - $provider->releaseLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type); |
|
736 | + $provider->releaseLock('files/'.md5($this->getId().'::'.trim($path, '/')), $type); |
|
737 | 737 | } catch (LockedException $e) { |
738 | 738 | if ($logger) { |
739 | 739 | $logger->logException($e); |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | ); |
766 | 766 | } |
767 | 767 | try { |
768 | - $provider->changeLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type); |
|
768 | + $provider->changeLock('files/'.md5($this->getId().'::'.trim($path, '/')), $type); |
|
769 | 769 | } catch (LockedException $e) { |
770 | 770 | if ($logger) { |
771 | 771 | $logger->logException($e); |
@@ -90,11 +90,11 @@ |
||
90 | 90 | */ |
91 | 91 | public function wrap(IMountPoint $mountPoint, $storage) { |
92 | 92 | $wrappers = array_values($this->storageWrappers); |
93 | - usort($wrappers, function ($a, $b) { |
|
93 | + usort($wrappers, function($a, $b) { |
|
94 | 94 | return $b['priority'] - $a['priority']; |
95 | 95 | }); |
96 | 96 | /** @var callable[] $wrappers */ |
97 | - $wrappers = array_map(function ($wrapper) { |
|
97 | + $wrappers = array_map(function($wrapper) { |
|
98 | 98 | return $wrapper['wrapper']; |
99 | 99 | }, $wrappers); |
100 | 100 | foreach ($wrappers as $wrapper) { |
@@ -89,11 +89,11 @@ |
||
89 | 89 | $result = true; |
90 | 90 | while ($file = readdir($dh)) { |
91 | 91 | if (!\OC\Files\Filesystem::isIgnoredDir($file)) { |
92 | - if ($this->is_dir($source . '/' . $file)) { |
|
93 | - $this->mkdir($target . '/' . $file); |
|
94 | - $result = $this->copyRecursive($source . '/' . $file, $target . '/' . $file); |
|
92 | + if ($this->is_dir($source.'/'.$file)) { |
|
93 | + $this->mkdir($target.'/'.$file); |
|
94 | + $result = $this->copyRecursive($source.'/'.$file, $target.'/'.$file); |
|
95 | 95 | } else { |
96 | - $result = parent::copy($source . '/' . $file, $target . '/' . $file); |
|
96 | + $result = parent::copy($source.'/'.$file, $target.'/'.$file); |
|
97 | 97 | } |
98 | 98 | if (!$result) { |
99 | 99 | break; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | protected function buildPath($path) { |
59 | - $fullPath = \OC\Files\Filesystem::normalizePath($this->root . '/' . $path); |
|
59 | + $fullPath = \OC\Files\Filesystem::normalizePath($this->root.'/'.$path); |
|
60 | 60 | return ltrim($fullPath, '/'); |
61 | 61 | } |
62 | 62 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } catch (FileNotFoundException $e) { |
164 | 164 | return false; |
165 | 165 | } |
166 | - $names = array_map(function ($object) { |
|
166 | + $names = array_map(function($object) { |
|
167 | 167 | return $object['basename']; |
168 | 168 | }, $content); |
169 | 169 | return IteratorDirectory::wrap($names); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $tmpFile = \OCP\Files::tmpFile(); |
210 | 210 | } |
211 | 211 | $source = fopen($tmpFile, $mode); |
212 | - return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath) { |
|
212 | + return CallbackWrapper::wrap($source, null, null, function() use ($tmpFile, $fullPath) { |
|
213 | 213 | $this->flysystem->putStream($fullPath, fopen($tmpFile, 'r')); |
214 | 214 | unlink($tmpFile); |
215 | 215 | }); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | namespace OC\Files\Storage; |
34 | 34 | |
35 | -class CommonTest extends \OC\Files\Storage\Common{ |
|
35 | +class CommonTest extends \OC\Files\Storage\Common { |
|
36 | 36 | /** |
37 | 37 | * underlying local storage used for missing functions |
38 | 38 | * @var \OC\Files\Storage\Local |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | private $storage; |
41 | 41 | |
42 | 42 | public function __construct($params) { |
43 | - $this->storage=new \OC\Files\Storage\Local($params); |
|
43 | + $this->storage = new \OC\Files\Storage\Local($params); |
|
44 | 44 | } |
45 | 45 | |
46 | - public function getId(){ |
|
46 | + public function getId() { |
|
47 | 47 | return 'test::'.$this->storage->getId(); |
48 | 48 | } |
49 | 49 | public function mkdir($path) { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function free_space($path) { |
80 | 80 | return $this->storage->free_space($path); |
81 | 81 | } |
82 | - public function touch($path, $mtime=null) { |
|
82 | + public function touch($path, $mtime = null) { |
|
83 | 83 | return $this->storage->touch($path, $mtime); |
84 | 84 | } |
85 | 85 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | } |
314 | 314 | if ($lock) { |
315 | 315 | if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { |
316 | - $this->storage->acquireLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); |
|
316 | + $this->storage->acquireLock('scanner::'.$path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); |
|
317 | 317 | $this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); |
318 | 318 | } |
319 | 319 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | if ($lock) { |
326 | 326 | if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { |
327 | 327 | $this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); |
328 | - $this->storage->releaseLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); |
|
328 | + $this->storage->releaseLock('scanner::'.$path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider); |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | return $data; |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $exceptionOccurred = false; |
415 | 415 | $childQueue = []; |
416 | 416 | foreach ($newChildren as $file) { |
417 | - $child = ($path) ? $path . '/' . $file : $file; |
|
417 | + $child = ($path) ? $path.'/'.$file : $file; |
|
418 | 418 | try { |
419 | 419 | $existingData = isset($existingChildren[$file]) ? $existingChildren[$file] : null; |
420 | 420 | $data = $this->scanFile($child, $reuse, $folderId, $existingData, $lock); |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | // might happen if inserting duplicate while a scanning |
435 | 435 | // process is running in parallel |
436 | 436 | // log and ignore |
437 | - \OCP\Util::writeLog('core', 'Exception while scanning file "' . $child . '": ' . $ex->getMessage(), \OCP\Util::DEBUG); |
|
437 | + \OCP\Util::writeLog('core', 'Exception while scanning file "'.$child.'": '.$ex->getMessage(), \OCP\Util::DEBUG); |
|
438 | 438 | $exceptionOccurred = true; |
439 | 439 | } catch (\OCP\Lock\LockedException $e) { |
440 | 440 | if ($this->useTransactions) { |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | } |
446 | 446 | $removedChildren = \array_diff(array_keys($existingChildren), $newChildren); |
447 | 447 | foreach ($removedChildren as $childName) { |
448 | - $child = ($path) ? $path . '/' . $childName : $childName; |
|
448 | + $child = ($path) ? $path.'/'.$childName : $childName; |
|
449 | 449 | $this->removeFromCache($child); |
450 | 450 | } |
451 | 451 | if ($this->useTransactions) { |
@@ -485,13 +485,13 @@ discard block |
||
485 | 485 | */ |
486 | 486 | public function backgroundScan() { |
487 | 487 | if (!$this->cache->inCache('')) { |
488 | - $this->runBackgroundScanJob(function () { |
|
488 | + $this->runBackgroundScanJob(function() { |
|
489 | 489 | $this->scan('', self::SCAN_RECURSIVE, self::REUSE_ETAG); |
490 | 490 | }, ''); |
491 | 491 | } else { |
492 | 492 | $lastPath = null; |
493 | 493 | while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) { |
494 | - $this->runBackgroundScanJob(function () use ($path) { |
|
494 | + $this->runBackgroundScanJob(function() use ($path) { |
|
495 | 495 | $this->scan($path, self::SCAN_RECURSIVE_INCOMPLETE, self::REUSE_ETAG | self::REUSE_SIZE); |
496 | 496 | }, $path); |
497 | 497 | // FIXME: this won't proceed with the next item, needs revamping of getIncomplete() |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if ($path === '') { |
52 | 52 | return $this->root; |
53 | 53 | } else { |
54 | - return $this->root . '/' . ltrim($path, '/'); |
|
54 | + return $this->root.'/'.ltrim($path, '/'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $rootLength = strlen($this->root) + 1; |
67 | 67 | if ($path === $this->root) { |
68 | 68 | return ''; |
69 | - } else if (substr($path, 0, $rootLength) === $this->root . '/') { |
|
69 | + } else if (substr($path, 0, $rootLength) === $this->root.'/') { |
|
70 | 70 | return substr($path, $rootLength); |
71 | 71 | } else { |
72 | 72 | return null; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | protected function filterCacheEntry($entry) { |
88 | 88 | $rootLength = strlen($this->root) + 1; |
89 | - return ($entry['path'] === $this->root) or (substr($entry['path'], 0, $rootLength) === $this->root . '/'); |
|
89 | + return ($entry['path'] === $this->root) or (substr($entry['path'], 0, $rootLength) === $this->root.'/'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | $this->storageId = self::adjustStorageId($this->storageId); |
70 | 70 | |
71 | 71 | if ($row = self::getStorageById($this->storageId)) { |
72 | - $this->numericId = (int)$row['numeric_id']; |
|
72 | + $this->numericId = (int) $row['numeric_id']; |
|
73 | 73 | } else { |
74 | 74 | $connection = \OC::$server->getDatabaseConnection(); |
75 | 75 | $available = $isAvailable ? 1 : 0; |
76 | 76 | if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId, 'available' => $available])) { |
77 | - $this->numericId = (int)$connection->lastInsertId('*PREFIX*storages'); |
|
77 | + $this->numericId = (int) $connection->lastInsertId('*PREFIX*storages'); |
|
78 | 78 | } else { |
79 | 79 | if ($row = self::getStorageById($this->storageId)) { |
80 | - $this->numericId = (int)$row['numeric_id']; |
|
80 | + $this->numericId = (int) $row['numeric_id']; |
|
81 | 81 | } else { |
82 | 82 | throw new \RuntimeException('Storage could neither be inserted nor be selected from the database'); |
83 | 83 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $storageId = self::adjustStorageId($storageId); |
143 | 143 | |
144 | 144 | if ($row = self::getStorageById($storageId)) { |
145 | - return (int)$row['numeric_id']; |
|
145 | + return (int) $row['numeric_id']; |
|
146 | 146 | } else { |
147 | 147 | return null; |
148 | 148 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | public function getAvailability() { |
155 | 155 | if ($row = self::getStorageById($this->storageId)) { |
156 | 156 | return [ |
157 | - 'available' => ((int)$row['available'] === 1), |
|
157 | + 'available' => ((int) $row['available'] === 1), |
|
158 | 158 | 'last_checked' => $row['last_checked'] |
159 | 159 | ]; |
160 | 160 | } else { |
@@ -58,7 +58,7 @@ |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | public function getId() { |
61 | - return (int)$this->data['fileid']; |
|
61 | + return (int) $this->data['fileid']; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public function getStorageId() { |