From 613065b0749e7807831eba1311d773f8f7b1d514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 12 Sep 2025 16:28:58 +0200 Subject: [PATCH] PR review changes --- .env | 2 +- app/config/collections/platform.php | 2 +- src/Appwrite/Event/Certificate.php | 14 +++---- .../Modules/Compute/{Base.php => Action.php} | 4 +- .../Functions/Http/Deployments/Create.php | 2 +- .../Functions/Http/Deployments/Delete.php | 2 +- .../Http/Deployments/Download/Get.php | 2 +- .../Http/Deployments/Duplicate/Create.php | 2 +- .../Functions/Http/Deployments/Get.php | 2 +- .../Http/Deployments/Status/Update.php | 2 +- .../Http/Deployments/Template/Create.php | 5 +-- .../Functions/Http/Deployments/Vcs/Create.php | 5 +-- .../Functions/Http/Deployments/XList.php | 5 +-- .../Functions/Http/Executions/Create.php | 5 +-- .../Functions/Http/Executions/Delete.php | 5 +-- .../Modules/Functions/Http/Executions/Get.php | 5 +-- .../Functions/Http/Executions/XList.php | 5 +-- .../Functions/Http/Functions/Create.php | 5 +-- .../Functions/Http/Functions/Delete.php | 5 +-- .../Http/Functions/Deployment/Update.php | 5 +-- .../Modules/Functions/Http/Functions/Get.php | 5 +-- .../Functions/Http/Functions/Update.php | 5 +-- .../Functions/Http/Functions/XList.php | 5 +-- .../Modules/Functions/Http/Runtimes/XList.php | 5 +-- .../Functions/Http/Specifications/XList.php | 5 +-- .../Modules/Functions/Http/Templates/Get.php | 5 +-- .../Functions/Http/Templates/XList.php | 5 +-- .../Modules/Functions/Http/Usage/Get.php | 5 +-- .../Modules/Functions/Http/Usage/XList.php | 5 +-- .../Functions/Http/Variables/Create.php | 5 +-- .../Functions/Http/Variables/Delete.php | 5 +-- .../Modules/Functions/Http/Variables/Get.php | 5 +-- .../Functions/Http/Variables/Update.php | 5 +-- .../Functions/Http/Variables/XList.php | 5 +-- .../Modules/Functions/Workers/Builds.php | 2 +- .../Platform/Modules/Projects/Module.php | 4 +- .../Modules/Proxy/{Base.php => Action.php} | 14 +++---- .../Modules/Proxy/Http/Rules/API/Create.php | 5 +-- .../Modules/Proxy/Http/Rules/Delete.php | 2 +- .../Proxy/Http/Rules/Function/Create.php | 5 +-- .../Platform/Modules/Proxy/Http/Rules/Get.php | 2 +- .../Proxy/Http/Rules/Redirect/Create.php | 5 +-- .../Modules/Proxy/Http/Rules/Site/Create.php | 5 +-- .../Proxy/Http/Rules/Verification/Update.php | 19 +++++---- .../Modules/Proxy/Http/Rules/XList.php | 2 +- .../Modules/Sites/Http/Deployments/Create.php | 2 +- .../Modules/Sites/Http/Deployments/Delete.php | 2 +- .../Sites/Http/Deployments/Download/Get.php | 2 +- .../Http/Deployments/Duplicate/Create.php | 2 +- .../Modules/Sites/Http/Deployments/Get.php | 2 +- .../Sites/Http/Deployments/Status/Update.php | 2 +- .../Http/Deployments/Template/Create.php | 5 +-- .../Sites/Http/Deployments/Vcs/Create.php | 5 +-- .../Modules/Sites/Http/Deployments/XList.php | 5 +-- .../Modules/Sites/Http/Frameworks/XList.php | 5 +-- .../Modules/Sites/Http/Logs/Delete.php | 5 +-- .../Platform/Modules/Sites/Http/Logs/Get.php | 5 +-- .../Modules/Sites/Http/Logs/XList.php | 5 +-- .../Modules/Sites/Http/Sites/Create.php | 5 +-- .../Modules/Sites/Http/Sites/Delete.php | 5 +-- .../Sites/Http/Sites/Deployment/Update.php | 5 +-- .../Platform/Modules/Sites/Http/Sites/Get.php | 5 +-- .../Modules/Sites/Http/Sites/Update.php | 5 +-- .../Modules/Sites/Http/Sites/XList.php | 5 +-- .../Sites/Http/Specifications/XList.php | 5 +-- .../Modules/Sites/Http/Templates/Get.php | 5 +-- .../Modules/Sites/Http/Templates/XList.php | 5 +-- .../Platform/Modules/Sites/Http/Usage/Get.php | 5 +-- .../Modules/Sites/Http/Usage/XList.php | 5 +-- .../Modules/Sites/Http/Variables/Create.php | 5 +-- .../Modules/Sites/Http/Variables/Delete.php | 5 +-- .../Modules/Sites/Http/Variables/Get.php | 5 +-- .../Modules/Sites/Http/Variables/Update.php | 5 +-- .../Modules/Sites/Http/Variables/XList.php | 5 +-- src/Appwrite/Platform/Tasks/Maintenance.php | 3 +- .../Platform/Workers/Certificates.php | 42 ++++++++++--------- 76 files changed, 172 insertions(+), 219 deletions(-) rename src/Appwrite/Platform/Modules/Compute/{Base.php => Action.php} (99%) rename src/Appwrite/Platform/Modules/Proxy/{Base.php => Action.php} (92%) diff --git a/.env b/.env index 666e1bb92e..bb21aa50f2 100644 --- a/.env +++ b/.env @@ -26,7 +26,7 @@ _APP_DOMAIN=traefik _APP_CONSOLE_DOMAIN=localhost _APP_DOMAIN_FUNCTIONS=functions.localhost _APP_DOMAIN_SITES=sites.localhost -_APP_DOMAIN_TARGET_CNAME=test.appwrite.org +_APP_DOMAIN_TARGET_CNAME=test.l _APP_DOMAIN_TARGET_A=127.0.0.1 _APP_DOMAIN_TARGET_AAAA=::1 _APP_DOMAIN_TARGET_CAA=digicert.com diff --git a/app/config/collections/platform.php b/app/config/collections/platform.php index 6cfc0a7a79..5a9d8017ac 100644 --- a/app/config/collections/platform.php +++ b/app/config/collections/platform.php @@ -1189,7 +1189,7 @@ return [ '$id' => ID::custom('verificationLogs'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 2048, + 'size' => 65535, 'signed' => true, 'required' => false, 'default' => '', diff --git a/src/Appwrite/Event/Certificate.php b/src/Appwrite/Event/Certificate.php index d323d1b970..1d320dd1e4 100644 --- a/src/Appwrite/Event/Certificate.php +++ b/src/Appwrite/Event/Certificate.php @@ -13,7 +13,7 @@ class Certificate extends Event protected bool $skipRenewCheck = false; protected ?Document $domain = null; protected ?string $verificationDomainFunction = null; // For example: fra.cloud.appwrite.io - protected ?string $verificationDomainApi = null; // For example: fra.appwrite.run + protected ?string $verificationDomainAPI = null; // For example: fra.appwrite.run protected string $action = self::ACTION_GENERATION; public function __construct(protected Publisher $publisher) @@ -88,12 +88,12 @@ class Certificate extends Event /** * Set verification domain api. * - * @param ?string $verificationDomainApi + * @param ?string $verificationDomainAPI * @return self */ - public function setVerificationDomainApi(?string $verificationDomainApi): self + public function setVerificationDomainAPI(?string $verificationDomainAPI): self { - $this->verificationDomainApi = $verificationDomainApi; + $this->verificationDomainAPI = $verificationDomainAPI; return $this; } @@ -103,9 +103,9 @@ class Certificate extends Event * * @return ?string */ - public function getVerificationDomainApi(): ?string + public function getVerificationDomainAPI(): ?string { - return $this->verificationDomainApi; + return $this->verificationDomainAPI; } /** @@ -153,7 +153,7 @@ class Certificate extends Event 'domain' => $this->domain, 'skipRenewCheck' => $this->skipRenewCheck, 'verificationDomainFunction' => $this->verificationDomainFunction, - 'verificationDomainApi' => $this->verificationDomainApi, + 'verificationDomainAPI' => $this->verificationDomainAPI, 'action' => $this->action ]; } diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Action.php similarity index 99% rename from src/Appwrite/Platform/Modules/Compute/Base.php rename to src/Appwrite/Platform/Modules/Compute/Action.php index 92805fbaf8..5c9208ec24 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Action.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Modules\Compute; use Appwrite\Event\Build; use Appwrite\Extend\Exception; -use Appwrite\Platform\Action; +use Appwrite\Platform\Action as PlatformAction; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Duplicate; @@ -17,7 +17,7 @@ use Utopia\System\System; use Utopia\VCS\Adapter\Git\GitHub; use Utopia\VCS\Exception\RepositoryNotFound; -class Base extends Action +class Action extends PlatformAction { public function redeployVcsFunction(Request $request, Document $function, Document $project, Document $installation, Database $dbForProject, Build $queueForBuilds, Document $template, GitHub $github, bool $activate, string $referenceType = 'branch', string $reference = ''): Document { diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php index f64a960507..a4bfb0622d 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Deployments; use Appwrite\Event\Build; use Appwrite\Event\Event; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -18,7 +19,6 @@ use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Query; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; use Utopia\Storage\Validator\File; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php index 9e314d05c6..e3c14069c9 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Deployments; use Appwrite\Event\Delete as DeleteEvent; use Appwrite\Event\Event; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -14,7 +15,6 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index fd22248fa3..734ec59400 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Deployments\Download; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -11,7 +12,6 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; use Utopia\Swoole\Request; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php index e2d49ecb8b..eb5c84e1e4 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Deployments\Duplicate; use Appwrite\Event\Build; use Appwrite\Event\Event; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -12,7 +13,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php index a79da7f908..b41542ec8d 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php @@ -3,13 +3,13 @@ namespace Appwrite\Platform\Modules\Functions\Http\Deployments; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; class Get extends Action diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php index e6b45b27de..c59943ca31 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php @@ -4,6 +4,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Deployments\Status; use Appwrite\Event\Event; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -13,7 +14,6 @@ use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; class Update extends Action diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php index 4d93c8e8cd..25715726f9 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Deployments\Template; use Appwrite\Event\Build; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -16,14 +16,13 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Swoole\Request; use Utopia\Validator\Boolean; use Utopia\Validator\Text; use Utopia\VCS\Adapter\Git\GitHub; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php index 0ad9852722..1262ec9e8d 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Deployments\Vcs; use Appwrite\Event\Build; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -13,7 +13,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Swoole\Request; use Utopia\Validator\Boolean; @@ -21,7 +20,7 @@ use Utopia\Validator\Text; use Utopia\Validator\WhiteList; use Utopia\VCS\Adapter\Git\GitHub; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php index 2850c5b279..ad1f43739e 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Deployments; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -17,11 +17,10 @@ use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Query; use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Text; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index 1603e8f997..d48c72bc72 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -10,7 +10,7 @@ use Appwrite\Event\StatsUsage; use Appwrite\Extend\Exception; use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Functions\Validator\Headers; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\Platform\Tasks\ScheduleExecutions; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; @@ -30,7 +30,6 @@ use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Datetime as DatetimeValidator; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Swoole\Request; use Utopia\System\System; @@ -40,7 +39,7 @@ use Utopia\Validator\Boolean; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php index 9c818cfacc..d4fb2ef5c4 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Executions; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\Platform\Tasks\ScheduleExecutions; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; @@ -16,10 +16,9 @@ use Utopia\Database\DateTime; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Delete extends Base +class Delete extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php index 42d78f8ca8..5f949b4837 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Executions; use Appwrite\Auth\Auth; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -12,10 +12,9 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Get extends Base +class Get extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php index 46a41e6517..38ef45b417 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Executions; use Appwrite\Auth\Auth; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -18,10 +18,9 @@ use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php index 21a74f9a81..cfb291bf8c 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -9,7 +9,7 @@ use Appwrite\Event\Realtime; use Appwrite\Event\Validator\FunctionEvent; use Appwrite\Event\Webhook; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\Platform\Modules\Compute\Validator\Specification; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; @@ -28,7 +28,6 @@ use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Roles; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Request; use Utopia\System\System; @@ -39,7 +38,7 @@ use Utopia\Validator\Text; use Utopia\Validator\WhiteList; use Utopia\VCS\Adapter\Git\GitHub; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php index 72d5589252..91c8af5f48 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Functions; use Appwrite\Event\Delete as DeleteEvent; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -15,10 +15,9 @@ use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Delete extends Base +class Delete extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php index 8846329d27..973393034c 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Functions\Deployment; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -15,10 +15,9 @@ use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Update extends Base +class Update extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php index e8da162b8a..6b3919dac2 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php @@ -3,17 +3,16 @@ namespace Appwrite\Platform\Modules\Functions\Http\Functions; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Get extends Base +class Get extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index aaff953af0..035e753b72 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -6,7 +6,7 @@ use Appwrite\Event\Build; use Appwrite\Event\Event; use Appwrite\Event\Validator\FunctionEvent; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\Platform\Modules\Compute\Validator\Specification; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; @@ -25,7 +25,6 @@ use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Roles; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Swoole\Request; use Utopia\System\System; @@ -37,7 +36,7 @@ use Utopia\Validator\Text; use Utopia\Validator\WhiteList; use Utopia\VCS\Adapter\Git\GitHub; -class Update extends Base +class Update extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php index 4b03a5b6cc..8ffdf6eba4 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Functions; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -15,11 +15,10 @@ use Utopia\Database\Exception\Order as OrderException; use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Query; use Utopia\Database\Validator\Query\Cursor; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Text; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php index 0690d1a139..9db7e5c131 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php @@ -2,18 +2,17 @@ namespace Appwrite\Platform\Modules\Functions\Http\Runtimes; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Config\Config; use Utopia\Database\Document; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php index d76584534d..1efab5bbcc 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php @@ -2,18 +2,17 @@ namespace Appwrite\Platform\Modules\Functions\Http\Specifications; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Config\Config; use Utopia\Database\Document; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php index f66322839b..65a5e6e6cc 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php @@ -3,18 +3,17 @@ namespace Appwrite\Platform\Modules\Functions\Http\Templates; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Config\Config; use Utopia\Database\Document; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Text; -class Get extends Base +class Get extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php index 86e7f21362..a8f63b510d 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php @@ -2,20 +2,19 @@ namespace Appwrite\Platform\Modules\Functions\Http\Templates; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Config\Config; use Utopia\Database\Document; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\ArrayList; use Utopia\Validator\Range; use Utopia\Validator\WhiteList; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php index acb6995d6f..bc4c6edb18 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Usage; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -14,11 +14,10 @@ use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\WhiteList; -class Get extends Base +class Get extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php index 6a4ded4db7..8dc746a940 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php @@ -2,7 +2,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Usage; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -12,11 +12,10 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\WhiteList; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php index 815d364dad..98f82cf6e3 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Variables; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -17,12 +17,11 @@ use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; use Utopia\Validator\Text; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php index 35f9618edb..fc5644e36c 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Variables; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -13,10 +13,9 @@ use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Delete extends Base +class Delete extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php index 3955b854e9..48663bbc51 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php @@ -3,17 +3,16 @@ namespace Appwrite\Platform\Modules\Functions\Http\Variables; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Get extends Base +class Get extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php index 639b1c74d5..48c865091b 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Variables; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -13,12 +13,11 @@ use Utopia\Database\DateTime; use Utopia\Database\Exception\Duplicate as DuplicateException; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; use Utopia\Validator\Text; -class Update extends Base +class Update extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php index 29465b7572..fcdb8af67d 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Functions\Http\Variables; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -11,10 +11,9 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 9547a752ef..44b21a9457 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -9,6 +9,7 @@ use Appwrite\Event\Realtime; use Appwrite\Event\StatsUsage; use Appwrite\Event\Webhook; use Appwrite\Permission; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\Role; use Appwrite\Utopia\Response\Model\Deployment; use Appwrite\Vcs\Comment; @@ -33,7 +34,6 @@ use Utopia\Detector\Detection\Rendering\XStatic; use Utopia\Detector\Detector\Rendering; use Utopia\Fetch\Client as FetchClient; use Utopia\Logger\Log; -use Utopia\Platform\Action; use Utopia\Queue\Message; use Utopia\Storage\Compression\Compression; use Utopia\Storage\Device; diff --git a/src/Appwrite/Platform/Modules/Projects/Module.php b/src/Appwrite/Platform/Modules/Projects/Module.php index 2a550acf54..424353ad1b 100644 --- a/src/Appwrite/Platform/Modules/Projects/Module.php +++ b/src/Appwrite/Platform/Modules/Projects/Module.php @@ -3,9 +3,9 @@ namespace Appwrite\Platform\Modules\Projects; use Appwrite\Platform\Modules\Projects\Services\Http; -use Utopia\Platform\Module as Base; +use Utopia\Platform\Module as PlatformModule; -class Module extends Base +class Module extends PlatformModule { public function __construct() { diff --git a/src/Appwrite/Platform/Modules/Proxy/Base.php b/src/Appwrite/Platform/Modules/Proxy/Action.php similarity index 92% rename from src/Appwrite/Platform/Modules/Proxy/Base.php rename to src/Appwrite/Platform/Modules/Proxy/Action.php index b1ee896c2e..93e4ea5292 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Base.php +++ b/src/Appwrite/Platform/Modules/Proxy/Action.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Modules\Proxy; use Appwrite\Extend\Exception; use Appwrite\Network\Validator\DNS; -use Appwrite\Platform\Action; +use Appwrite\Platform\Action as PlatformAction; use Utopia\Database\Document; use Utopia\Domains\Domain; use Utopia\Logger\Log; @@ -12,18 +12,18 @@ use Utopia\System\System; use Utopia\Validator\AnyOf; use Utopia\Validator\IP; -class Base extends Action +class Action extends PlatformAction { /** * Verify or re-verify a rule * * @param Document $rule Rule to verify * @param Log|null $log Log instance to add timings to - * @param string|null $verificationDomainApi Override for expected API rule value during verification + * @param string|null $verificationDomainAPI Override for expected API rule value during verification * @param string|null $verificationDomainFunction Override for expected Function rule value during verification * @return void */ - public static function verifyRule(Document $rule, ?Log $log = null, ?string $verificationDomainApi = null, ?string $verificationDomainFunction = null): void + public static function verifyRule(Document $rule, ?Log $log = null, ?string $verificationDomainAPI = null, ?string $verificationDomainFunction = null): void { $domain = new Domain($rule->getAttribute('domain', '')); @@ -46,8 +46,8 @@ class Base extends Action // Ensure at least one of CNAME/A/AAAA record points to our servers properly // Ensures different target based on rule's type, as configured by env variables - if (\is_null($verificationDomainApi)) { - $verificationDomainApi = System::getEnv('_APP_DOMAIN_TARGET_CNAME', ''); + if (\is_null($verificationDomainAPI)) { + $verificationDomainAPI = System::getEnv('_APP_DOMAIN_TARGET_CNAME', ''); } if (\is_null($verificationDomainFunction)) { $verificationDomainFunction = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); @@ -65,7 +65,7 @@ class Base extends Action $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_SITES', '')); } elseif ($ruleType === 'api') { // For example: fra.cloud.appwrite.io - $targetCNAME = new Domain($verificationDomainApi); + $targetCNAME = new Domain($verificationDomainAPI); } elseif ($ruleType === 'redirect') { // Shouldn't be needed, because redirect should always have resourceTyp too, but just in case we defailt to sites // For example: appwrite.network diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php index 69645bb6fb..87c0ca3a02 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\API; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Proxy\Base; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -16,12 +16,11 @@ use Utopia\Database\Exception\Duplicate; use Utopia\Database\Helpers\ID; use Utopia\Domains\Domain; use Utopia\Logger\Log; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; use Utopia\Validator\Domain as ValidatorDomain; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Delete.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Delete.php index 5d76cc161e..51821ad49f 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Delete.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Delete.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules; use Appwrite\Event\Delete as DeleteEvent; use Appwrite\Event\Event; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -13,7 +14,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; class Delete extends Action diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php index c209f4474d..c0e0388692 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Function; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Proxy\Base; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -17,13 +17,12 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\UID; use Utopia\Domains\Domain; use Utopia\Logger\Log; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; use Utopia\Validator\Domain as ValidatorDomain; use Utopia\Validator\Text; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Get.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Get.php index d8d64613c8..70d27328a7 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Get.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Get.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -10,7 +11,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; class Get extends Action diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php index 4a343eab4e..3d9a566d2b 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Redirect; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Proxy\Base; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -17,14 +17,13 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\UID; use Utopia\Domains\Domain; use Utopia\Logger\Log; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; use Utopia\Validator\Domain as ValidatorDomain; use Utopia\Validator\URL; use Utopia\Validator\WhiteList; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php index 3d8940154b..f390254380 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Site; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Proxy\Base; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -17,13 +17,12 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\UID; use Utopia\Domains\Domain; use Utopia\Logger\Log; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; use Utopia\Validator\Domain as ValidatorDomain; use Utopia\Validator\Text; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Verification/Update.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Verification/Update.php index 362b16812e..2898595038 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Verification/Update.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Verification/Update.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Verification; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Proxy\Base; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -13,12 +13,10 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\UID; -use Utopia\Domains\Domain; use Utopia\Logger\Log; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Update extends Base +class Update extends Action { use HTTP; @@ -82,18 +80,21 @@ class Update extends Base return $response->dynamic($rule, Response::MODEL_PROXY_RULE); } + $updates = new Document(); + try { self::verifyRule($rule, $log); - $rule = $rule->setAttribute('verificationLogs', ''); + $updates->setAttribute('verificationLogs', ''); } catch (Exception $err) { - $rule = $rule->setAttribute('verificationLogs', $err->getMessage()); - $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + $dbForPlatform->updateDocument('rules', $rule->getId(), new Document([ + 'verificationLogs' => $err->getMessage(), + ])); throw $err; } - $rule = $rule->setAttribute('status', 'verifying'); + $updates->setAttribute('status', 'verifying'); - $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + $dbForPlatform->updateDocument('rules', $rule->getId(), $updates); // Issue a TLS certificate when domain is verified $queueForCertificates diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/XList.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/XList.php index c6bcd6dcb8..bef7b31881 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/XList.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/XList.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Modules\Proxy\Http\Rules; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -13,7 +14,6 @@ use Utopia\Database\Document; use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Query; use Utopia\Database\Validator\Query\Cursor; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php index 65a0fcf143..02ae493433 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Deployments; use Appwrite\Event\Build; use Appwrite\Event\Event; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -19,7 +20,6 @@ use Utopia\Database\Helpers\Role; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; use Utopia\Storage\Validator\File; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php index dfc0f0c976..45bffee05e 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Deployments; use Appwrite\Event\Delete as DeleteEvent; use Appwrite\Event\Event; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -14,7 +15,6 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index 5a87ce453f..d211ee084b 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Deployments\Download; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -11,7 +12,6 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; use Utopia\Swoole\Request; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php index 065dd13e88..638664673b 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Deployments\Duplicate; use Appwrite\Event\Build; use Appwrite\Event\Event; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -14,7 +15,6 @@ use Utopia\Database\Document; use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; use Utopia\Swoole\Request; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php index d583c62fb1..3e599ae448 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php @@ -3,13 +3,13 @@ namespace Appwrite\Platform\Modules\Sites\Http\Deployments; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; class Get extends Action diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php index a447e54f8d..a96ec26d91 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php @@ -4,6 +4,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Deployments\Status; use Appwrite\Event\Event; use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -13,7 +14,6 @@ use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; class Update extends Action diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php index a2040d830b..aef19eebf7 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Deployments\Template; use Appwrite\Event\Build; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -17,7 +17,6 @@ use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Swoole\Request; use Utopia\System\System; @@ -25,7 +24,7 @@ use Utopia\Validator\Boolean; use Utopia\Validator\Text; use Utopia\VCS\Adapter\Git\GitHub; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php index ddad5d793a..63e08e7083 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Deployments\Vcs; use Appwrite\Event\Build; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -13,7 +13,6 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Swoole\Request; use Utopia\Validator\Boolean; @@ -21,7 +20,7 @@ use Utopia\Validator\Text; use Utopia\Validator\WhiteList; use Utopia\VCS\Adapter\Git\GitHub; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php index 436cd69b52..42e1146105 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Deployments; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -17,11 +17,10 @@ use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Query; use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Text; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php index a042fd6e7c..8378e64f10 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php @@ -2,17 +2,16 @@ namespace Appwrite\Platform\Modules\Sites\Http\Frameworks; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Config\Config; use Utopia\Database\Document; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php index 0f53985039..7434735f24 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php @@ -4,17 +4,16 @@ namespace Appwrite\Platform\Modules\Sites\Http\Logs; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Delete extends Base +class Delete extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php index 935e790113..46145d5686 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php @@ -3,17 +3,16 @@ namespace Appwrite\Platform\Modules\Sites\Http\Logs; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Get extends Base +class Get extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php index f9bee3e425..fa0f430946 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Logs; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -17,10 +17,9 @@ use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Query; use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php index 9be95441cb..3837492232 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Sites; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\Platform\Modules\Compute\Validator\Specification; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; @@ -17,7 +17,6 @@ use Utopia\Database\Document; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; use Utopia\Validator\Boolean; @@ -25,7 +24,7 @@ use Utopia\Validator\Range; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php index ed9b059c33..8b8619159e 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Sites; use Appwrite\Event\Delete as DeleteEvent; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -13,10 +13,9 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Delete extends Base +class Delete extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php index bb6bd4f632..8c8fafc06e 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Sites\Deployment; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -14,10 +14,9 @@ use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Update extends Base +class Update extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php index d86d98ef71..6ead56bff5 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php @@ -3,17 +3,16 @@ namespace Appwrite\Platform\Modules\Sites\Http\Sites; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Get extends Base +class Get extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 80354d5067..22e1cc3447 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Sites; use Appwrite\Event\Build; use Appwrite\Event\Event; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\Platform\Modules\Compute\Validator\Specification; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; @@ -20,7 +20,6 @@ use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Query; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Swoole\Request; use Utopia\System\System; @@ -30,7 +29,7 @@ use Utopia\Validator\Text; use Utopia\Validator\WhiteList; use Utopia\VCS\Adapter\Git\GitHub; -class Update extends Base +class Update extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php index 988a2d2e20..32f853fff0 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Sites; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -15,11 +15,10 @@ use Utopia\Database\Exception\Order as OrderException; use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Query; use Utopia\Database\Validator\Query\Cursor; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Text; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php index 4bda37df73..e81caa4a89 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php @@ -2,18 +2,17 @@ namespace Appwrite\Platform\Modules\Sites\Http\Specifications; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Config\Config; use Utopia\Database\Document; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\System\System; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php index 633ef31e68..e5198d8d54 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php @@ -3,18 +3,17 @@ namespace Appwrite\Platform\Modules\Sites\Http\Templates; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Config\Config; use Utopia\Database\Document; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Text; -class Get extends Base +class Get extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php index 4fe00f3edf..9ed5d62286 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php @@ -2,20 +2,19 @@ namespace Appwrite\Platform\Modules\Sites\Http\Templates; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Config\Config; use Utopia\Database\Document; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\ArrayList; use Utopia\Validator\Range; use Utopia\Validator\WhiteList; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php index af96c10457..e2a4278eb6 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Usage; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -14,11 +14,10 @@ use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\WhiteList; -class Get extends Base +class Get extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php index d36cc56ae5..f4f8453996 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php @@ -2,7 +2,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Usage; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -12,11 +12,10 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\WhiteList; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php index ef504fe663..db683e3be5 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Variables; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -15,12 +15,11 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; use Utopia\Validator\Text; -class Create extends Base +class Create extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php index be0addb34c..8aa4eb5c19 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Variables; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; @@ -11,10 +11,9 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Delete extends Base +class Delete extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php index 11eb546092..4190616a2d 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php @@ -3,17 +3,16 @@ namespace Appwrite\Platform\Modules\Sites\Http\Variables; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class Get extends Base +class Get extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php index 3cf2e2f85f..363a59cd77 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Variables; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -11,12 +11,11 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Exception\Duplicate as DuplicateException; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Validator\Boolean; use Utopia\Validator\Text; -class Update extends Base +class Update extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php index 51ab355c75..bc89c17f7d 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Modules\Sites\Http\Variables; use Appwrite\Extend\Exception; -use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -11,10 +11,9 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\UID; -use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -class XList extends Base +class XList extends Action { use HTTP; diff --git a/src/Appwrite/Platform/Tasks/Maintenance.php b/src/Appwrite/Platform/Tasks/Maintenance.php index bc3763dcd7..df3c787eae 100644 --- a/src/Appwrite/Platform/Tasks/Maintenance.php +++ b/src/Appwrite/Platform/Tasks/Maintenance.php @@ -120,8 +120,7 @@ class Maintenance extends Action { $time = DatabaseDateTime::now(); - $oldestToCheck = new DateTime(); - $oldestToCheck->sub(new DateInterval('PT72H')); // -3 days + $oldestToCheck = new DateTime('-3 days'); $rules = $dbForPlatform->find('rules', [ Query::createdAfter(DatabaseDateTime::format($oldestToCheck)), // max 3 days old diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 0e78fd82e3..05a6578f6e 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -10,7 +10,7 @@ use Appwrite\Event\Mail; use Appwrite\Event\Realtime; use Appwrite\Event\Webhook; use Appwrite\Extend\Exception as ExtendException; -use Appwrite\Platform\Modules\Proxy\Base; +use Appwrite\Platform\Modules\Proxy\Action; use Appwrite\Template\Template; use Appwrite\Utopia\Response\Model\Rule; use Exception; @@ -28,7 +28,6 @@ use Utopia\Database\Validator\Authorization as ValidatorAuthorization; use Utopia\Domains\Domain; use Utopia\Locale\Locale; use Utopia\Logger\Log; -use Utopia\Platform\Action; use Utopia\Queue\Message; use Utopia\System\System; @@ -100,7 +99,7 @@ class Certificates extends Action $skipRenewCheck = $payload['skipRenewCheck'] ?? false; $action = $payload['action'] ?? Certificate::ACTION_GENERATION; $verificationDomainFunction = $payload['verificationDomainFunction'] ?? null; - $verificationDomainApi = $payload['verificationDomainApi'] ?? null; + $verificationDomainAPI = $payload['verificationDomainAPI'] ?? null; Console::log('Recieved ' . $action . ' action for ' . $domain->get() . ' domain'); @@ -108,10 +107,10 @@ class Certificates extends Action switch ($action) { case Certificate::ACTION_GENERATION: - $this->executeGeneration($domain, $domainType, $dbForPlatform, $queueForMails, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $log, $certificates, $skipRenewCheck, $plan, $verificationDomainFunction, $verificationDomainApi); + $this->executeGeneration($domain, $domainType, $dbForPlatform, $queueForMails, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $log, $certificates, $skipRenewCheck, $plan, $verificationDomainFunction, $verificationDomainAPI); break; case Certificate::ACTION_VERIFICATION: - $this->executeVerification($domain, $dbForPlatform, $log, $queueForCertificates, $verificationDomainFunction, $verificationDomainApi); + $this->executeVerification($domain, $dbForPlatform, $log, $queueForCertificates, $verificationDomainFunction, $verificationDomainAPI); break; default: throw new Exception('Invalid action . ' . $action); @@ -129,7 +128,7 @@ class Certificates extends Action Log $log, Certificate $queueForCertificates, ?string $verificationDomainFunction = null, - ?string $verificationDomainApi = null, + ?string $verificationDomainAPI = null, ): void { // Get rule if (System::getEnv('_APP_RULES_FORMAT') === 'md5') { @@ -164,10 +163,11 @@ class Certificates extends Action } // Verify DNS records + $updates = new Document(); $success = false; try { - $this->validateDomain($rule, $isMainDomain, $log, $verificationDomainApi, $verificationDomainFunction); - $rule = $rule + $this->validateDomain($rule, $isMainDomain, $log, $verificationDomainAPI, $verificationDomainFunction); + $updates ->setAttribute('verificationLogs', '') ->setAttribute('status', 'verifying'); @@ -175,10 +175,10 @@ class Certificates extends Action $success = true; } catch (ExtendException $err) { Console::warning('Verification failed: ' . $err->getMessage()); - $rule = $rule->setAttribute('verificationLogs', $err->getMessage()); + $updates->setAttribute('verificationLogs', $err->getMessage()); } - $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + $dbForPlatform->updateDocument('rules', $rule->getId(), $updates); // Issue a TLS certificate when domain is verified if ($success) { @@ -205,7 +205,7 @@ class Certificates extends Action * @param bool $skipRenewCheck * @param array $plan * @param ?string $verificationDomainFunction - * @param ?string $verificationDomainApi + * @param ?string $verificationDomainAPI * @return void * @throws Throwable * @throws \Utopia\Database\Exception @@ -224,7 +224,7 @@ class Certificates extends Action bool $skipRenewCheck = false, array $plan = [], ?string $verificationDomainFunction = null, - ?string $verificationDomainApi = null + ?string $verificationDomainAPI = null ): void { /** * 1. Read arguments and validate domain @@ -309,7 +309,7 @@ class Certificates extends Action ]); } - $this->validateDomain($rule, $isMainDomain, $log, $verificationDomainApi, $verificationDomainFunction); + $this->validateDomain($rule, $isMainDomain, $log, $verificationDomainAPI, $verificationDomainFunction); // If certificate exists already, double-check expiry date. Skip if job is forced if (!$certificates->isRenewRequired($domain->get(), $domainType, $log)) { @@ -414,16 +414,16 @@ class Certificates extends Action * * @param Document $rule Rule which we validate * @param bool $isMainDomain In case of master domain, we look for different DNS configurations - * @param string|null $verificationDomainApi Function to verify domain + * @param string|null $verificationDomainAPI Function to verify domain * @param string|null $verificationDomainFunction Function to verify domain * * @return void * @throws Exception */ - private function validateDomain(Document $rule, bool $isMainDomain, Log $log, ?string $verificationDomainApi = null, ?string $verificationDomainFunction = null): void + private function validateDomain(Document $rule, bool $isMainDomain, Log $log, ?string $verificationDomainAPI = null, ?string $verificationDomainFunction = null): void { if (!$isMainDomain) { - Base::verifyRule($rule, $log, $verificationDomainApi, $verificationDomainFunction); + Base::verifyRule($rule, $log, $verificationDomainAPI, $verificationDomainFunction); } else { // Main domain validation // TODO: Would be awesome to check A/AAAA record here. Maybe dry run? @@ -516,9 +516,13 @@ class Certificates extends Action } if (!$rule->isEmpty()) { - $rule->setAttribute('certificateId', $certificateId); - $rule->setAttribute('status', $success ? 'verified' : 'unverified'); - $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + $updates = new Document(); + + $updates + ->setAttribute('certificateId', $certificateId) + ->setAttribute('status', $success ? 'verified' : 'unverified'); + + $dbForPlatform->updateDocument('rules', $rule->getId(), $updates); $projectId = $rule->getAttribute('projectId');