@@ -424,8 +424,8 @@ |
||
424 | 424 | ]; |
425 | 425 | |
426 | 426 | $node->getFilesystem()->getDatabase()->delta->updateMany([ |
427 | - 'node' => [ |
|
428 | - '$in' => $toset, |
|
427 | + 'node' => [ |
|
428 | + '$in' => $toset, |
|
429 | 429 | ], |
430 | 430 | ], $action); |
431 | 431 |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public function preCopyFile( |
117 | 117 | File $node, |
118 | 118 | Collection $parent, |
119 | - int $conflict, |
|
119 | + int $conflict, |
|
120 | 120 | ?string $recursion, |
121 | 121 | bool $recursion_first |
122 | 122 | ): void { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | File $node, |
130 | 130 | Collection $parent, |
131 | 131 | File $new_node, |
132 | - int $conflict, |
|
132 | + int $conflict, |
|
133 | 133 | ?string $recursion, |
134 | 134 | bool $recursion_first |
135 | 135 | ): void { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | public function preCopyFile( |
207 | 207 | File $node, |
208 | 208 | Collection $parent, |
209 | - int $conflict, |
|
209 | + int $conflict, |
|
210 | 210 | ?string $recursion, |
211 | 211 | bool $recursion_first |
212 | 212 | ): void; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | File $node, |
228 | 228 | Collection $parent, |
229 | 229 | File $new_node, |
230 | - int $conflict, |
|
230 | + int $conflict, |
|
231 | 231 | ?string $recursion, |
232 | 232 | bool $recursion_first |
233 | 233 | ): void; |
@@ -85,6 +85,6 @@ |
||
85 | 85 | protected function getTemplate(): string |
86 | 86 | { |
87 | 87 | return __DIR__.DIRECTORY_SEPARATOR.'assets' |
88 | - .DIRECTORY_SEPARATOR.'template.'.$this->type; |
|
88 | + .DIRECTORY_SEPARATOR.'template.'.$this->type; |
|
89 | 89 | } |
90 | 90 | } |
@@ -589,7 +589,7 @@ |
||
589 | 589 | ]); |
590 | 590 | |
591 | 591 | $this->addVersion($attributes) |
592 | - ->postPutFile($file, $new, $attributes); |
|
592 | + ->postPutFile($file, $new, $attributes); |
|
593 | 593 | |
594 | 594 | return $this->version; |
595 | 595 | } |
@@ -45,14 +45,14 @@ |
||
45 | 45 | * @param array |
46 | 46 | **/ |
47 | 47 | protected $temp_files = [ |
48 | - '/^\._(.*)$/', // OS/X resource forks |
|
49 | - '/^.DS_Store$/', // OS/X custom folder settings |
|
48 | + '/^\._(.*)$/', // OS/X resource forks |
|
49 | + '/^.DS_Store$/', // OS/X custom folder settings |
|
50 | 50 | '/^desktop.ini$/', // Windows custom folder settings |
51 | - '/^Thumbs.db$/', // Windows thumbnail cache |
|
52 | - '/^.(.*).swpx$/', // ViM temporary files |
|
53 | - '/^.(.*).swx$/', // ViM temporary files |
|
54 | - '/^.(.*).swp$/', // ViM temporary files |
|
55 | - '/^\.dat(.*)$/', // Smultron seems to create these |
|
51 | + '/^Thumbs.db$/', // Windows thumbnail cache |
|
52 | + '/^.(.*).swpx$/', // ViM temporary files |
|
53 | + '/^.(.*).swx$/', // ViM temporary files |
|
54 | + '/^.(.*).swp$/', // ViM temporary files |
|
55 | + '/^\.dat(.*)$/', // Smultron seems to create these |
|
56 | 56 | '/^~lock.(.*)#$/', // Windows 7 lockfiles |
57 | 57 | ]; |
58 | 58 |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | * |
629 | 629 | * @param string $path |
630 | 630 | * |
631 | - * @return bool |
|
631 | + * @return string |
|
632 | 632 | */ |
633 | 633 | protected function verifyFile(?string $path, bool $new = false): string |
634 | 634 | { |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | /** |
763 | 763 | * Finalize put request. |
764 | 764 | * |
765 | - * @param resource|string $file |
|
765 | + * @param string|null $file |
|
766 | 766 | * |
767 | 767 | * @return File |
768 | 768 | */ |
@@ -734,8 +734,8 @@ |
||
734 | 734 | |
735 | 735 | $ops[] = [ |
736 | 736 | '$sort' => [ |
737 | - 'sum' => -1, |
|
738 | - '_id' => 1, |
|
737 | + 'sum' => -1, |
|
738 | + '_id' => 1, |
|
739 | 739 | ], |
740 | 740 | ]; |
741 | 741 |
@@ -722,6 +722,8 @@ |
||
722 | 722 | /** |
723 | 723 | * Get resolved groups. |
724 | 724 | * |
725 | + * @param integer $offset |
|
726 | + * @param integer $limit |
|
725 | 727 | * @return Generator |
726 | 728 | */ |
727 | 729 | public function getResolvedGroups(?int $offset = null, ?int $limit = null): ?Generator |
@@ -50,7 +50,7 @@ |
||
50 | 50 | $this->db->storage->updateOne( |
51 | 51 | ['_id' => $object['_id']], |
52 | 52 | [ |
53 | - '$set' => ['filter' => $filter], |
|
53 | + '$set' => ['filter' => $filter], |
|
54 | 54 | ] |
55 | 55 | ); |
56 | 56 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | $this->db->storage->updateOne( |
49 | 49 | ['_id' => $object['_id']], |
50 | 50 | [ |
51 | - '$set' => ['share_name' => $object['name']], |
|
51 | + '$set' => ['share_name' => $object['name']], |
|
52 | 52 | ] |
53 | 53 | ); |
54 | 54 | } |
@@ -320,50 +320,50 @@ discard block |
||
320 | 320 | } |
321 | 321 | |
322 | 322 | return (new Response()) |
323 | - ->setOutputFormat(null) |
|
324 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
325 | - $mime = $node->getContentType(); |
|
326 | - $stream = $node->get(); |
|
327 | - $name = $node->getName(); |
|
328 | - |
|
329 | - if (null === $stream) { |
|
330 | - return; |
|
331 | - } |
|
332 | - |
|
333 | - if (0 !== $offset) { |
|
334 | - if (fseek($stream, $offset) === -1) { |
|
335 | - throw new Exception\Conflict( |
|
323 | + ->setOutputFormat(null) |
|
324 | + ->setBody(function () use ($node, $encode, $offset, $length) { |
|
325 | + $mime = $node->getContentType(); |
|
326 | + $stream = $node->get(); |
|
327 | + $name = $node->getName(); |
|
328 | + |
|
329 | + if (null === $stream) { |
|
330 | + return; |
|
331 | + } |
|
332 | + |
|
333 | + if (0 !== $offset) { |
|
334 | + if (fseek($stream, $offset) === -1) { |
|
335 | + throw new Exception\Conflict( |
|
336 | 336 | 'invalid offset requested', |
337 | 337 | Exception\Conflict::INVALID_OFFSET |
338 | 338 | ); |
339 | - } |
|
340 | - } |
|
341 | - |
|
342 | - $read = 0; |
|
343 | - header('Content-Type: '.$mime.''); |
|
344 | - if ('base64' === $encode) { |
|
345 | - header('Content-Encoding: base64'); |
|
346 | - while (!feof($stream)) { |
|
347 | - if (0 !== $length && $read + 8192 > $length) { |
|
348 | - echo base64_encode(fread($stream, $length - $read)); |
|
349 | - exit(); |
|
350 | - } |
|
351 | - |
|
352 | - echo base64_encode(fread($stream, 8192)); |
|
353 | - $read += 8192; |
|
354 | - } |
|
355 | - } else { |
|
356 | - while (!feof($stream)) { |
|
357 | - if (0 !== $length && $read + 8192 > $length) { |
|
358 | - echo fread($stream, $length - $read); |
|
359 | - exit(); |
|
360 | - } |
|
361 | - |
|
362 | - echo fread($stream, 8192); |
|
363 | - $read += 8192; |
|
364 | - } |
|
365 | - } |
|
366 | - }); |
|
339 | + } |
|
340 | + } |
|
341 | + |
|
342 | + $read = 0; |
|
343 | + header('Content-Type: '.$mime.''); |
|
344 | + if ('base64' === $encode) { |
|
345 | + header('Content-Encoding: base64'); |
|
346 | + while (!feof($stream)) { |
|
347 | + if (0 !== $length && $read + 8192 > $length) { |
|
348 | + echo base64_encode(fread($stream, $length - $read)); |
|
349 | + exit(); |
|
350 | + } |
|
351 | + |
|
352 | + echo base64_encode(fread($stream, 8192)); |
|
353 | + $read += 8192; |
|
354 | + } |
|
355 | + } else { |
|
356 | + while (!feof($stream)) { |
|
357 | + if (0 !== $length && $read + 8192 > $length) { |
|
358 | + echo fread($stream, $length - $read); |
|
359 | + exit(); |
|
360 | + } |
|
361 | + |
|
362 | + echo fread($stream, 8192); |
|
363 | + $read += 8192; |
|
364 | + } |
|
365 | + } |
|
366 | + }); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
@@ -1502,9 +1502,9 @@ discard block |
||
1502 | 1502 | $node->zip($archive); |
1503 | 1503 | } catch (\Exception $e) { |
1504 | 1504 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
1505 | - 'category' => get_class($this), |
|
1506 | - 'exception' => $e, |
|
1507 | - ]); |
|
1505 | + 'category' => get_class($this), |
|
1506 | + 'exception' => $e, |
|
1507 | + ]); |
|
1508 | 1508 | } |
1509 | 1509 | } |
1510 | 1510 |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
195 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
196 | 196 | if (true === $move) { |
197 | 197 | $node = $node->setParent($parent, $conflict); |
198 | 198 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | $node = $this->_getNode($id, $p); |
275 | 275 | if ($node instanceof Collection) { |
276 | - return (new Response())->setBody(function () use ($node) { |
|
276 | + return (new Response())->setBody(function() use ($node) { |
|
277 | 277 | $node->getZip(); |
278 | 278 | }); |
279 | 279 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | |
293 | 293 | return (new Response()) |
294 | 294 | ->setOutputFormat(null) |
295 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
295 | + ->setBody(function() use ($node, $encode, $offset, $length) { |
|
296 | 296 | $mime = $node->getContentType(); |
297 | 297 | $stream = $node->get(); |
298 | 298 | $name = $node->getName(); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | */ |
366 | 366 | public function postReadonly($id = null, $p = null, bool $readonly = true): Response |
367 | 367 | { |
368 | - return $this->bulk($id, $p, function ($node) use ($readonly) { |
|
368 | + return $this->bulk($id, $p, function($node) use ($readonly) { |
|
369 | 369 | $node->setReadonly($readonly); |
370 | 370 | |
371 | 371 | return ['code' => 204]; |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | */ |
619 | 619 | public function postMetaAttributes(?string $id = null, ?string $p = null): Response |
620 | 620 | { |
621 | - return $this->bulk($id, $p, function ($node) { |
|
621 | + return $this->bulk($id, $p, function($node) { |
|
622 | 622 | $node->setMetaAttributes($_POST); |
623 | 623 | |
624 | 624 | return ['code' => 204]; |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | ); |
707 | 707 | } |
708 | 708 | |
709 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
709 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
710 | 710 | $result = $node->copyTo($parent, $conflict); |
711 | 711 | |
712 | 712 | return [ |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | ); |
771 | 771 | } |
772 | 772 | |
773 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
773 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
774 | 774 | $result = $node->setParent($parent, $conflict); |
775 | 775 | if (NodeInterface::CONFLICT_RENAME === $conflict) { |
776 | 776 | return [ |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
830 | 830 | } |
831 | 831 | |
832 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
832 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
833 | 833 | if (null === $at) { |
834 | 834 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
835 | 835 | } else { |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @param string $class Force set node type |
211 | 211 | * @param bool $multiple Allow $id to be an array |
212 | 212 | * @param bool $allow_root Allow instance of root collection |
213 | - * @param bool $deleted How to handle deleted node |
|
213 | + * @param integer $deleted How to handle deleted node |
|
214 | 214 | */ |
215 | 215 | protected function _getNode( |
216 | 216 | ?string $id = null, |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param string $id |
243 | 243 | * @param string $path |
244 | 244 | * @param string $class Force set node type |
245 | - * @param bool $deleted How to handle deleted node |
|
245 | + * @param integer $deleted How to handle deleted node |
|
246 | 246 | */ |
247 | 247 | protected function _getNodes( |
248 | 248 | $id = null, |