@@ -114,10 +114,10 @@ |
||
| 114 | 114 | $body->setParts([$html, $plain]); |
| 115 | 115 | |
| 116 | 116 | $mail = (new Message()) |
| 117 | - ->setSubject($message->getSubject($receiver)) |
|
| 118 | - ->setBody($body) |
|
| 119 | - ->setTo($address) |
|
| 120 | - ->setEncoding('UTF-8'); |
|
| 117 | + ->setSubject($message->getSubject($receiver)) |
|
| 118 | + ->setBody($body) |
|
| 119 | + ->setTo($address) |
|
| 120 | + ->setEncoding('UTF-8'); |
|
| 121 | 121 | |
| 122 | 122 | $type = $mail->getHeaders()->get('Content-Type'); |
| 123 | 123 | $type->setType('multipart/alternative'); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | 'directory' => $node instanceof Collection, |
| 57 | 57 | 'meta' => $node->getMetaAttributes(), |
| 58 | 58 | 'size' => $node->getSize(), |
| 59 | - 'parent' => function ($node, $requested) use ($attributes) { |
|
| 59 | + 'parent' => function($node, $requested) use ($attributes) { |
|
| 60 | 60 | $parent = $node->getParent(); |
| 61 | 61 | |
| 62 | 62 | if (null === $parent || $parent->isRoot()) { |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | 'shared' => (string) $attributes['shared'], |
| 70 | 70 | 'created' => $attributes['created']->toDateTime()->format('c'), |
| 71 | 71 | 'changed' => $attributes['changed']->toDateTime()->format('c'), |
| 72 | - 'deleted' => function ($node, $requested) use ($attributes) { |
|
| 72 | + 'deleted' => function($node, $requested) use ($attributes) { |
|
| 73 | 73 | if (!$attributes['deleted']) { |
| 74 | 74 | return null; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | return $attributes['deleted']->toDateTime()->format('c'); |
| 78 | 78 | }, |
| 79 | - 'destroy' => function ($node, $requested) use ($attributes) { |
|
| 79 | + 'destroy' => function($node, $requested) use ($attributes) { |
|
| 80 | 80 | if (!$attributes['destroy']) { |
| 81 | 81 | return null; |
| 82 | 82 | } |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | }); |
| 67 | 67 | |
| 68 | - $node_decorator_v2->addDecorator('sharelink_has_password', function ($node) use ($sharelink) { |
|
| 68 | + $node_decorator_v2->addDecorator('sharelink_has_password', function($node) use ($sharelink) { |
|
| 69 | 69 | $attributes = $sharelink->getSharelink($node); |
| 70 | 70 | |
| 71 | 71 | return isset($attributes['password']); |
| 72 | 72 | }); |
| 73 | 73 | |
| 74 | - $node_decorator_v2->addDecorator('sharelink_token', function ($node) use ($sharelink) { |
|
| 74 | + $node_decorator_v2->addDecorator('sharelink_token', function($node) use ($sharelink) { |
|
| 75 | 75 | $attributes = $sharelink->getSharelink($node); |
| 76 | 76 | |
| 77 | 77 | if (isset($attributes['token'])) { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | }); |
| 81 | 81 | |
| 82 | - $node_decorator_v2->addDecorator('sharelink_expire', function ($node) use ($sharelink) { |
|
| 82 | + $node_decorator_v2->addDecorator('sharelink_expire', function($node) use ($sharelink) { |
|
| 83 | 83 | $attributes = $sharelink->getSharelink($node); |
| 84 | 84 | |
| 85 | 85 | if (isset($attributes['expiration'])) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | - $node_decorator_v1->addDecorator('sharelink', function ($node) use ($sharelink) { |
|
| 92 | + $node_decorator_v1->addDecorator('sharelink', function($node) use ($sharelink) { |
|
| 93 | 93 | return isset($sharelink->getSharelink($node)['token']); |
| 94 | 94 | }); |
| 95 | 95 | |
@@ -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, |
@@ -284,46 +284,46 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | return $response->setOutputFormat(null) |
| 287 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 288 | - $mime = $node->getContentType(); |
|
| 289 | - $stream = $node->get(); |
|
| 290 | - $name = $node->getName(); |
|
| 291 | - |
|
| 292 | - if (null === $stream) { |
|
| 293 | - return; |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - if (0 !== $offset) { |
|
| 297 | - if (fseek($stream, $offset) === -1) { |
|
| 298 | - throw new Exception\Conflict('invalid offset requested', Exception\Conflict::INVALID_OFFSET); |
|
| 299 | - } |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - $read = 0; |
|
| 303 | - header('Content-Type: '.$mime.''); |
|
| 304 | - if ('base64' === $encode) { |
|
| 305 | - header('Content-Encoding: base64'); |
|
| 306 | - while (!feof($stream)) { |
|
| 307 | - if (0 !== $length && $read + 8192 > $length) { |
|
| 308 | - echo base64_encode(fread($stream, $length - $read)); |
|
| 309 | - exit(); |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - echo base64_encode(fread($stream, 8192)); |
|
| 313 | - $read += 8192; |
|
| 314 | - } |
|
| 315 | - } else { |
|
| 316 | - while (!feof($stream)) { |
|
| 317 | - if (0 !== $length && $read + 8192 > $length) { |
|
| 318 | - echo fread($stream, $length - $read); |
|
| 319 | - exit(); |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - echo fread($stream, 8192); |
|
| 323 | - $read += 8192; |
|
| 324 | - } |
|
| 325 | - } |
|
| 326 | - }); |
|
| 287 | + ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 288 | + $mime = $node->getContentType(); |
|
| 289 | + $stream = $node->get(); |
|
| 290 | + $name = $node->getName(); |
|
| 291 | + |
|
| 292 | + if (null === $stream) { |
|
| 293 | + return; |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + if (0 !== $offset) { |
|
| 297 | + if (fseek($stream, $offset) === -1) { |
|
| 298 | + throw new Exception\Conflict('invalid offset requested', Exception\Conflict::INVALID_OFFSET); |
|
| 299 | + } |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + $read = 0; |
|
| 303 | + header('Content-Type: '.$mime.''); |
|
| 304 | + if ('base64' === $encode) { |
|
| 305 | + header('Content-Encoding: base64'); |
|
| 306 | + while (!feof($stream)) { |
|
| 307 | + if (0 !== $length && $read + 8192 > $length) { |
|
| 308 | + echo base64_encode(fread($stream, $length - $read)); |
|
| 309 | + exit(); |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + echo base64_encode(fread($stream, 8192)); |
|
| 313 | + $read += 8192; |
|
| 314 | + } |
|
| 315 | + } else { |
|
| 316 | + while (!feof($stream)) { |
|
| 317 | + if (0 !== $length && $read + 8192 > $length) { |
|
| 318 | + echo fread($stream, $length - $read); |
|
| 319 | + exit(); |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + echo fread($stream, 8192); |
|
| 323 | + $read += 8192; |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | + }); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** |
@@ -1318,9 +1318,9 @@ discard block |
||
| 1318 | 1318 | $node->zip($archive); |
| 1319 | 1319 | } catch (\Exception $e) { |
| 1320 | 1320 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
| 1321 | - 'category' => get_class($this), |
|
| 1322 | - 'exception' => $e, |
|
| 1323 | - ]); |
|
| 1321 | + 'category' => get_class($this), |
|
| 1322 | + 'exception' => $e, |
|
| 1323 | + ]); |
|
| 1324 | 1324 | } |
| 1325 | 1325 | } |
| 1326 | 1326 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
| 191 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
| 192 | 192 | if (true === $move) { |
| 193 | 193 | $node = $node->setParent($parent, $conflict); |
| 194 | 194 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | $node = $this->_getNode($id, $p); |
| 267 | 267 | if ($node instanceof Collection) { |
| 268 | - return (new Response())->setBody(function () use ($node) { |
|
| 268 | + return (new Response())->setBody(function() use ($node) { |
|
| 269 | 269 | $node->getZip(); |
| 270 | 270 | }); |
| 271 | 271 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | return $response->setOutputFormat(null) |
| 287 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 287 | + ->setBody(function() use ($node, $encode, $offset, $length) { |
|
| 288 | 288 | $mime = $node->getContentType(); |
| 289 | 289 | $stream = $node->get(); |
| 290 | 290 | $name = $node->getName(); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | */ |
| 353 | 353 | public function postReadonly($id = null, $p = null, bool $readonly = true): Response |
| 354 | 354 | { |
| 355 | - return $this->bulk($id, $p, function ($node) use ($readonly) { |
|
| 355 | + return $this->bulk($id, $p, function($node) use ($readonly) { |
|
| 356 | 356 | $node->setReadonly($readonly); |
| 357 | 357 | |
| 358 | 358 | return ['status' => 204]; |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | */ |
| 598 | 598 | public function postMetaAttributes(?string $id = null, ?string $p = null): Response |
| 599 | 599 | { |
| 600 | - return $this->bulk($id, $p, function ($node) { |
|
| 600 | + return $this->bulk($id, $p, function($node) { |
|
| 601 | 601 | $node->setMetaAttributes($_POST); |
| 602 | 602 | |
| 603 | 603 | return ['status' => 204]; |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | throw new Exception\NotFound('destination collection was not found or is not a collection', Exception\NotFound::DESTINATION_NOT_FOUND); |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 679 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 680 | 680 | $result = $node->copyTo($parent, $conflict); |
| 681 | 681 | |
| 682 | 682 | return [ |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | throw new Exception\NotFound('destination collection was not found or is not a collection', Exception\NotFound::DESTINATION_NOT_FOUND); |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 737 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 738 | 738 | $result = $node->setParent($parent, $conflict); |
| 739 | 739 | if (NodeInterface::CONFLICT_RENAME === $conflict) { |
| 740 | 740 | return [ |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
| 792 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
| 793 | 793 | if (null === $at) { |
| 794 | 794 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
| 795 | 795 | } else { |
@@ -256,9 +256,9 @@ |
||
| 256 | 256 | $body->setParts([$html, $plain]); |
| 257 | 257 | |
| 258 | 258 | $mail = (new Message()) |
| 259 | - ->setSubject($message->getSubject()) |
|
| 260 | - ->setBody($body) |
|
| 261 | - ->setEncoding('UTF-8'); |
|
| 259 | + ->setSubject($message->getSubject()) |
|
| 260 | + ->setBody($body) |
|
| 261 | + ->setEncoding('UTF-8'); |
|
| 262 | 262 | |
| 263 | 263 | $type = $mail->getHeaders()->get('Content-Type'); |
| 264 | 264 | $type->setType('multipart/alternative'); |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | namespace Balloon\Migration\Delta; |
| 13 | 13 | |
| 14 | 14 | use MongoDB\Database; |
| 15 | -use MongoDB\Driver\Exception\CommandException; |
|
| 16 | 15 | use MongoDB\Driver\Exception\RuntimeException; |
| 17 | 16 | |
| 18 | 17 | class Md5BlobIgnoreNull implements DeltaInterface |
@@ -127,20 +127,20 @@ discard block |
||
| 127 | 127 | 'mime' => (string) $attributes['mime'], |
| 128 | 128 | 'readonly' => (bool) $attributes['readonly'], |
| 129 | 129 | 'directory' => $node instanceof Collection, |
| 130 | - 'meta' => function ($node) { |
|
| 130 | + 'meta' => function($node) { |
|
| 131 | 131 | return (object) $node->getMetaAttributes(); |
| 132 | 132 | }, |
| 133 | - 'size' => function ($node) { |
|
| 133 | + 'size' => function($node) { |
|
| 134 | 134 | return $node->getSize(); |
| 135 | 135 | }, |
| 136 | - 'path' => function ($node) { |
|
| 136 | + 'path' => function($node) { |
|
| 137 | 137 | try { |
| 138 | 138 | return $node->getPath(); |
| 139 | 139 | } catch (\Exception $e) { |
| 140 | 140 | return null; |
| 141 | 141 | } |
| 142 | 142 | }, |
| 143 | - 'parent' => function ($node) { |
|
| 143 | + 'parent' => function($node) { |
|
| 144 | 144 | $parent = $node->getParent(); |
| 145 | 145 | |
| 146 | 146 | if (null === $parent || $parent->isRoot()) { |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | return (string) $parent->getId(); |
| 151 | 151 | }, |
| 152 | - 'access' => function ($node) use ($acl) { |
|
| 152 | + 'access' => function($node) use ($acl) { |
|
| 153 | 153 | return $acl->getAclPrivilege($node); |
| 154 | 154 | }, |
| 155 | - 'share' => function ($node) { |
|
| 155 | + 'share' => function($node) { |
|
| 156 | 156 | if (!$node->isShared() && !$node->isSpecial()) { |
| 157 | 157 | return false; |
| 158 | 158 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | return false; |
| 164 | 164 | } |
| 165 | 165 | }, |
| 166 | - 'shareowner' => function ($node) use ($server, $fs) { |
|
| 166 | + 'shareowner' => function($node) use ($server, $fs) { |
|
| 167 | 167 | if (!$node->isSpecial()) { |
| 168 | 168 | return null; |
| 169 | 169 | } |
@@ -206,20 +206,20 @@ discard block |
||
| 206 | 206 | protected function getTimeAttributes(NodeInterface $node, array $attributes): array |
| 207 | 207 | { |
| 208 | 208 | return [ |
| 209 | - 'created' => function ($node) use ($attributes) { |
|
| 209 | + 'created' => function($node) use ($attributes) { |
|
| 210 | 210 | return $this->dateTimeToUnix($attributes['created']); |
| 211 | 211 | }, |
| 212 | - 'changed' => function ($node) use ($attributes) { |
|
| 212 | + 'changed' => function($node) use ($attributes) { |
|
| 213 | 213 | return $this->dateTimeToUnix($attributes['changed']); |
| 214 | 214 | }, |
| 215 | - 'deleted' => function ($node) use ($attributes) { |
|
| 215 | + 'deleted' => function($node) use ($attributes) { |
|
| 216 | 216 | if (false === $attributes['deleted']) { |
| 217 | 217 | return false; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | return $this->dateTimeToUnix($attributes['deleted']); |
| 221 | 221 | }, |
| 222 | - 'destroy' => function ($node) use ($attributes) { |
|
| 222 | + 'destroy' => function($node) use ($attributes) { |
|
| 223 | 223 | if (null === $attributes['destroy']) { |
| 224 | 224 | return null; |
| 225 | 225 | } |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | /** |
| 86 | 86 | * Add decorator. |
| 87 | 87 | * |
| 88 | - * @return AttributeDecorator |
|
| 88 | + * @return NodeDecorator |
|
| 89 | 89 | */ |
| 90 | 90 | public function addDecorator(string $attribute, Closure $decorator): self |
| 91 | 91 | { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | 'message' => (string) $message['body'], |
| 99 | 99 | 'subject' => (string) $message['subject'], |
| 100 | 100 | 'locale' => (string) $message['locale'], |
| 101 | - 'sender' => function ($message) use ($server, $role_decorator) { |
|
| 101 | + 'sender' => function($message) use ($server, $role_decorator) { |
|
| 102 | 102 | if (!isset($message['sender'])) { |
| 103 | 103 | return null; |
| 104 | 104 | } |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | return null; |
| 110 | 110 | } |
| 111 | 111 | }, |
| 112 | - 'created' => function ($message) { |
|
| 112 | + 'created' => function($message) { |
|
| 113 | 113 | return (new DateTime())->setTimestamp($message['_id']->getTimestamp())->format('c'); |
| 114 | 114 | }, |
| 115 | - 'node' => function ($message) use ($node_decorator, $fs) { |
|
| 115 | + 'node' => function($message) use ($node_decorator, $fs) { |
|
| 116 | 116 | if (isset($message['node'])) { |
| 117 | 117 | try { |
| 118 | 118 | return $node_decorator->decorate($fs->findNodeById($message['node']), ['id', 'name', '_links']); |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | */ |
| 55 | 55 | protected function setErrorHandler(LoggerInterface $logger): self |
| 56 | 56 | { |
| 57 | - set_error_handler(function ($severity, $message, $file, $line) use ($logger) { |
|
| 57 | + set_error_handler(function($severity, $message, $file, $line) use ($logger) { |
|
| 58 | 58 | $log = $message.' in '.$file.':'.$line; |
| 59 | 59 | |
| 60 | 60 | switch ($severity) { |