@@ -958,9 +958,9 @@ |
||
958 | 958 | $node->zip($archive); |
959 | 959 | } catch (\Exception $e) { |
960 | 960 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
961 | - 'category' => get_class($this), |
|
962 | - 'exception' => $e, |
|
963 | - ]); |
|
961 | + 'category' => get_class($this), |
|
962 | + 'exception' => $e, |
|
963 | + ]); |
|
964 | 964 | } |
965 | 965 | } |
966 | 966 |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
182 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
183 | 183 | if (true === $move) { |
184 | 184 | $node = $node->setParent($parent, $conflict); |
185 | 185 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | return (new Response())->setCode(200)->setBody($result); |
347 | 347 | } |
348 | 348 | |
349 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
349 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
350 | 350 | return [ |
351 | 351 | 'code' => 200, |
352 | 352 | 'data' => $this->node_decorator->decorate($node, $attributes), |
@@ -454,9 +454,9 @@ discard block |
||
454 | 454 | public function patch(?string $name = null, ?array $meta = null, ?bool $readonly = null, ?array $filter = null, ?array $acl = null, ?string $id = null, ?string $p = null): Response |
455 | 455 | { |
456 | 456 | $attributes = compact('name', 'meta', 'readonly', 'filter', 'acl'); |
457 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
457 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
458 | 458 | |
459 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
459 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
460 | 460 | foreach ($attributes as $attribute => $value) { |
461 | 461 | switch ($attribute) { |
462 | 462 | case 'name': |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | ); |
540 | 540 | } |
541 | 541 | |
542 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
542 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
543 | 543 | $result = $node->copyTo($parent, $conflict); |
544 | 544 | |
545 | 545 | return [ |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | ); |
601 | 601 | } |
602 | 602 | |
603 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
603 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
604 | 604 | $result = $node->setParent($parent, $conflict); |
605 | 605 | |
606 | 606 | return [ |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
651 | 651 | } |
652 | 652 | |
653 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
653 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
654 | 654 | if (null === $at) { |
655 | 655 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
656 | 656 | } else { |
@@ -34,68 +34,68 @@ |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | return $response |
37 | - ->setOutputFormat(null) |
|
38 | - ->setBody(function () use ($file) { |
|
39 | - $stream = $file->get(); |
|
40 | - $name = $file->getName(); |
|
41 | - |
|
42 | - if (null === $stream) { |
|
43 | - return; |
|
44 | - } |
|
45 | - |
|
46 | - $size = $file->getSize(); |
|
47 | - $length = $size; |
|
48 | - $start = 0; |
|
49 | - $end = $size - 1; |
|
50 | - |
|
51 | - if (isset($_SERVER['HTTP_RANGE'])) { |
|
52 | - header('Accept-Ranges: bytes'); |
|
53 | - $c_start = $start; |
|
54 | - $c_end = $end; |
|
55 | - list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2); |
|
56 | - |
|
57 | - if (strpos($range, ',') !== false) { |
|
58 | - header("Content-Range: bytes $start-$end/$size"); |
|
59 | - |
|
60 | - throw new Exception\InvalidRange('invalid offset/limit requested'); |
|
61 | - } |
|
62 | - |
|
63 | - if ($range == '-') { |
|
64 | - $c_start = $size - substr($range, 1); |
|
65 | - } else { |
|
66 | - $range = explode('-', $range); |
|
67 | - $c_start = $range[0]; |
|
68 | - $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size; |
|
69 | - } |
|
70 | - |
|
71 | - $c_end = ($c_end > $end) ? $end : $c_end; |
|
72 | - if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) { |
|
73 | - header("Content-Range: bytes $start-$end/$size"); |
|
74 | - |
|
75 | - throw new Exception\InvalidRange('invalid offset/limit requested'); |
|
76 | - } |
|
77 | - |
|
78 | - $start = (int) $c_start; |
|
79 | - $end = (int) $c_end; |
|
80 | - $length = (int) $end - $start + 1; |
|
81 | - fseek($stream, $start); |
|
82 | - header('HTTP/1.1 206 Partial Content'); |
|
83 | - header("Content-Range: bytes $start-$end/$size"); |
|
84 | - } |
|
85 | - |
|
86 | - header('Content-Length: '.$length); |
|
87 | - $buffer = 1024 * 8; |
|
88 | - |
|
89 | - while (!feof($stream) && ($p = ftell($stream)) <= $end) { |
|
90 | - if ($p + $buffer > $end) { |
|
91 | - $buffer = $end - $p + 1; |
|
92 | - } |
|
93 | - |
|
94 | - echo fread($stream, $buffer); |
|
95 | - flush(); |
|
96 | - } |
|
97 | - |
|
98 | - fclose($stream); |
|
99 | - }); |
|
37 | + ->setOutputFormat(null) |
|
38 | + ->setBody(function () use ($file) { |
|
39 | + $stream = $file->get(); |
|
40 | + $name = $file->getName(); |
|
41 | + |
|
42 | + if (null === $stream) { |
|
43 | + return; |
|
44 | + } |
|
45 | + |
|
46 | + $size = $file->getSize(); |
|
47 | + $length = $size; |
|
48 | + $start = 0; |
|
49 | + $end = $size - 1; |
|
50 | + |
|
51 | + if (isset($_SERVER['HTTP_RANGE'])) { |
|
52 | + header('Accept-Ranges: bytes'); |
|
53 | + $c_start = $start; |
|
54 | + $c_end = $end; |
|
55 | + list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2); |
|
56 | + |
|
57 | + if (strpos($range, ',') !== false) { |
|
58 | + header("Content-Range: bytes $start-$end/$size"); |
|
59 | + |
|
60 | + throw new Exception\InvalidRange('invalid offset/limit requested'); |
|
61 | + } |
|
62 | + |
|
63 | + if ($range == '-') { |
|
64 | + $c_start = $size - substr($range, 1); |
|
65 | + } else { |
|
66 | + $range = explode('-', $range); |
|
67 | + $c_start = $range[0]; |
|
68 | + $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size; |
|
69 | + } |
|
70 | + |
|
71 | + $c_end = ($c_end > $end) ? $end : $c_end; |
|
72 | + if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) { |
|
73 | + header("Content-Range: bytes $start-$end/$size"); |
|
74 | + |
|
75 | + throw new Exception\InvalidRange('invalid offset/limit requested'); |
|
76 | + } |
|
77 | + |
|
78 | + $start = (int) $c_start; |
|
79 | + $end = (int) $c_end; |
|
80 | + $length = (int) $end - $start + 1; |
|
81 | + fseek($stream, $start); |
|
82 | + header('HTTP/1.1 206 Partial Content'); |
|
83 | + header("Content-Range: bytes $start-$end/$size"); |
|
84 | + } |
|
85 | + |
|
86 | + header('Content-Length: '.$length); |
|
87 | + $buffer = 1024 * 8; |
|
88 | + |
|
89 | + while (!feof($stream) && ($p = ftell($stream)) <= $end) { |
|
90 | + if ($p + $buffer > $end) { |
|
91 | + $buffer = $end - $p + 1; |
|
92 | + } |
|
93 | + |
|
94 | + echo fread($stream, $buffer); |
|
95 | + flush(); |
|
96 | + } |
|
97 | + |
|
98 | + fclose($stream); |
|
99 | + }); |
|
100 | 100 | } |
101 | 101 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | return $response |
37 | 37 | ->setOutputFormat(null) |
38 | - ->setBody(function () use ($file) { |
|
38 | + ->setBody(function() use ($file) { |
|
39 | 39 | $stream = $file->get(); |
40 | 40 | $name = $file->getName(); |
41 | 41 |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * Load nodes by id. |
276 | 276 | * |
277 | 277 | * @param string $class Force check node type |
278 | - * @param bool $deleted |
|
278 | + * @param integer $deleted |
|
279 | 279 | */ |
280 | 280 | public function findNodesById(array $id = [], ?string $class = null, int $deleted = NodeInterface::DELETED_INCLUDE): Generator |
281 | 281 | { |
@@ -367,6 +367,8 @@ discard block |
||
367 | 367 | * Load nodes by id. |
368 | 368 | * |
369 | 369 | * @param null|mixed $class |
370 | + * @param string $id |
|
371 | + * @param string $path |
|
370 | 372 | */ |
371 | 373 | public function getNodes(?array $id = null, ?array $path = null, $class = null, int $deleted = NodeInterface::DELETED_EXCLUDE): Generator |
372 | 374 | { |
@@ -395,9 +397,10 @@ discard block |
||
395 | 397 | /** |
396 | 398 | * Load node. |
397 | 399 | * |
398 | - * @param null|mixed $id |
|
399 | - * @param null|mixed $path |
|
400 | + * @param string|null $id |
|
401 | + * @param string|null $path |
|
400 | 402 | * @param null|mixed $class |
403 | + * @param integer $deleted |
|
401 | 404 | */ |
402 | 405 | public function getNode($id = null, $path = null, $class = null, bool $multiple = false, bool $allow_root = false, ?int $deleted = null): NodeInterface |
403 | 406 | { |
@@ -449,6 +452,8 @@ discard block |
||
449 | 452 | |
450 | 453 | /** |
451 | 454 | * Find nodes with custom filters. |
455 | + * @param integer $offset |
|
456 | + * @param integer $limit |
|
452 | 457 | */ |
453 | 458 | public function findNodesByFilter(array $filter, ?int $offset = null, ?int $limit = null): Generator |
454 | 459 | { |
@@ -475,6 +480,8 @@ discard block |
||
475 | 480 | |
476 | 481 | /** |
477 | 482 | * Get custom filtered children. |
483 | + * @param integer $offset |
|
484 | + * @param integer $limit |
|
478 | 485 | */ |
479 | 486 | public function findNodesByFilterUser(int $deleted, array $filter, ?int $offset = null, ?int $limit = null): Generator |
480 | 487 | { |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $this->db->storage->updateOne( |
50 | 50 | ['_id' => $object['_id']], |
51 | 51 | [ |
52 | - '$set' => ['pointer' => $pointer], |
|
52 | + '$set' => ['pointer' => $pointer], |
|
53 | 53 | ] |
54 | 54 | ); |
55 | 55 | } |