@@ -57,7 +57,7 @@ |
||
57 | 57 | * @param string $mountPoint |
58 | 58 | * @param string $target |
59 | 59 | */ |
60 | - public function moveMount($mountPoint, $target){ |
|
60 | + public function moveMount($mountPoint, $target) { |
|
61 | 61 | $this->mounts[$target] = $this->mounts[$mountPoint]; |
62 | 62 | unset($this->mounts[$mountPoint]); |
63 | 63 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $unencryptedSize, |
157 | 157 | $headerSize, |
158 | 158 | $signed, |
159 | - $wrapper = 'OC\Files\Stream\Encryption') { |
|
159 | + $wrapper = 'OC\Files\Stream\Encryption') { |
|
160 | 160 | |
161 | 161 | $context = stream_context_create(array( |
162 | 162 | 'ocencryption' => array( |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | try { |
196 | 196 | stream_wrapper_register($protocol, $class); |
197 | 197 | if (@rewinddir($source) === false) { |
198 | - $wrapped = fopen($protocol . '://', $mode, false, $context); |
|
198 | + $wrapped = fopen($protocol.'://', $mode, false, $context); |
|
199 | 199 | } else { |
200 | - $wrapped = opendir($protocol . '://', $context); |
|
200 | + $wrapped = opendir($protocol.'://', $context); |
|
201 | 201 | } |
202 | 202 | } catch (\BadMethodCallException $e) { |
203 | 203 | stream_wrapper_unregister($protocol); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | if (array_key_exists($property, $context)) { |
222 | 222 | $this->{$property} = $context[$property]; |
223 | 223 | } else { |
224 | - throw new \BadMethodCallException('Invalid context, "' . $property . '" options not set'); |
|
224 | + throw new \BadMethodCallException('Invalid context, "'.$property.'" options not set'); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | return $context; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | // for seekable streams the pointer is moved back to the beginning of the encrypted block |
322 | 322 | // flush will start writing there when the position moves to another block |
323 | - $positionInFile = (int)floor($this->position / $this->unencryptedBlockSize) * |
|
323 | + $positionInFile = (int) floor($this->position / $this->unencryptedBlockSize) * |
|
324 | 324 | $this->util->getBlockSize() + $this->headerSize; |
325 | 325 | $resultFseek = $this->parentStreamSeek($positionInFile); |
326 | 326 | |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | // update position and liberate $data |
338 | 338 | if ($remainingLength < ($this->unencryptedBlockSize - $blockPosition)) { |
339 | 339 | $this->cache = substr($this->cache, 0, $blockPosition) |
340 | - . $data . substr($this->cache, $blockPosition + $remainingLength); |
|
340 | + . $data.substr($this->cache, $blockPosition + $remainingLength); |
|
341 | 341 | $this->position += $remainingLength; |
342 | 342 | $length += $remainingLength; |
343 | 343 | $data = ''; |
344 | 344 | // if $data doesn't fit the current block, the fill the current block and reiterate |
345 | 345 | // after the block is filled, it is flushed and $data is updatedxxx |
346 | 346 | } else { |
347 | - $this->cache = substr($this->cache, 0, $blockPosition) . |
|
347 | + $this->cache = substr($this->cache, 0, $blockPosition). |
|
348 | 348 | substr($data, 0, $this->unencryptedBlockSize - $blockPosition); |
349 | 349 | $this->flush(); |
350 | 350 | $this->position += ($this->unencryptedBlockSize - $blockPosition); |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | |
403 | 403 | public function stream_close() { |
404 | 404 | $this->flush('end'); |
405 | - $position = (int)floor($this->position/$this->unencryptedBlockSize); |
|
406 | - $remainingData = $this->encryptionModule->end($this->fullPath, $position . 'end'); |
|
405 | + $position = (int) floor($this->position / $this->unencryptedBlockSize); |
|
406 | + $remainingData = $this->encryptionModule->end($this->fullPath, $position.'end'); |
|
407 | 407 | if ($this->readOnly === false) { |
408 | - if(!empty($remainingData)) { |
|
408 | + if (!empty($remainingData)) { |
|
409 | 409 | parent::stream_write($remainingData); |
410 | 410 | } |
411 | 411 | $this->encryptionStorage->updateUnencryptedSize($this->fullPath, $this->unencryptedSize); |
@@ -424,16 +424,16 @@ discard block |
||
424 | 424 | // automatically attempted when the file is written to disk - |
425 | 425 | // we are handling that separately here and we don't want to |
426 | 426 | // get into an infinite loop |
427 | - $position = (int)floor($this->position/$this->unencryptedBlockSize); |
|
428 | - $encrypted = $this->encryptionModule->encrypt($this->cache, $position . $positionPrefix); |
|
427 | + $position = (int) floor($this->position / $this->unencryptedBlockSize); |
|
428 | + $encrypted = $this->encryptionModule->encrypt($this->cache, $position.$positionPrefix); |
|
429 | 429 | $bytesWritten = parent::stream_write($encrypted); |
430 | 430 | $this->writeFlag = false; |
431 | 431 | // Check whether the write concerns the last block |
432 | 432 | // If so then update the encrypted filesize |
433 | 433 | // Note that the unencrypted pointer and filesize are NOT yet updated when flush() is called |
434 | 434 | // We recalculate the encrypted filesize as we do not know the context of calling flush() |
435 | - $completeBlocksInFile=(int)floor($this->unencryptedSize/$this->unencryptedBlockSize); |
|
436 | - if ($completeBlocksInFile === (int)floor($this->position/$this->unencryptedBlockSize)) { |
|
435 | + $completeBlocksInFile = (int) floor($this->unencryptedSize / $this->unencryptedBlockSize); |
|
436 | + if ($completeBlocksInFile === (int) floor($this->position / $this->unencryptedBlockSize)) { |
|
437 | 437 | $this->size = $this->util->getBlockSize() * $completeBlocksInFile; |
438 | 438 | $this->size += $bytesWritten; |
439 | 439 | $this->size += $this->headerSize; |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | if ($this->cache === '' && !($this->position === $this->unencryptedSize && ($this->position % $this->unencryptedBlockSize) === 0)) { |
453 | 453 | // Get the data from the file handle |
454 | 454 | $data = parent::stream_read($this->util->getBlockSize()); |
455 | - $position = (int)floor($this->position/$this->unencryptedBlockSize); |
|
456 | - $numberOfChunks = (int)($this->unencryptedSize / $this->unencryptedBlockSize); |
|
457 | - if($numberOfChunks === $position) { |
|
455 | + $position = (int) floor($this->position / $this->unencryptedBlockSize); |
|
456 | + $numberOfChunks = (int) ($this->unencryptedSize / $this->unencryptedBlockSize); |
|
457 | + if ($numberOfChunks === $position) { |
|
458 | 458 | $position .= 'end'; |
459 | 459 | } |
460 | 460 | $this->cache = $this->encryptionModule->decrypt($data, $position); |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function getMountsForUser(IUser $user) { |
75 | 75 | $loader = $this->loader; |
76 | - $mounts = array_map(function (IMountProvider $provider) use ($user, $loader) { |
|
76 | + $mounts = array_map(function(IMountProvider $provider) use ($user, $loader) { |
|
77 | 77 | return $provider->getMountsForUser($user, $loader); |
78 | 78 | }, $this->providers); |
79 | - $mounts = array_filter($mounts, function ($result) { |
|
79 | + $mounts = array_filter($mounts, function($result) { |
|
80 | 80 | return is_array($result); |
81 | 81 | }); |
82 | - return array_reduce($mounts, function (array $mounts, array $providerMounts) { |
|
82 | + return array_reduce($mounts, function(array $mounts, array $providerMounts) { |
|
83 | 83 | return array_merge($mounts, $providerMounts); |
84 | 84 | }, array()); |
85 | 85 | } |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | $providers = array_reverse($this->homeProviders); // call the latest registered provider first to give apps an opportunity to overwrite builtin |
97 | 97 | foreach ($providers as $homeProvider) { |
98 | 98 | if ($mount = $homeProvider->getHomeMountForUser($user, $this->loader)) { |
99 | - $mount->setMountPoint('/' . $user->getUID()); //make sure the mountpoint is what we expect |
|
99 | + $mount->setMountPoint('/'.$user->getUID()); //make sure the mountpoint is what we expect |
|
100 | 100 | return $mount; |
101 | 101 | } |
102 | 102 | } |
103 | - throw new \Exception('No home storage configured for user ' . $user); |
|
103 | + throw new \Exception('No home storage configured for user '.$user); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -99,17 +99,17 @@ discard block |
||
99 | 99 | protected function attachListener($mount) { |
100 | 100 | $scanner = $mount->getStorage()->getScanner(); |
101 | 101 | $emitter = $this; |
102 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function ($path) use ($mount, $emitter) { |
|
103 | - $emitter->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint() . $path)); |
|
102 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function($path) use ($mount, $emitter) { |
|
103 | + $emitter->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint().$path)); |
|
104 | 104 | }); |
105 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount, $emitter) { |
|
106 | - $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path)); |
|
105 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function($path) use ($mount, $emitter) { |
|
106 | + $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint().$path)); |
|
107 | 107 | }); |
108 | - $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function ($path) use ($mount, $emitter) { |
|
109 | - $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint() . $path)); |
|
108 | + $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function($path) use ($mount, $emitter) { |
|
109 | + $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint().$path)); |
|
110 | 110 | }); |
111 | - $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function ($path) use ($mount, $emitter) { |
|
112 | - $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint() . $path)); |
|
111 | + $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function($path) use ($mount, $emitter) { |
|
112 | + $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint().$path)); |
|
113 | 113 | }); |
114 | 114 | } |
115 | 115 | |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | $scanner = $storage->getScanner(); |
136 | 136 | $this->attachListener($mount); |
137 | 137 | |
138 | - $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
138 | + $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function($path) use ($storage) { |
|
139 | 139 | $this->triggerPropagator($storage, $path); |
140 | 140 | }); |
141 | - $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
141 | + $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function($path) use ($storage) { |
|
142 | 142 | $this->triggerPropagator($storage, $path); |
143 | 143 | }); |
144 | - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
144 | + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function($path) use ($storage) { |
|
145 | 145 | $this->triggerPropagator($storage, $path); |
146 | 146 | }); |
147 | 147 | |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | $this->attachListener($mount); |
189 | 189 | $isDbLocking = \OC::$server->getLockingProvider() instanceof DBLockingProvider; |
190 | 190 | |
191 | - $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
191 | + $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function($path) use ($storage) { |
|
192 | 192 | $this->triggerPropagator($storage, $path); |
193 | 193 | }); |
194 | - $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
194 | + $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function($path) use ($storage) { |
|
195 | 195 | $this->triggerPropagator($storage, $path); |
196 | 196 | }); |
197 | - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
197 | + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function($path) use ($storage) { |
|
198 | 198 | $this->triggerPropagator($storage, $path); |
199 | 199 | }); |
200 | 200 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | $propagator->commitBatch(); |
214 | 214 | } catch (StorageNotAvailableException $e) { |
215 | - $this->logger->error('Storage ' . $storage->getId() . ' not available'); |
|
215 | + $this->logger->error('Storage '.$storage->getId().' not available'); |
|
216 | 216 | $this->logger->logException($e); |
217 | 217 | $this->emit('\OC\Files\Utils\Scanner', 'StorageNotAvailable', [$e]); |
218 | 218 | } |
@@ -33,15 +33,15 @@ |
||
33 | 33 | * @param array $params |
34 | 34 | */ |
35 | 35 | public function __construct($params) { |
36 | - if ( ! isset($params['user']) || ! $params['user'] instanceof User) { |
|
36 | + if (!isset($params['user']) || !$params['user'] instanceof User) { |
|
37 | 37 | throw new \Exception('missing user object in parameters'); |
38 | 38 | } |
39 | 39 | $this->user = $params['user']; |
40 | 40 | parent::__construct($params); |
41 | 41 | } |
42 | 42 | |
43 | - public function getId () { |
|
44 | - return 'object::user:' . $this->user->getUID(); |
|
43 | + public function getId() { |
|
44 | + return 'object::user:'.$this->user->getUID(); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -135,7 +135,7 @@ |
||
135 | 135 | |
136 | 136 | $stream = $objectContent->getStream(); |
137 | 137 | // save the object content in the context of the stream to prevent it being gc'd until the stream is closed |
138 | - stream_context_set_option($stream, 'swift','content', $objectContent); |
|
138 | + stream_context_set_option($stream, 'swift', 'content', $objectContent); |
|
139 | 139 | |
140 | 140 | return $stream; |
141 | 141 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | // Update the alternative mimetypes to avoid having to look them up each time. |
104 | 104 | foreach ($this->mimetypes as $mimeType) { |
105 | - $this->secureMimeTypes[$mimeType[0]] = isset($mimeType[1]) ? $mimeType[1]: $mimeType[0]; |
|
105 | + $this->secureMimeTypes[$mimeType[0]] = isset($mimeType[1]) ? $mimeType[1] : $mimeType[0]; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | - $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypealiases.dist.json'), true); |
|
117 | + $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypealiases.dist.json'), true); |
|
118 | 118 | |
119 | - if (file_exists($this->customConfigDir . '/mimetypealiases.json')) { |
|
120 | - $custom = json_decode(file_get_contents($this->customConfigDir . '/mimetypealiases.json'), true); |
|
119 | + if (file_exists($this->customConfigDir.'/mimetypealiases.json')) { |
|
120 | + $custom = json_decode(file_get_contents($this->customConfigDir.'/mimetypealiases.json'), true); |
|
121 | 121 | $this->mimeTypeAlias = array_merge($this->mimeTypeAlias, $custom); |
122 | 122 | } |
123 | 123 | } |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - $mimetypeMapping = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypemapping.dist.json'), true); |
|
141 | + $mimetypeMapping = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypemapping.dist.json'), true); |
|
142 | 142 | |
143 | 143 | //Check if need to load custom mappings |
144 | - if (file_exists($this->customConfigDir . '/mimetypemapping.json')) { |
|
145 | - $custom = json_decode(file_get_contents($this->customConfigDir . '/mimetypemapping.json'), true); |
|
144 | + if (file_exists($this->customConfigDir.'/mimetypemapping.json')) { |
|
145 | + $custom = json_decode(file_get_contents($this->customConfigDir.'/mimetypemapping.json'), true); |
|
146 | 146 | $mimetypeMapping = array_merge($mimetypeMapping, $custom); |
147 | 147 | } |
148 | 148 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | |
307 | 307 | // Icon exists? |
308 | 308 | try { |
309 | - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $icon . '.svg'); |
|
309 | + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/'.$icon.'.svg'); |
|
310 | 310 | return $this->mimetypeIcons[$mimetype]; |
311 | 311 | } catch (\RuntimeException $e) { |
312 | 312 | // Specified image not found |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | // Try only the first part of the filetype |
316 | 316 | $mimePart = substr($icon, 0, strpos($icon, '-')); |
317 | 317 | try { |
318 | - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.svg'); |
|
318 | + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/'.$mimePart.'.svg'); |
|
319 | 319 | return $this->mimetypeIcons[$mimetype]; |
320 | 320 | } catch (\RuntimeException $e) { |
321 | 321 | // Image for the first part of the mimetype not found |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | // no point in continuing if the section was not found, use original path |
81 | 81 | return $fullPath; |
82 | 82 | } |
83 | - $path = $convertedPath . '/'; |
|
83 | + $path = $convertedPath.'/'; |
|
84 | 84 | } |
85 | 85 | $path = rtrim($path, '/'); |
86 | 86 | return $path; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return string|null original or converted path, or null if none of the forms was found |
97 | 97 | */ |
98 | 98 | private function findPathToUseLastSection($basePath, $lastSection) { |
99 | - $fullPath = $basePath . $lastSection; |
|
99 | + $fullPath = $basePath.$lastSection; |
|
100 | 100 | if ($lastSection === '' || $this->isAscii($lastSection) || $this->storage->file_exists($fullPath)) { |
101 | 101 | $this->namesCache[$fullPath] = $fullPath; |
102 | 102 | return $fullPath; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | } else { |
109 | 109 | $otherFormPath = \Normalizer::normalize($lastSection, \Normalizer::FORM_C); |
110 | 110 | } |
111 | - $otherFullPath = $basePath . $otherFormPath; |
|
111 | + $otherFullPath = $basePath.$otherFormPath; |
|
112 | 112 | if ($this->storage->file_exists($otherFullPath)) { |
113 | 113 | $this->namesCache[$fullPath] = $otherFullPath; |
114 | 114 | return $otherFullPath; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | /** |
29 | 29 | * local storage backend in temporary folder for testing purpose |
30 | 30 | */ |
31 | -class Temporary extends Local{ |
|
31 | +class Temporary extends Local { |
|
32 | 32 | public function __construct($arguments = null) { |
33 | 33 | parent::__construct(array('datadir' => \OC::$server->getTempManager()->getTemporaryFolder())); |
34 | 34 | } |