@@ -265,6 +265,8 @@ |
||
265 | 265 | /** |
266 | 266 | * Get resolved member. |
267 | 267 | * |
268 | + * @param integer $offset |
|
269 | + * @param integer $limit |
|
268 | 270 | * @return Generator |
269 | 271 | */ |
270 | 272 | public function getResolvedMembers(?int $offset = null, ?int $limit = null): ?Generator |
@@ -221,10 +221,10 @@ |
||
221 | 221 | { |
222 | 222 | $mail = new Message(); |
223 | 223 | $mail->setBody($body) |
224 | - ->setFrom($this->user->getAttributes()['mail'], $this->user->getAttributes()['username']) |
|
225 | - ->setSubject($subject) |
|
226 | - ->setTo($this->user->getAttributes()['mail'], 'Undisclosed Recipients') |
|
227 | - ->setBcc($receiver); |
|
224 | + ->setFrom($this->user->getAttributes()['mail'], $this->user->getAttributes()['username']) |
|
225 | + ->setSubject($subject) |
|
226 | + ->setTo($this->user->getAttributes()['mail'], 'Undisclosed Recipients') |
|
227 | + ->setBcc($receiver); |
|
228 | 228 | $this->async->addJob(Mail::class, $mail->toString()); |
229 | 229 | |
230 | 230 | return (new Response())->setCode(202); |
@@ -49,8 +49,8 @@ |
||
49 | 49 | $this->db->storage->updateOne( |
50 | 50 | ['_id' => $object['_id']], |
51 | 51 | [ |
52 | - '$unset' => ['sharelink' => 1], |
|
53 | - '$set' => ['app.Balloon\App\Sharelink' => $object['sharelink']], |
|
52 | + '$unset' => ['sharelink' => 1], |
|
53 | + '$set' => ['app.Balloon\App\Sharelink' => $object['sharelink']], |
|
54 | 54 | ] |
55 | 55 | ); |
56 | 56 | } |
@@ -279,50 +279,50 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | return $response |
282 | - ->setOutputFormat(null) |
|
283 | - ->setBody(function () use ($node, $encode, $offset, $limit) { |
|
284 | - $stream = $node->get(); |
|
285 | - $name = $node->getName(); |
|
286 | - |
|
287 | - if (null === $stream) { |
|
288 | - return; |
|
289 | - } |
|
290 | - |
|
291 | - if (0 !== $offset) { |
|
292 | - if (fseek($stream, $offset) === -1) { |
|
293 | - throw new Exception\Conflict( |
|
282 | + ->setOutputFormat(null) |
|
283 | + ->setBody(function () use ($node, $encode, $offset, $limit) { |
|
284 | + $stream = $node->get(); |
|
285 | + $name = $node->getName(); |
|
286 | + |
|
287 | + if (null === $stream) { |
|
288 | + return; |
|
289 | + } |
|
290 | + |
|
291 | + if (0 !== $offset) { |
|
292 | + if (fseek($stream, $offset) === -1) { |
|
293 | + throw new Exception\Conflict( |
|
294 | 294 | 'invalid offset requested', |
295 | 295 | Exception\Conflict::INVALID_OFFSET |
296 | 296 | ); |
297 | - } |
|
298 | - } |
|
299 | - |
|
300 | - $read = 0; |
|
301 | - if ('base64' === $encode) { |
|
302 | - header('Content-Encoding: base64'); |
|
303 | - while (!feof($stream)) { |
|
304 | - if (0 !== $limit && $read + 8192 > $limit) { |
|
305 | - echo base64_encode(fread($stream, $limit - $read)); |
|
306 | - exit(); |
|
307 | - } |
|
308 | - |
|
309 | - echo base64_encode(fread($stream, 8192)); |
|
310 | - $read += 8192; |
|
311 | - } |
|
312 | - } else { |
|
313 | - while (!feof($stream)) { |
|
314 | - if (0 !== $limit && $read + 8192 > $limit) { |
|
315 | - echo fread($stream, $limit - $read); |
|
316 | - exit(); |
|
317 | - } |
|
318 | - |
|
319 | - echo fread($stream, 8192); |
|
320 | - $read += 8192; |
|
321 | - } |
|
322 | - |
|
323 | - exit(); |
|
324 | - } |
|
325 | - }); |
|
297 | + } |
|
298 | + } |
|
299 | + |
|
300 | + $read = 0; |
|
301 | + if ('base64' === $encode) { |
|
302 | + header('Content-Encoding: base64'); |
|
303 | + while (!feof($stream)) { |
|
304 | + if (0 !== $limit && $read + 8192 > $limit) { |
|
305 | + echo base64_encode(fread($stream, $limit - $read)); |
|
306 | + exit(); |
|
307 | + } |
|
308 | + |
|
309 | + echo base64_encode(fread($stream, 8192)); |
|
310 | + $read += 8192; |
|
311 | + } |
|
312 | + } else { |
|
313 | + while (!feof($stream)) { |
|
314 | + if (0 !== $limit && $read + 8192 > $limit) { |
|
315 | + echo fread($stream, $limit - $read); |
|
316 | + exit(); |
|
317 | + } |
|
318 | + |
|
319 | + echo fread($stream, 8192); |
|
320 | + $read += 8192; |
|
321 | + } |
|
322 | + |
|
323 | + exit(); |
|
324 | + } |
|
325 | + }); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -1073,9 +1073,9 @@ discard block |
||
1073 | 1073 | $node->zip($archive); |
1074 | 1074 | } catch (\Exception $e) { |
1075 | 1075 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
1076 | - 'category' => get_class($this), |
|
1077 | - 'exception' => $e, |
|
1078 | - ]); |
|
1076 | + 'category' => get_class($this), |
|
1077 | + 'exception' => $e, |
|
1078 | + ]); |
|
1079 | 1079 | } |
1080 | 1080 | } |
1081 | 1081 |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
190 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
191 | 191 | if (true === $move) { |
192 | 192 | $node = $node->setParent($parent, $conflict); |
193 | 193 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | return $response |
282 | 282 | ->setOutputFormat(null) |
283 | - ->setBody(function () use ($node, $encode, $offset, $limit) { |
|
283 | + ->setBody(function() use ($node, $encode, $offset, $limit) { |
|
284 | 284 | $stream = $node->get(); |
285 | 285 | $name = $node->getName(); |
286 | 286 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | return (new Response())->setCode(200)->setBody($result); |
430 | 430 | } |
431 | 431 | |
432 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
432 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
433 | 433 | return [ |
434 | 434 | 'code' => 200, |
435 | 435 | 'data' => $this->node_decorator->decorate($node, $attributes), |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | public function patch(?string $name = null, ?array $meta = null, ?bool $readonly = null, ?array $filter = null, ?string $id = null, ?string $p = null): Response |
544 | 544 | { |
545 | 545 | $attributes = compact('name', 'meta', 'readonly', 'filter'); |
546 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
546 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
547 | 547 | |
548 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
548 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
549 | 549 | foreach ($attributes as $attribute => $value) { |
550 | 550 | switch ($attribute) { |
551 | 551 | case 'name': |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | ); |
628 | 628 | } |
629 | 629 | |
630 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
630 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
631 | 631 | $result = $node->copyTo($parent, $conflict); |
632 | 632 | |
633 | 633 | return [ |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | ); |
692 | 692 | } |
693 | 693 | |
694 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
694 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
695 | 695 | $result = $node->setParent($parent, $conflict); |
696 | 696 | |
697 | 697 | return [ |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
746 | 746 | } |
747 | 747 | |
748 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
748 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
749 | 749 | if (null === $at) { |
750 | 750 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
751 | 751 | } else { |
@@ -116,9 +116,7 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param iterable $receiver |
118 | 118 | * @param User $sender |
119 | - * @param string $subject |
|
120 | - * @param string $body |
|
121 | - * @param array $context |
|
119 | + * @param string $context |
|
122 | 120 | * |
123 | 121 | * @return bool |
124 | 122 | */ |
@@ -226,10 +224,10 @@ discard block |
||
226 | 224 | /** |
227 | 225 | * Add notification. |
228 | 226 | * |
229 | - * @param array $receiver |
|
230 | - * @param User $user |
|
227 | + * @param User $receiver |
|
231 | 228 | * @param MessageInterface $message |
232 | 229 | * @param array $context |
230 | + * @param User $sender |
|
233 | 231 | * |
234 | 232 | * @return ObjectId |
235 | 233 | */ |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | |
405 | 405 | if ($node instanceof Collection && $recursive === true) { |
406 | 406 | $db = $this->db; |
407 | - $node->doRecursiveAction(function ($child) use ($db, $subscription) { |
|
407 | + $node->doRecursiveAction(function($child) use ($db, $subscription) { |
|
408 | 408 | $subscription['node_id'] = $child->getId(); |
409 | 409 | $db->subscription->replaceOne( |
410 | 410 | [ |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | |
431 | 431 | if ($node instanceof Collection && $recursive === true) { |
432 | 432 | $db = $this->db; |
433 | - $node->doRecursiveAction(function ($child) use ($db, $node_id, $user_id) { |
|
433 | + $node->doRecursiveAction(function($child) use ($db, $node_id, $user_id) { |
|
434 | 434 | $db->subscription->deleteOne([ |
435 | 435 | 'user' => $user_id, |
436 | 436 | 'node' => $node_id, |
@@ -73,7 +73,6 @@ discard block |
||
73 | 73 | /** |
74 | 74 | * Constructor. |
75 | 75 | * |
76 | - * @param Database $db |
|
77 | 76 | * @param LoggerInterface $logger |
78 | 77 | */ |
79 | 78 | public function __construct(SocketFactory $factory, LoggerInterface $logger, ?Iterable $config = null) |
@@ -131,7 +130,7 @@ discard block |
||
131 | 130 | * |
132 | 131 | * @param File $file |
133 | 132 | * |
134 | - * @return array |
|
133 | + * @return File |
|
135 | 134 | */ |
136 | 135 | public function scan(File $file): array |
137 | 136 | { |
@@ -50,7 +50,6 @@ |
||
50 | 50 | /** |
51 | 51 | * Constructor. |
52 | 52 | * |
53 | - * @param App $app |
|
54 | 53 | * @param Async $async |
55 | 54 | * @param LoggerInterface $logger |
56 | 55 | * @param GetOpt $getopt |
@@ -14,7 +14,6 @@ |
||
14 | 14 | use Balloon\Filesystem\Node\File; |
15 | 15 | use Balloon\Filesystem\Node\NodeInterface; |
16 | 16 | use Balloon\Filesystem\Storage\Adapter\AdapterInterface; |
17 | -use Balloon\Filesystem\Storage\Adapter\Gridfs; |
|
18 | 17 | use Psr\Log\LoggerInterface; |
19 | 18 | |
20 | 19 | class Storage |
@@ -341,7 +341,7 @@ |
||
341 | 341 | } |
342 | 342 | |
343 | 343 | $this->logger->debug('elasticsarch blob document ['.$result['_id'].'] has no references left, remove completely', [ |
344 | - 'category' => get_class($this), |
|
344 | + 'category' => get_class($this), |
|
345 | 345 | ]); |
346 | 346 | |
347 | 347 | return $this->deleteBlob($result['_id']); |
@@ -72,8 +72,7 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * Constructor. |
74 | 74 | * |
75 | - * @param Elasticsarch $es |
|
76 | - * @param Storage $storage |
|
75 | + * @param Elasticsearch $es |
|
77 | 76 | * @param Server $server |
78 | 77 | * @param NodeAttributeDecorator $decorator |
79 | 78 | * @param LoggerInterface $logger |
@@ -368,7 +367,7 @@ discard block |
||
368 | 367 | * |
369 | 368 | * @param NodeInterface $node |
370 | 369 | * |
371 | - * @return array |
|
370 | + * @return NodeInterface |
|
372 | 371 | */ |
373 | 372 | protected function getParams(NodeInterface $node): array |
374 | 373 | { |
@@ -439,7 +438,6 @@ discard block |
||
439 | 438 | /** |
440 | 439 | * Add or update blob. |
441 | 440 | * |
442 | - * @param File $node |
|
443 | 441 | * |
444 | 442 | * @return bool |
445 | 443 | */ |
@@ -480,8 +478,6 @@ discard block |
||
480 | 478 | * Prepare references update. |
481 | 479 | * |
482 | 480 | * @param array $references |
483 | - * @param array $new_references |
|
484 | - * @param array $new_share_references |
|
485 | 481 | * |
486 | 482 | * @return array |
487 | 483 | */ |
@@ -555,7 +551,6 @@ discard block |
||
555 | 551 | /** |
556 | 552 | * Update blob. |
557 | 553 | * |
558 | - * @param File $file |
|
559 | 554 | * @param array $meta |
560 | 555 | * |
561 | 556 | * @return bool |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | protected function addShare(Collection $collection): bool |
272 | 272 | { |
273 | 273 | $that = $this; |
274 | - $collection->doRecursiveAction(function ($node) use ($that) { |
|
274 | + $collection->doRecursiveAction(function($node) use ($that) { |
|
275 | 275 | if ($node instanceof Collection) { |
276 | 276 | $that->addShare($node); |
277 | 277 | } else { |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | protected function deleteShare(Collection $collection): bool |
293 | 293 | { |
294 | 294 | $that = $this; |
295 | - $collection->doRecursiveAction(function ($node) use ($that) { |
|
295 | + $collection->doRecursiveAction(function($node) use ($that) { |
|
296 | 296 | if ($node instanceof Collection) { |
297 | 297 | $that->deleteShare($node); |
298 | 298 | } else { |