From aa32b419a8f38637d5f7b8d041da335d32a0f6d3 Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 19 Oct 2023 13:50:32 +0300 Subject: [PATCH 1/9] hard coding utopia logger to 0.3.1 --- composer.json | 2 +- composer.lock | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index f73fc02584..365e816b56 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ "utopia-php/framework": "0.31.0", "utopia-php/image": "0.5.*", "utopia-php/locale": "0.4.*", - "utopia-php/logger": "0.3.*", + "utopia-php/logger": "0.3.1", "utopia-php/messaging": "0.1.*", "utopia-php/migration": "0.3.*", "utopia-php/orchestration": "0.9.*", diff --git a/composer.lock b/composer.lock index e0ab2c6aae..c6a13910ca 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": "6ff937a260c3e0c09de9eb5e073d830d", + "content-hash": "5f1e302b57b85e03be0b3983dc638486", "packages": [ { "name": "adhocore/jwt", @@ -2283,23 +2283,22 @@ }, { "name": "utopia-php/logger", - "version": "0.3.2", + "version": "0.3.1", "source": { "type": "git", "url": "https://github.com/utopia-php/logger.git", - "reference": "9151b7d16eab18d4c37c34643041cc0f33ca4a6c" + "reference": "de623f1ec1c672c795d113dd25c5bf212f7ef4fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/logger/zipball/9151b7d16eab18d4c37c34643041cc0f33ca4a6c", - "reference": "9151b7d16eab18d4c37c34643041cc0f33ca4a6c", + "url": "https://api.github.com/repos/utopia-php/logger/zipball/de623f1ec1c672c795d113dd25c5bf212f7ef4fc", + "reference": "de623f1ec1c672c795d113dd25c5bf212f7ef4fc", "shasum": "" }, "require": { "php": ">=8.0" }, "require-dev": { - "laravel/pint": "1.2.*", "phpstan/phpstan": "1.9.x-dev", "phpunit/phpunit": "^9.3", "vimeo/psalm": "4.0.1" @@ -2331,9 +2330,9 @@ ], "support": { "issues": "https://github.com/utopia-php/logger/issues", - "source": "https://github.com/utopia-php/logger/tree/0.3.2" + "source": "https://github.com/utopia-php/logger/tree/0.3.1" }, - "time": "2023-10-16T08:16:19+00:00" + "time": "2023-02-10T15:52:50+00:00" }, { "name": "utopia-php/messaging", From c159032e9350170eae4fba1518e9ffc01ae960b7 Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 19 Oct 2023 22:49:53 +0300 Subject: [PATCH 2/9] email template path --- src/Appwrite/Platform/Workers/Mails.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index b0cf28caeb..3570552a62 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -95,6 +95,9 @@ class Mails extends Action */ protected function getMailer(array $smtp): PHPMailer { + + var_dump($smtp); + $mail = new PHPMailer(true); $mail->isSMTP(); From 04676d9737c6d89051254f6251d089346e16e0cf Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 19 Oct 2023 22:57:59 +0300 Subject: [PATCH 3/9] debug --- src/Appwrite/Platform/Workers/Mails.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index 3570552a62..d4dccf4991 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -64,7 +64,7 @@ class Mails extends Action } $body = $body->render(); - + var_dump($smtp); /** @var PHPMailer $mail */ $mail = empty($smtp) ? $register->get('smtp') From 7f42fbfe718332eaa4afd107fcd930c828ebd941 Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 19 Oct 2023 23:11:30 +0300 Subject: [PATCH 4/9] debug --- src/Appwrite/Platform/Workers/Mails.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index d4dccf4991..75085e25e1 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -64,12 +64,13 @@ class Mails extends Action } $body = $body->render(); - var_dump($smtp); + /** @var PHPMailer $mail */ $mail = empty($smtp) ? $register->get('smtp') : $this->getMailer($smtp); - + var_dump("mail="); + var_dump($mail); $mail->clearAddresses(); $mail->clearAllRecipients(); $mail->clearReplyTos(); @@ -95,7 +96,7 @@ class Mails extends Action */ protected function getMailer(array $smtp): PHPMailer { - + var_dump("smtp="); var_dump($smtp); $mail = new PHPMailer(true); From 15347cce4b3628e55a133377798edb5e32347d26 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 20 Oct 2023 16:55:29 +0400 Subject: [PATCH 5/9] chore: update CI --- .github/workflows/publish.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 385016db91..0fc3fc2df3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,6 @@ jobs: with: fetch-depth: 2 submodules: recursive - ref: cl-1.4.x - name: Login to Docker Hub uses: docker/login-action@v2 From df35c79bc291829468c7e0894461ad22dc3fd0f9 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 20 Oct 2023 16:56:34 +0400 Subject: [PATCH 6/9] chore: remove var_dumps --- src/Appwrite/Platform/Workers/Mails.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index fa8899b5a7..6591127592 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -70,8 +70,6 @@ class Mails extends Action $mail = empty($smtp) ? $register->get('smtp') : $this->getMailer($smtp); - var_dump("mail="); - var_dump($mail); $mail->clearAddresses(); $mail->clearAllRecipients(); $mail->clearReplyTos(); @@ -97,9 +95,6 @@ class Mails extends Action */ protected function getMailer(array $smtp): PHPMailer { - var_dump("smtp="); - var_dump($smtp); - $mail = new PHPMailer(true); $mail->isSMTP(); From ce14e05d1d4383e2902d77b28ae1c220136cd3e8 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 20 Oct 2023 16:58:15 +0400 Subject: [PATCH 7/9] chore: sync with 1.4.x --- composer.json | 2 +- composer.lock | 87 +++---------------------- src/Appwrite/Platform/Workers/Mails.php | 4 +- 3 files changed, 13 insertions(+), 80 deletions(-) diff --git a/composer.json b/composer.json index 365e816b56..f73fc02584 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ "utopia-php/framework": "0.31.0", "utopia-php/image": "0.5.*", "utopia-php/locale": "0.4.*", - "utopia-php/logger": "0.3.1", + "utopia-php/logger": "0.3.*", "utopia-php/messaging": "0.1.*", "utopia-php/migration": "0.3.*", "utopia-php/orchestration": "0.9.*", diff --git a/composer.lock b/composer.lock index c6a13910ca..b691f894b4 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": "5f1e302b57b85e03be0b3983dc638486", + "content-hash": "6ff937a260c3e0c09de9eb5e073d830d", "packages": [ { "name": "adhocore/jwt", @@ -851,72 +851,6 @@ }, "time": "2021-10-08T21:21:46+00:00" }, - { - "name": "laravel/pint", - "version": "v1.2.1", - "source": { - "type": "git", - "url": "https://github.com/laravel/pint.git", - "reference": "e60e2112ee779ce60f253695b273d1646a17d6f1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/e60e2112ee779ce60f253695b273d1646a17d6f1", - "reference": "e60e2112ee779ce60f253695b273d1646a17d6f1", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-mbstring": "*", - "ext-tokenizer": "*", - "ext-xml": "*", - "php": "^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.11.0", - "illuminate/view": "^9.32.0", - "laravel-zero/framework": "^9.2.0", - "mockery/mockery": "^1.5.1", - "nunomaduro/larastan": "^2.2.0", - "nunomaduro/termwind": "^1.14.0", - "pestphp/pest": "^1.22.1" - }, - "bin": [ - "builds/pint" - ], - "type": "project", - "autoload": { - "psr-4": { - "App\\": "app/", - "Database\\Seeders\\": "database/seeders/", - "Database\\Factories\\": "database/factories/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nuno Maduro", - "email": "enunomaduro@gmail.com" - } - ], - "description": "An opinionated code formatter for PHP.", - "homepage": "https://laravel.com", - "keywords": [ - "format", - "formatter", - "lint", - "linter", - "php" - ], - "support": { - "issues": "https://github.com/laravel/pint/issues", - "source": "https://github.com/laravel/pint" - }, - "time": "2022-11-29T16:25:20+00:00" - }, { "name": "league/csv", "version": "9.7.1", @@ -2914,26 +2848,25 @@ }, { "name": "utopia-php/system", - "version": "0.7.1", + "version": "0.7.2", "source": { "type": "git", "url": "https://github.com/utopia-php/system.git", - "reference": "01bf0d283aded0ee0a7a6e5ff540acf64270ab27" + "reference": "4593d4d334b0c15879c4744a826e0362924c5d66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/system/zipball/01bf0d283aded0ee0a7a6e5ff540acf64270ab27", - "reference": "01bf0d283aded0ee0a7a6e5ff540acf64270ab27", + "url": "https://api.github.com/repos/utopia-php/system/zipball/4593d4d334b0c15879c4744a826e0362924c5d66", + "reference": "4593d4d334b0c15879c4744a826e0362924c5d66", "shasum": "" }, "require": { - "laravel/pint": "1.2.*", "php": ">=8.0.0" }, "require-dev": { - "phpunit/phpunit": "^9.3", - "squizlabs/php_codesniffer": "^3.6", - "vimeo/psalm": "4.0.1" + "laravel/pint": "1.13.*", + "phpstan/phpstan": "1.10.*", + "phpunit/phpunit": "9.6.*" }, "type": "library", "autoload": { @@ -2965,9 +2898,9 @@ ], "support": { "issues": "https://github.com/utopia-php/system/issues", - "source": "https://github.com/utopia-php/system/tree/0.7.1" + "source": "https://github.com/utopia-php/system/tree/0.7.2" }, - "time": "2023-08-30T09:14:37+00:00" + "time": "2023-10-20T01:39:17+00:00" }, { "name": "utopia-php/vcs", diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index 6591127592..b0cf28caeb 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -5,7 +5,6 @@ namespace Appwrite\Platform\Workers; use Appwrite\Template\Template; use Exception; use PHPMailer\PHPMailer\PHPMailer; -use Swoole\Runtime; use Utopia\App; use Utopia\CLI\Console; use Utopia\Platform\Action; @@ -40,7 +39,7 @@ class Mails extends Action */ public function action(Message $message, Registry $register): void { - Runtime::setHookFlags(SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_TCP); + $payload = $message->getPayload() ?? []; if (empty($payload)) { @@ -70,6 +69,7 @@ class Mails extends Action $mail = empty($smtp) ? $register->get('smtp') : $this->getMailer($smtp); + $mail->clearAddresses(); $mail->clearAllRecipients(); $mail->clearReplyTos(); From b9e5d0c890886e5528ee898e413adddb4b8c1e96 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 20 Oct 2023 16:59:07 +0400 Subject: [PATCH 8/9] feat: add swoole hooks --- src/Appwrite/Platform/Workers/Mails.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index b0cf28caeb..7a20212c9c 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Workers; use Appwrite\Template\Template; use Exception; use PHPMailer\PHPMailer\PHPMailer; +use Swoole\Runtime; use Utopia\App; use Utopia\CLI\Console; use Utopia\Platform\Action; @@ -39,7 +40,7 @@ class Mails extends Action */ public function action(Message $message, Registry $register): void { - + Runtime::setHookFlags(SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_TCP); $payload = $message->getPayload() ?? []; if (empty($payload)) { From f533ab9324706de3d16f5c0d925b23516f4abd1b Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 20 Oct 2023 17:00:45 +0400 Subject: [PATCH 9/9] feat: add swoole hooks --- composer.lock | 85 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 76 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index b691f894b4..288558bff6 100644 --- a/composer.lock +++ b/composer.lock @@ -851,6 +851,72 @@ }, "time": "2021-10-08T21:21:46+00:00" }, + { + "name": "laravel/pint", + "version": "v1.2.1", + "source": { + "type": "git", + "url": "https://github.com/laravel/pint.git", + "reference": "e60e2112ee779ce60f253695b273d1646a17d6f1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/pint/zipball/e60e2112ee779ce60f253695b273d1646a17d6f1", + "reference": "e60e2112ee779ce60f253695b273d1646a17d6f1", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "ext-tokenizer": "*", + "ext-xml": "*", + "php": "^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.11.0", + "illuminate/view": "^9.32.0", + "laravel-zero/framework": "^9.2.0", + "mockery/mockery": "^1.5.1", + "nunomaduro/larastan": "^2.2.0", + "nunomaduro/termwind": "^1.14.0", + "pestphp/pest": "^1.22.1" + }, + "bin": [ + "builds/pint" + ], + "type": "project", + "autoload": { + "psr-4": { + "App\\": "app/", + "Database\\Seeders\\": "database/seeders/", + "Database\\Factories\\": "database/factories/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "An opinionated code formatter for PHP.", + "homepage": "https://laravel.com", + "keywords": [ + "format", + "formatter", + "lint", + "linter", + "php" + ], + "support": { + "issues": "https://github.com/laravel/pint/issues", + "source": "https://github.com/laravel/pint" + }, + "time": "2022-11-29T16:25:20+00:00" + }, { "name": "league/csv", "version": "9.7.1", @@ -2848,25 +2914,26 @@ }, { "name": "utopia-php/system", - "version": "0.7.2", + "version": "0.7.1", "source": { "type": "git", "url": "https://github.com/utopia-php/system.git", - "reference": "4593d4d334b0c15879c4744a826e0362924c5d66" + "reference": "01bf0d283aded0ee0a7a6e5ff540acf64270ab27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/system/zipball/4593d4d334b0c15879c4744a826e0362924c5d66", - "reference": "4593d4d334b0c15879c4744a826e0362924c5d66", + "url": "https://api.github.com/repos/utopia-php/system/zipball/01bf0d283aded0ee0a7a6e5ff540acf64270ab27", + "reference": "01bf0d283aded0ee0a7a6e5ff540acf64270ab27", "shasum": "" }, "require": { + "laravel/pint": "1.2.*", "php": ">=8.0.0" }, "require-dev": { - "laravel/pint": "1.13.*", - "phpstan/phpstan": "1.10.*", - "phpunit/phpunit": "9.6.*" + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "^3.6", + "vimeo/psalm": "4.0.1" }, "type": "library", "autoload": { @@ -2898,9 +2965,9 @@ ], "support": { "issues": "https://github.com/utopia-php/system/issues", - "source": "https://github.com/utopia-php/system/tree/0.7.2" + "source": "https://github.com/utopia-php/system/tree/0.7.1" }, - "time": "2023-10-20T01:39:17+00:00" + "time": "2023-08-30T09:14:37+00:00" }, { "name": "utopia-php/vcs",