From 8588bb4555f5203c8cfd52cc6c11982c4ffe1b05 Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 25 Apr 2024 19:31:30 +0300 Subject: [PATCH 01/12] getEnv on worker.php --- app/worker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/worker.php b/app/worker.php index de12bba6cb..5e5ec1e148 100644 --- a/app/worker.php +++ b/app/worker.php @@ -215,7 +215,7 @@ Server::setResource('getCacheDevice', function () { $pools = $register->get('pools'); $platform = new Appwrite(); -$args = $_SERVER['argv']; +$args = $platform->getEnv('argv'); if (!isset($args[1])) { Console::error('Missing worker name'); From 5137d8ad725bd3372bbb41b0f0ce097cd385b32d Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 8 May 2024 20:16:21 +0300 Subject: [PATCH 02/12] platform version on composer --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 286594441f..7e3cc5c383 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,7 @@ "utopia-php/messaging": "0.10.*", "utopia-php/migration": "0.4.*", "utopia-php/orchestration": "0.9.*", - "utopia-php/platform": "0.5.*", + "utopia-php/platform": "0.0.*", "utopia-php/pools": "0.4.*", "utopia-php/queue": "0.7.*", "utopia-php/registry": "0.5.*", From 9f238712408f898e286db7095f483022b102c2b6 Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 8 May 2024 20:19:09 +0300 Subject: [PATCH 03/12] platform version on composer --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7e3cc5c383..f094a5e37e 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,7 @@ "utopia-php/messaging": "0.10.*", "utopia-php/migration": "0.4.*", "utopia-php/orchestration": "0.9.*", - "utopia-php/platform": "0.0.*", + "utopia-php/platform": "0.7.*", "utopia-php/pools": "0.4.*", "utopia-php/queue": "0.7.*", "utopia-php/registry": "0.5.*", From 70c6ef3b3662dc9204dda0ffb5385f045891849f Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 8 May 2024 20:20:34 +0300 Subject: [PATCH 04/12] composer format --- composer.lock | 75 ++++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/composer.lock b/composer.lock index 34a3cc143c..c099c60274 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3f703f77225d4022cd5823814ab7c3e7", + "content-hash": "a301f59a557e2f6c6b454457bfeaec4e", "packages": [ { "name": "adhocore/jwt", @@ -822,16 +822,16 @@ }, { "name": "paragonie/constant_time_encoding", - "version": "v2.6.3", + "version": "v2.7.0", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "58c3f47f650c94ec05a151692652a868995d2938" + "reference": "52a0d99e69f56b9ec27ace92ba56897fe6993105" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/58c3f47f650c94ec05a151692652a868995d2938", - "reference": "58c3f47f650c94ec05a151692652a868995d2938", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/52a0d99e69f56b9ec27ace92ba56897fe6993105", + "reference": "52a0d99e69f56b9ec27ace92ba56897fe6993105", "shasum": "" }, "require": { @@ -885,7 +885,7 @@ "issues": "https://github.com/paragonie/constant_time_encoding/issues", "source": "https://github.com/paragonie/constant_time_encoding" }, - "time": "2022-06-14T06:56:20+00:00" + "time": "2024-05-08T12:18:48+00:00" }, { "name": "phpmailer/phpmailer", @@ -1672,16 +1672,16 @@ }, { "name": "utopia-php/dsn", - "version": "0.2.0", + "version": "0.2.1", "source": { "type": "git", "url": "https://github.com/utopia-php/dsn.git", - "reference": "c11f37a12c3f6aaf9fea97ca7cb363dcc93668d7" + "reference": "42ee37a3d1785100b2f69091c9d4affadb6846eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/dsn/zipball/c11f37a12c3f6aaf9fea97ca7cb363dcc93668d7", - "reference": "c11f37a12c3f6aaf9fea97ca7cb363dcc93668d7", + "url": "https://api.github.com/repos/utopia-php/dsn/zipball/42ee37a3d1785100b2f69091c9d4affadb6846eb", + "reference": "42ee37a3d1785100b2f69091c9d4affadb6846eb", "shasum": "" }, "require": { @@ -1713,9 +1713,9 @@ ], "support": { "issues": "https://github.com/utopia-php/dsn/issues", - "source": "https://github.com/utopia-php/dsn/tree/0.2.0" + "source": "https://github.com/utopia-php/dsn/tree/0.2.1" }, - "time": "2023-11-02T12:01:43+00:00" + "time": "2024-05-07T02:01:25+00:00" }, { "name": "utopia-php/framework", @@ -1966,16 +1966,16 @@ }, { "name": "utopia-php/migration", - "version": "0.4.0", + "version": "0.4.1", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "a72f27bd3dde68752fb185d306c4820e1b8d9657" + "reference": "ae3cfe93f6d313105d226aeb68806660c806a925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/a72f27bd3dde68752fb185d306c4820e1b8d9657", - "reference": "a72f27bd3dde68752fb185d306c4820e1b8d9657", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/ae3cfe93f6d313105d226aeb68806660c806a925", + "reference": "ae3cfe93f6d313105d226aeb68806660c806a925", "shasum": "" }, "require": { @@ -2008,9 +2008,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/0.4.0" + "source": "https://github.com/utopia-php/migration/tree/0.4.1" }, - "time": "2024-02-25T12:35:21+00:00" + "time": "2024-05-01T13:19:18+00:00" }, { "name": "utopia-php/mongo", @@ -2124,16 +2124,16 @@ }, { "name": "utopia-php/platform", - "version": "0.5.1", + "version": "0.7.0", "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "3eceef0b6593fe0f7d2efd36d40402a395a4c285" + "reference": "beeea0f2c9bce14a6869fc5c87a1047cdecb5c52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/3eceef0b6593fe0f7d2efd36d40402a395a4c285", - "reference": "3eceef0b6593fe0f7d2efd36d40402a395a4c285", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/beeea0f2c9bce14a6869fc5c87a1047cdecb5c52", + "reference": "beeea0f2c9bce14a6869fc5c87a1047cdecb5c52", "shasum": "" }, "require": { @@ -2141,7 +2141,8 @@ "ext-redis": "*", "php": ">=8.0", "utopia-php/cli": "0.15.*", - "utopia-php/framework": "0.*.*" + "utopia-php/framework": "0.33.*", + "utopia-php/queue": "0.7.*" }, "require-dev": { "laravel/pint": "1.2.*", @@ -2167,9 +2168,9 @@ ], "support": { "issues": "https://github.com/utopia-php/platform/issues", - "source": "https://github.com/utopia-php/platform/tree/0.5.1" + "source": "https://github.com/utopia-php/platform/tree/0.7.0" }, - "time": "2023-12-26T16:14:41+00:00" + "time": "2024-05-08T17:00:55+00:00" }, { "name": "utopia-php/pools", @@ -2899,16 +2900,16 @@ }, { "name": "laravel/pint", - "version": "v1.15.2", + "version": "v1.15.3", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "2c9f8004899815f3f0ee3cb28ef7281e2b589134" + "reference": "3600b5d17aff52f6100ea4921849deacbbeb8656" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/2c9f8004899815f3f0ee3cb28ef7281e2b589134", - "reference": "2c9f8004899815f3f0ee3cb28ef7281e2b589134", + "url": "https://api.github.com/repos/laravel/pint/zipball/3600b5d17aff52f6100ea4921849deacbbeb8656", + "reference": "3600b5d17aff52f6100ea4921849deacbbeb8656", "shasum": "" }, "require": { @@ -2961,7 +2962,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-04-23T15:42:34+00:00" + "time": "2024-04-30T15:02:26+00:00" }, { "name": "matthiasmullie/minify", @@ -3568,16 +3569,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.28.0", + "version": "1.29.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb" + "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", - "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", + "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", "shasum": "" }, "require": { @@ -3609,9 +3610,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.28.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" }, - "time": "2024-04-03T18:51:33+00:00" + "time": "2024-05-06T12:04:23+00:00" }, { "name": "phpunit/php-code-coverage", @@ -5476,5 +5477,5 @@ "platform-overrides": { "php": "8.3" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.2.0" } From 7fed0f9a2365f89af3b223b06e48e294db2fbaf3 Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 8 May 2024 20:57:27 +0300 Subject: [PATCH 05/12] composer format --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f094a5e37e..286594441f 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,7 @@ "utopia-php/messaging": "0.10.*", "utopia-php/migration": "0.4.*", "utopia-php/orchestration": "0.9.*", - "utopia-php/platform": "0.7.*", + "utopia-php/platform": "0.5.*", "utopia-php/pools": "0.4.*", "utopia-php/queue": "0.7.*", "utopia-php/registry": "0.5.*", From 390dd22efe44b5d7132be3cee4b273845489a700 Mon Sep 17 00:00:00 2001 From: shimon Date: Sun, 12 May 2024 11:19:17 +0300 Subject: [PATCH 06/12] composer format --- composer.lock | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index c099c60274..b9da05bbeb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a301f59a557e2f6c6b454457bfeaec4e", + "content-hash": "3f703f77225d4022cd5823814ab7c3e7", "packages": [ { "name": "adhocore/jwt", @@ -2124,16 +2124,16 @@ }, { "name": "utopia-php/platform", - "version": "0.7.0", + "version": "0.5.1", "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "beeea0f2c9bce14a6869fc5c87a1047cdecb5c52" + "reference": "3eceef0b6593fe0f7d2efd36d40402a395a4c285" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/beeea0f2c9bce14a6869fc5c87a1047cdecb5c52", - "reference": "beeea0f2c9bce14a6869fc5c87a1047cdecb5c52", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/3eceef0b6593fe0f7d2efd36d40402a395a4c285", + "reference": "3eceef0b6593fe0f7d2efd36d40402a395a4c285", "shasum": "" }, "require": { @@ -2141,8 +2141,7 @@ "ext-redis": "*", "php": ">=8.0", "utopia-php/cli": "0.15.*", - "utopia-php/framework": "0.33.*", - "utopia-php/queue": "0.7.*" + "utopia-php/framework": "0.*.*" }, "require-dev": { "laravel/pint": "1.2.*", @@ -2168,9 +2167,9 @@ ], "support": { "issues": "https://github.com/utopia-php/platform/issues", - "source": "https://github.com/utopia-php/platform/tree/0.7.0" + "source": "https://github.com/utopia-php/platform/tree/0.5.1" }, - "time": "2024-05-08T17:00:55+00:00" + "time": "2023-12-26T16:14:41+00:00" }, { "name": "utopia-php/pools", From 96741ac70e2a8e1914d29f023aa47ff93e043521 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 17 May 2024 11:19:29 +0100 Subject: [PATCH 07/12] chore: remove compose version --- docker-compose.yml | 2 -- tests/resources/docker/docker-compose.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0ba0bdb90e..085fa8a16c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,8 +10,6 @@ x-logging: &x-logging max-file: "5" max-size: "10m" -version: "3" - services: traefik: image: traefik:2.11 diff --git a/tests/resources/docker/docker-compose.yml b/tests/resources/docker/docker-compose.yml index cd3c3b64ba..acb31d9fbe 100644 --- a/tests/resources/docker/docker-compose.yml +++ b/tests/resources/docker/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3' - services: traefik: image: traefik:2.2 From 2c19bb0a1de975e01e8e88ecf504533f2a28fadd Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 17 May 2024 20:46:14 +0100 Subject: [PATCH 08/12] chore: more deletions --- app/views/install/compose.phtml | 4 +--- src/Appwrite/Docker/Compose.php | 8 -------- tests/unit/Docker/ComposeTest.php | 5 ----- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 88fb1197f7..288169374e 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -11,9 +11,7 @@ $httpsPort = $this->getParam('httpsPort', ''); $version = $this->getParam('version', ''); $organization = $this->getParam('organization', ''); $image = $this->getParam('image', ''); -?>version: '3' - -services: +?>services: traefik: image: traefik:2.11 container_name: appwrite-traefik diff --git a/src/Appwrite/Docker/Compose.php b/src/Appwrite/Docker/Compose.php index 64441805de..241e281ed8 100644 --- a/src/Appwrite/Docker/Compose.php +++ b/src/Appwrite/Docker/Compose.php @@ -27,14 +27,6 @@ class Compose } } - /** - * @return string - */ - public function getVersion(): string - { - return (isset($this->compose['version'])) ? $this->compose['version'] : ''; - } - /** * @return Service[] */ diff --git a/tests/unit/Docker/ComposeTest.php b/tests/unit/Docker/ComposeTest.php index 56448ffd01..93e0204264 100644 --- a/tests/unit/Docker/ComposeTest.php +++ b/tests/unit/Docker/ComposeTest.php @@ -21,11 +21,6 @@ class ComposeTest extends TestCase $this->object = new Compose($data); } - public function testVersion(): void - { - $this->assertEquals('3', $this->object->getVersion()); - } - public function testServices(): void { $this->assertCount(15, $this->object->getServices()); From ab0d6f7c19bcabec1d758f7f2fb97eb1cd64daf5 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Tue, 21 May 2024 15:48:53 -0400 Subject: [PATCH 09/12] refactor(messaging worker): Refactoring local device to worker only --- app/worker.php | 4 --- src/Appwrite/Platform/Workers/Messaging.php | 39 +++++++++++++-------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/app/worker.php b/app/worker.php index 6f912a84fd..f313bab614 100644 --- a/app/worker.php +++ b/app/worker.php @@ -32,7 +32,6 @@ use Utopia\Queue\Connection; use Utopia\Queue\Message; use Utopia\Queue\Server; use Utopia\Registry\Registry; -use Utopia\Storage\Device\Local; use Utopia\System\System; Authorization::disable(); @@ -217,9 +216,6 @@ Server::setResource('deviceForCache', function (Document $project) { return getDevice(APP_STORAGE_CACHE . '/app-' . $project->getId()); }, ['project']); -Server::setResource('deviceForLocalFiles', function (Document $project) { - return new Local(APP_STORAGE_UPLOADS . '/app-' . $project->getId()); -}, ['project']); $pools = $register->get('pools'); $platform = new Appwrite(); diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index c270018430..9e6a0892d1 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -35,6 +35,7 @@ use Utopia\Messaging\Messages\SMS; use Utopia\Platform\Action; use Utopia\Queue\Message; use Utopia\Storage\Device; +use Utopia\Storage\Device\Local; use Utopia\Storage\Storage; use Utopia\System\System; @@ -42,6 +43,8 @@ use function Swoole\Coroutine\batch; class Messaging extends Action { + private ?Local $localDevice = null; + public static function getName(): string { return 'messaging'; @@ -58,9 +61,8 @@ class Messaging extends Action ->inject('log') ->inject('dbForProject') ->inject('deviceForFiles') - ->inject('deviceForLocalFiles') ->inject('queueForUsage') - ->callback(fn (Message $message, Log $log, Database $dbForProject, Device $deviceForFiles, Device $deviceForLocalFiles, Usage $queueForUsage) => $this->action($message, $log, $dbForProject, $deviceForFiles, $deviceForLocalFiles, $queueForUsage)); + ->callback(fn (Message $message, Log $log, Database $dbForProject, Device $deviceForFiles, Usage $queueForUsage) => $this->action($message, $log, $dbForProject, $deviceForFiles, $queueForUsage)); } /** @@ -68,7 +70,6 @@ class Messaging extends Action * @param Log $log * @param Database $dbForProject * @param Device $deviceForFiles - * @param Device $deviceForLocalFiles * @param Usage $queueForUsage * @return void * @throws \Exception @@ -78,7 +79,6 @@ class Messaging extends Action Log $log, Database $dbForProject, Device $deviceForFiles, - Device $deviceForLocalFiles, Usage $queueForUsage ): void { Runtime::setHookFlags(SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_TCP); @@ -101,7 +101,7 @@ class Messaging extends Action case MESSAGE_SEND_TYPE_EXTERNAL: $message = $dbForProject->getDocument('messages', $payload['messageId']); - $this->sendExternalMessage($dbForProject, $message, $deviceForFiles, $deviceForLocalFiles, ); + $this->sendExternalMessage($dbForProject, $message, $deviceForFiles, $project); break; default: throw new \Exception('Unknown message type: ' . $type); @@ -112,7 +112,7 @@ class Messaging extends Action Database $dbForProject, Document $message, Device $deviceForFiles, - Device $deviceForLocalFiles, + Document $project, ): void { $topicIds = $message->getAttribute('topics', []); $targetIds = $message->getAttribute('targets', []); @@ -218,8 +218,8 @@ class Messaging extends Action /** * @var array $results */ - $results = batch(\array_map(function ($providerId) use ($identifiers, &$providers, $default, $message, $dbForProject, $deviceForFiles, $deviceForLocalFiles) { - return function () use ($providerId, $identifiers, &$providers, $default, $message, $dbForProject, $deviceForFiles, $deviceForLocalFiles) { + $results = batch(\array_map(function ($providerId) use ($identifiers, &$providers, $default, $message, $dbForProject, $deviceForFiles, $project) { + return function () use ($providerId, $identifiers, &$providers, $default, $message, $dbForProject, $deviceForFiles, $project) { if (\array_key_exists($providerId, $providers)) { $provider = $providers[$providerId]; } else { @@ -246,8 +246,8 @@ class Messaging extends Action $adapter->getMaxMessagesPerRequest() ); - return batch(\array_map(function ($batch) use ($message, $provider, $adapter, $dbForProject, $deviceForFiles, $deviceForLocalFiles) { - return function () use ($batch, $message, $provider, $adapter, $dbForProject, $deviceForFiles, $deviceForLocalFiles) { + return batch(\array_map(function ($batch) use ($message, $provider, $adapter, $dbForProject, $deviceForFiles, $project) { + return function () use ($batch, $message, $provider, $adapter, $dbForProject, $deviceForFiles, $project) { $deliveredTotal = 0; $deliveryErrors = []; $messageData = clone $message; @@ -256,7 +256,7 @@ class Messaging extends Action $data = match ($provider->getAttribute('type')) { MESSAGE_TYPE_SMS => $this->buildSmsMessage($messageData, $provider), MESSAGE_TYPE_PUSH => $this->buildPushMessage($messageData), - MESSAGE_TYPE_EMAIL => $this->buildEmailMessage($dbForProject, $messageData, $provider, $deviceForFiles, $deviceForLocalFiles), + MESSAGE_TYPE_EMAIL => $this->buildEmailMessage($dbForProject, $messageData, $provider, $deviceForFiles, $project), default => throw new \Exception('Provider with the requested ID is of the incorrect type') }; @@ -354,8 +354,8 @@ class Messaging extends Action $path = $file->getAttribute('path', ''); - if ($deviceForLocalFiles->exists($path)) { - $deviceForLocalFiles->delete($path); + if ($this->getLocalDevice($project)->exists($path)) { + $this->getLocalDevice($project)->delete($path); } } } @@ -517,7 +517,7 @@ class Messaging extends Action Document $message, Document $provider, Device $deviceForFiles, - Device $deviceForLocalFiles, + Document $project, ): Email { $fromName = $provider['options']['fromName'] ?? null; $fromEmail = $provider['options']['fromEmail'] ?? null; @@ -579,7 +579,7 @@ class Messaging extends Action } if ($deviceForFiles->getType() !== Storage::DEVICE_LOCAL) { - $deviceForFiles->transfer($path, $path, $deviceForLocalFiles); + $deviceForFiles->transfer($path, $path, $this->getLocalDevice($project)); } $attachment = new Attachment( @@ -651,4 +651,13 @@ class Messaging extends Action $badge ); } + + private function getLocalDevice($project): Local + { + if($this->localDevice === null) { + $this->localDevice = new Local(APP_STORAGE_UPLOADS . '/app-' . $project->getId()); + } + + return $this->localDevice; + } } From e1863053ad8ef23fe32c6d016a46bcedb9f0e33d Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Tue, 21 May 2024 15:51:32 -0400 Subject: [PATCH 10/12] refactor(messaging worker): Adding volume and volume variables --- app/views/install/compose.phtml | 23 +++++++++++++++++++++++ docker-compose.yml | 22 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index eea99a1fb0..bd983a0d9d 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -523,6 +523,8 @@ services: restart: unless-stopped networks: - appwrite + volumes: + - appwrite-uploads:/storage/uploads:rw depends_on: - redis environment: @@ -542,6 +544,27 @@ services: - _APP_LOGGING_CONFIG - _APP_SMS_FROM - _APP_SMS_PROVIDER + - _APP_STORAGE_DEVICE + - _APP_STORAGE_S3_ACCESS_KEY + - _APP_STORAGE_S3_SECRET + - _APP_STORAGE_S3_REGION + - _APP_STORAGE_S3_BUCKET + - _APP_STORAGE_DO_SPACES_ACCESS_KEY + - _APP_STORAGE_DO_SPACES_SECRET + - _APP_STORAGE_DO_SPACES_REGION + - _APP_STORAGE_DO_SPACES_BUCKET + - _APP_STORAGE_BACKBLAZE_ACCESS_KEY + - _APP_STORAGE_BACKBLAZE_SECRET + - _APP_STORAGE_BACKBLAZE_REGION + - _APP_STORAGE_BACKBLAZE_BUCKET + - _APP_STORAGE_LINODE_ACCESS_KEY + - _APP_STORAGE_LINODE_SECRET + - _APP_STORAGE_LINODE_REGION + - _APP_STORAGE_LINODE_BUCKET + - _APP_STORAGE_WASABI_ACCESS_KEY + - _APP_STORAGE_WASABI_SECRET + - _APP_STORAGE_WASABI_REGION + - _APP_STORAGE_WASABI_BUCKET appwrite-worker-migrations: image: /: diff --git a/docker-compose.yml b/docker-compose.yml index 19a3b75602..3d3409716a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -569,6 +569,7 @@ services: networks: - appwrite volumes: + - appwrite-uploads:/storage/uploads:rw - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: @@ -591,6 +592,27 @@ services: - _APP_SMS_FROM - _APP_SMS_PROVIDER - _APP_SMS_PROJECTS_DENY_LIST + - _APP_STORAGE_DEVICE + - _APP_STORAGE_S3_ACCESS_KEY + - _APP_STORAGE_S3_SECRET + - _APP_STORAGE_S3_REGION + - _APP_STORAGE_S3_BUCKET + - _APP_STORAGE_DO_SPACES_ACCESS_KEY + - _APP_STORAGE_DO_SPACES_SECRET + - _APP_STORAGE_DO_SPACES_REGION + - _APP_STORAGE_DO_SPACES_BUCKET + - _APP_STORAGE_BACKBLAZE_ACCESS_KEY + - _APP_STORAGE_BACKBLAZE_SECRET + - _APP_STORAGE_BACKBLAZE_REGION + - _APP_STORAGE_BACKBLAZE_BUCKET + - _APP_STORAGE_LINODE_ACCESS_KEY + - _APP_STORAGE_LINODE_SECRET + - _APP_STORAGE_LINODE_REGION + - _APP_STORAGE_LINODE_BUCKET + - _APP_STORAGE_WASABI_ACCESS_KEY + - _APP_STORAGE_WASABI_SECRET + - _APP_STORAGE_WASABI_REGION + - _APP_STORAGE_WASABI_BUCKET appwrite-worker-migrations: entrypoint: worker-migrations From 83f338ccb1f762ac97c50057856e009546a4270b Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 22 May 2024 15:54:18 +0300 Subject: [PATCH 11/12] updating composer --- composer.lock | 85 +++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/composer.lock b/composer.lock index b9da05bbeb..7da023d9ff 100644 --- a/composer.lock +++ b/composer.lock @@ -1966,22 +1966,21 @@ }, { "name": "utopia-php/migration", - "version": "0.4.1", + "version": "0.4.4", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "ae3cfe93f6d313105d226aeb68806660c806a925" + "reference": "a8a5d392bebf082faf289f4dfe09d9fd76844c33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/ae3cfe93f6d313105d226aeb68806660c806a925", - "reference": "ae3cfe93f6d313105d226aeb68806660c806a925", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/a8a5d392bebf082faf289f4dfe09d9fd76844c33", + "reference": "a8a5d392bebf082faf289f4dfe09d9fd76844c33", "shasum": "" }, "require": { "appwrite/appwrite": "10.1.0", - "php": "8.*", - "utopia-php/cli": "0.*" + "php": "8.*" }, "require-dev": { "laravel/pint": "1.*", @@ -2008,9 +2007,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/0.4.1" + "source": "https://github.com/utopia-php/migration/tree/0.4.4" }, - "time": "2024-05-01T13:19:18+00:00" + "time": "2024-05-17T05:25:31+00:00" }, { "name": "utopia-php/mongo", @@ -2124,16 +2123,16 @@ }, { "name": "utopia-php/platform", - "version": "0.5.1", + "version": "0.5.2", "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "3eceef0b6593fe0f7d2efd36d40402a395a4c285" + "reference": "b9feabc79b92dc2b05683a986ad43bce5c1583e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/3eceef0b6593fe0f7d2efd36d40402a395a4c285", - "reference": "3eceef0b6593fe0f7d2efd36d40402a395a4c285", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/b9feabc79b92dc2b05683a986ad43bce5c1583e3", + "reference": "b9feabc79b92dc2b05683a986ad43bce5c1583e3", "shasum": "" }, "require": { @@ -2141,7 +2140,7 @@ "ext-redis": "*", "php": ">=8.0", "utopia-php/cli": "0.15.*", - "utopia-php/framework": "0.*.*" + "utopia-php/framework": "0.33.*" }, "require-dev": { "laravel/pint": "1.2.*", @@ -2167,9 +2166,9 @@ ], "support": { "issues": "https://github.com/utopia-php/platform/issues", - "source": "https://github.com/utopia-php/platform/tree/0.5.1" + "source": "https://github.com/utopia-php/platform/tree/0.5.2" }, - "time": "2023-12-26T16:14:41+00:00" + "time": "2024-05-22T12:50:35+00:00" }, { "name": "utopia-php/pools", @@ -2499,16 +2498,16 @@ }, { "name": "utopia-php/vcs", - "version": "0.6.5", + "version": "0.6.6", "source": { "type": "git", "url": "https://github.com/utopia-php/vcs.git", - "reference": "104e47ea8e38c156ec0e0bd415caa3dcd5046fe2" + "reference": "e538264cfee5e3efdfe1771efba04750cf20b2c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/vcs/zipball/104e47ea8e38c156ec0e0bd415caa3dcd5046fe2", - "reference": "104e47ea8e38c156ec0e0bd415caa3dcd5046fe2", + "url": "https://api.github.com/repos/utopia-php/vcs/zipball/e538264cfee5e3efdfe1771efba04750cf20b2c4", + "reference": "e538264cfee5e3efdfe1771efba04750cf20b2c4", "shasum": "" }, "require": { @@ -2542,9 +2541,9 @@ ], "support": { "issues": "https://github.com/utopia-php/vcs/issues", - "source": "https://github.com/utopia-php/vcs/tree/0.6.5" + "source": "https://github.com/utopia-php/vcs/tree/0.6.6" }, - "time": "2024-01-08T17:11:12+00:00" + "time": "2024-05-17T09:36:30+00:00" }, { "name": "utopia-php/websocket", @@ -2731,16 +2730,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.38.2", + "version": "0.38.6", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "51284668529e2b10ed933412a42b603c76cded23" + "reference": "d7016d6d72545e84709892faca972eb4bf5bd699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/51284668529e2b10ed933412a42b603c76cded23", - "reference": "51284668529e2b10ed933412a42b603c76cded23", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/d7016d6d72545e84709892faca972eb4bf5bd699", + "reference": "d7016d6d72545e84709892faca972eb4bf5bd699", "shasum": "" }, "require": { @@ -2776,9 +2775,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.38.2" + "source": "https://github.com/appwrite/sdk-generator/tree/0.38.6" }, - "time": "2024-04-25T07:49:29+00:00" + "time": "2024-05-20T18:00:16+00:00" }, { "name": "doctrine/deprecations", @@ -2899,16 +2898,16 @@ }, { "name": "laravel/pint", - "version": "v1.15.3", + "version": "v1.16.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "3600b5d17aff52f6100ea4921849deacbbeb8656" + "reference": "1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/3600b5d17aff52f6100ea4921849deacbbeb8656", - "reference": "3600b5d17aff52f6100ea4921849deacbbeb8656", + "url": "https://api.github.com/repos/laravel/pint/zipball/1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98", + "reference": "1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98", "shasum": "" }, "require": { @@ -2919,11 +2918,11 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.54.0", - "illuminate/view": "^10.48.8", - "larastan/larastan": "^2.9.5", - "laravel-zero/framework": "^10.3.0", - "mockery/mockery": "^1.6.11", + "friendsofphp/php-cs-fixer": "^3.57.1", + "illuminate/view": "^10.48.10", + "larastan/larastan": "^2.9.6", + "laravel-zero/framework": "^10.4.0", + "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^1.15.1", "pestphp/pest": "^2.34.7" }, @@ -2961,7 +2960,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-04-30T15:02:26+00:00" + "time": "2024-05-21T18:08:25+00:00" }, { "name": "matthiasmullie/minify", @@ -3377,16 +3376,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.0", + "version": "5.4.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a" + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", "shasum": "" }, "require": { @@ -3435,9 +3434,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" }, - "time": "2024-04-09T21:13:58+00:00" + "time": "2024-05-21T05:55:05+00:00" }, { "name": "phpdocumentor/type-resolver", From 72cfa82e8d6703b2ecff917488f85bdd4117f99f Mon Sep 17 00:00:00 2001 From: shimon Date: Wed, 22 May 2024 16:03:47 +0300 Subject: [PATCH 12/12] updating composer --- composer.lock | 60 +++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/composer.lock b/composer.lock index 3142bd9965..7da023d9ff 100644 --- a/composer.lock +++ b/composer.lock @@ -2123,16 +2123,16 @@ }, { "name": "utopia-php/platform", - "version": "0.5.1", + "version": "0.5.2", "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "3eceef0b6593fe0f7d2efd36d40402a395a4c285" + "reference": "b9feabc79b92dc2b05683a986ad43bce5c1583e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/3eceef0b6593fe0f7d2efd36d40402a395a4c285", - "reference": "3eceef0b6593fe0f7d2efd36d40402a395a4c285", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/b9feabc79b92dc2b05683a986ad43bce5c1583e3", + "reference": "b9feabc79b92dc2b05683a986ad43bce5c1583e3", "shasum": "" }, "require": { @@ -2140,7 +2140,7 @@ "ext-redis": "*", "php": ">=8.0", "utopia-php/cli": "0.15.*", - "utopia-php/framework": "0.*.*" + "utopia-php/framework": "0.33.*" }, "require-dev": { "laravel/pint": "1.2.*", @@ -2166,9 +2166,9 @@ ], "support": { "issues": "https://github.com/utopia-php/platform/issues", - "source": "https://github.com/utopia-php/platform/tree/0.5.1" + "source": "https://github.com/utopia-php/platform/tree/0.5.2" }, - "time": "2023-12-26T16:14:41+00:00" + "time": "2024-05-22T12:50:35+00:00" }, { "name": "utopia-php/pools", @@ -2730,16 +2730,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.38.5", + "version": "0.38.6", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "830a46cc8e34ee096a76d4af6f00adf008a7cbf8" + "reference": "d7016d6d72545e84709892faca972eb4bf5bd699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/830a46cc8e34ee096a76d4af6f00adf008a7cbf8", - "reference": "830a46cc8e34ee096a76d4af6f00adf008a7cbf8", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/d7016d6d72545e84709892faca972eb4bf5bd699", + "reference": "d7016d6d72545e84709892faca972eb4bf5bd699", "shasum": "" }, "require": { @@ -2775,9 +2775,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.38.5" + "source": "https://github.com/appwrite/sdk-generator/tree/0.38.6" }, - "time": "2024-05-17T00:59:59+00:00" + "time": "2024-05-20T18:00:16+00:00" }, { "name": "doctrine/deprecations", @@ -2898,16 +2898,16 @@ }, { "name": "laravel/pint", - "version": "v1.15.3", + "version": "v1.16.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "3600b5d17aff52f6100ea4921849deacbbeb8656" + "reference": "1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/3600b5d17aff52f6100ea4921849deacbbeb8656", - "reference": "3600b5d17aff52f6100ea4921849deacbbeb8656", + "url": "https://api.github.com/repos/laravel/pint/zipball/1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98", + "reference": "1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98", "shasum": "" }, "require": { @@ -2918,11 +2918,11 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.54.0", - "illuminate/view": "^10.48.8", - "larastan/larastan": "^2.9.5", - "laravel-zero/framework": "^10.3.0", - "mockery/mockery": "^1.6.11", + "friendsofphp/php-cs-fixer": "^3.57.1", + "illuminate/view": "^10.48.10", + "larastan/larastan": "^2.9.6", + "laravel-zero/framework": "^10.4.0", + "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^1.15.1", "pestphp/pest": "^2.34.7" }, @@ -2960,7 +2960,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-04-30T15:02:26+00:00" + "time": "2024-05-21T18:08:25+00:00" }, { "name": "matthiasmullie/minify", @@ -3376,16 +3376,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.0", + "version": "5.4.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a" + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", "shasum": "" }, "require": { @@ -3434,9 +3434,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" }, - "time": "2024-04-09T21:13:58+00:00" + "time": "2024-05-21T05:55:05+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -5475,5 +5475,5 @@ "platform-overrides": { "php": "8.3" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.2.0" }