From 6530d31e7a00c88ec57bb4992017d5636cbba9b2 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Wed, 4 Jun 2025 14:07:43 +0530 Subject: [PATCH 01/20] Use ->action(...)) --- src/Appwrite/Platform/Modules/Console/Http/Resources/Get.php | 2 +- .../Platform/Modules/Functions/Http/Deployments/Create.php | 2 +- .../Platform/Modules/Functions/Http/Deployments/Delete.php | 2 +- .../Modules/Functions/Http/Deployments/Download/Get.php | 2 +- .../Modules/Functions/Http/Deployments/Duplicate/Create.php | 2 +- .../Platform/Modules/Functions/Http/Deployments/Get.php | 2 +- .../Modules/Functions/Http/Deployments/Status/Update.php | 2 +- .../Modules/Functions/Http/Deployments/Template/Create.php | 2 +- .../Platform/Modules/Functions/Http/Deployments/Vcs/Create.php | 2 +- .../Platform/Modules/Functions/Http/Deployments/XList.php | 2 +- .../Platform/Modules/Functions/Http/Executions/Create.php | 2 +- .../Platform/Modules/Functions/Http/Executions/Delete.php | 2 +- src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php | 2 +- .../Platform/Modules/Functions/Http/Executions/XList.php | 2 +- .../Platform/Modules/Functions/Http/Functions/Create.php | 2 +- .../Platform/Modules/Functions/Http/Functions/Delete.php | 2 +- .../Modules/Functions/Http/Functions/Deployment/Update.php | 2 +- src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php | 2 +- .../Platform/Modules/Functions/Http/Functions/Update.php | 2 +- .../Platform/Modules/Functions/Http/Functions/XList.php | 2 +- src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php | 2 +- .../Platform/Modules/Functions/Http/Specifications/XList.php | 2 +- src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php | 2 +- .../Platform/Modules/Functions/Http/Templates/XList.php | 2 +- src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php | 2 +- src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php | 2 +- .../Platform/Modules/Functions/Http/Variables/Create.php | 2 +- .../Platform/Modules/Functions/Http/Variables/Delete.php | 2 +- src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php | 2 +- .../Platform/Modules/Functions/Http/Variables/Update.php | 2 +- .../Platform/Modules/Functions/Http/Variables/XList.php | 2 +- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php | 2 +- src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Create.php | 2 +- src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php | 2 +- src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php | 2 +- src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php | 2 +- src/Appwrite/Platform/Modules/Projects/Http/DevKeys/XList.php | 2 +- src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php | 2 +- .../Platform/Modules/Proxy/Http/Rules/Function/Create.php | 2 +- .../Platform/Modules/Proxy/Http/Rules/Redirect/Create.php | 2 +- src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php | 2 +- .../Platform/Modules/Sites/Http/Deployments/Download/Get.php | 2 +- .../Modules/Sites/Http/Deployments/Duplicate/Create.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php | 2 +- .../Platform/Modules/Sites/Http/Deployments/Status/Update.php | 2 +- .../Platform/Modules/Sites/Http/Deployments/Template/Create.php | 2 +- .../Platform/Modules/Sites/Http/Deployments/Vcs/Create.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php | 2 +- .../Platform/Modules/Sites/Http/Sites/Deployment/Update.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php | 2 +- .../Platform/Modules/Sites/Http/Specifications/XList.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php | 2 +- src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php | 2 +- .../Modules/Tokens/Http/Tokens/Buckets/Files/Create.php | 2 +- .../Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.php | 2 +- src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php | 2 +- src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Get.php | 2 +- src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php | 2 +- src/Appwrite/Platform/Tasks/Doctor.php | 2 +- src/Appwrite/Platform/Tasks/Install.php | 2 +- src/Appwrite/Platform/Tasks/Maintenance.php | 2 +- src/Appwrite/Platform/Tasks/QueueRetry.php | 2 +- src/Appwrite/Platform/Tasks/SDKs.php | 2 +- src/Appwrite/Platform/Tasks/SSL.php | 2 +- src/Appwrite/Platform/Tasks/Screenshot.php | 2 +- src/Appwrite/Platform/Tasks/StatsResources.php | 2 +- src/Appwrite/Platform/Tasks/Upgrade.php | 2 +- src/Appwrite/Platform/Tasks/Vars.php | 2 +- src/Appwrite/Platform/Workers/Audits.php | 2 +- src/Appwrite/Platform/Workers/Databases.php | 2 +- src/Appwrite/Platform/Workers/Functions.php | 2 +- src/Appwrite/Platform/Workers/Mails.php | 2 +- src/Appwrite/Platform/Workers/Messaging.php | 2 +- src/Appwrite/Platform/Workers/Migrations.php | 2 +- src/Appwrite/Platform/Workers/StatsResources.php | 2 +- src/Appwrite/Platform/Workers/StatsUsage.php | 2 +- src/Appwrite/Platform/Workers/StatsUsageDump.php | 2 +- src/Appwrite/Platform/Workers/Webhooks.php | 2 +- 95 files changed, 95 insertions(+), 95 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Console/Http/Resources/Get.php b/src/Appwrite/Platform/Modules/Console/Http/Resources/Get.php index 16a94dc00c..114a24ef22 100644 --- a/src/Appwrite/Platform/Modules/Console/Http/Resources/Get.php +++ b/src/Appwrite/Platform/Modules/Console/Http/Resources/Get.php @@ -57,7 +57,7 @@ class Get extends Action ->param('type', '', new WhiteList(['rules']), 'Resource type.') ->inject('response') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php index 1f3febbfef..202f98924d 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php @@ -87,7 +87,7 @@ class Create extends Action ->inject('deviceForLocal') ->inject('queueForBuilds') ->inject('plan') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php index 84878055d8..0e51141b65 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php @@ -62,7 +62,7 @@ class Delete extends Action ->inject('queueForDeletes') ->inject('queueForEvents') ->inject('deviceForFunctions') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( 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 9456ff13a6..9c338d571a 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -61,7 +61,7 @@ class Get extends Action ->inject('dbForProject') ->inject('deviceForFunctions') ->inject('deviceForBuilds') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( 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 8f739dd37f..ebbf8e6b8c 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php @@ -62,7 +62,7 @@ class Create extends Action ->inject('queueForEvents') ->inject('queueForBuilds') ->inject('deviceForFunctions') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php index e9c5240f5c..a79da7f908 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php @@ -49,7 +49,7 @@ class Get extends Action ->param('deploymentId', '', new UID(), 'Deployment ID.') ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function 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 c5436d1d05..897a334567 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php @@ -59,7 +59,7 @@ class Update extends Action ->inject('project') ->inject('queueForEvents') ->inject('executor') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function 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 55230bd4a5..5d8eb4585e 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php @@ -75,7 +75,7 @@ class Create extends Base ->inject('project') ->inject('queueForBuilds') ->inject('gitHub') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( 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 48f3894bb2..0ad9852722 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php @@ -72,7 +72,7 @@ class Create extends Base ->inject('queueForEvents') ->inject('queueForBuilds') ->inject('gitHub') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php index 38f1f38e89..c055d57c70 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php @@ -57,7 +57,7 @@ class XList extends Action ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index fd1b2076a8..b170be3fac 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -94,7 +94,7 @@ class Create extends Base ->inject('queueForFunctions') ->inject('geodb') ->inject('executor') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php index cd85b5e534..dc5aebd4ed 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php @@ -62,7 +62,7 @@ class Delete extends Base ->inject('dbForProject') ->inject('dbForPlatform') ->inject('queueForEvents') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php index 892ce30f47..84764eea24 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php @@ -52,7 +52,7 @@ class Get extends Base ->param('executionId', '', new UID(), 'Execution ID.') ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php index a31e95b1c8..a73a5e6189 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php @@ -58,7 +58,7 @@ class XList extends Base ->param('queries', [], new Executions(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Executions::ALLOWED_ATTRIBUTES), true) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php index fd8da657eb..07a02d33d5 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -114,7 +114,7 @@ class Create extends Base ->inject('dbForPlatform') ->inject('request') ->inject('gitHub') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php index 91da68538c..72d5589252 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php @@ -61,7 +61,7 @@ class Delete extends Base ->inject('queueForDeletes') ->inject('queueForEvents') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( 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 e840441774..82c154840a 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php @@ -62,7 +62,7 @@ class Update extends Base ->inject('dbForProject') ->inject('queueForEvents') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php index 9ce6560fd0..e8da162b8a 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php @@ -49,7 +49,7 @@ class Get extends Base ->param('functionId', '', new UID(), 'Function ID.') ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index a19ec1e278..23ce3bc78b 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -104,7 +104,7 @@ class Update extends Base ->inject('dbForPlatform') ->inject('gitHub') ->inject('executor') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php index cd0eba2c50..4b03a5b6cc 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php @@ -56,7 +56,7 @@ class XList extends Base ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php index bfccff0479..0690d1a139 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php @@ -47,7 +47,7 @@ class XList extends Base ] )) ->inject('response') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(Response $response) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php index 39186e7ab7..4c059b09d0 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php @@ -48,7 +48,7 @@ class XList extends Base )) ->inject('response') ->inject('plan') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(Response $response, array $plan) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php index 237898f6fa..f66322839b 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php @@ -49,7 +49,7 @@ class Get extends Base )) ->param('templateId', '', new Text(128), 'Template ID.') ->inject('response') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $templateId, Response $response) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php index 05b54a75d0..86e7f21362 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php @@ -53,7 +53,7 @@ class XList extends Base ->param('limit', 25, new Range(1, 5000), 'Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.', true) ->param('offset', 0, new Range(0, 5000), 'Offset the list of returned templates. Maximum offset is 5000.', true) ->inject('response') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(array $runtimes, array $usecases, int $limit, int $offset, Response $response) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php index e0d659c9ba..7a50e2ab78 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php @@ -55,7 +55,7 @@ class Get extends Base ->param('range', '30d', new WhiteList(['24h', '30d', '90d']), 'Date range.', true) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $functionId, string $range, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php index e64fe9a600..6a4ded4db7 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php @@ -52,7 +52,7 @@ class XList extends Base ->param('range', '30d', new WhiteList(['24h', '30d', '90d']), 'Date range.', true) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $range, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php index 9300524c64..2b6941c48b 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php @@ -65,7 +65,7 @@ class Create extends Base ->inject('dbForProject') ->inject('dbForPlatform') ->inject('project') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php index 3d6bfebcb9..e9bdf77df1 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php @@ -57,7 +57,7 @@ class Delete extends Base ->inject('response') ->inject('dbForProject') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php index 70cc66219a..e5c01c72ad 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php @@ -53,7 +53,7 @@ class Get extends Base ->param('variableId', '', new UID(), 'Variable unique ID.', false) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $functionId, string $variableId, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php index 4102022267..15c2ad816c 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php @@ -61,7 +61,7 @@ class Update extends Base ->inject('response') ->inject('dbForProject') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php index 9c02cfe07c..29465b7572 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php @@ -53,7 +53,7 @@ class XList extends Base ->param('functionId', '', new UID(), 'Function unique ID.', false) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $functionId, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index de5543c9f3..f1b24f601d 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -75,7 +75,7 @@ class Builds extends Action ->inject('log') ->inject('executor') ->inject('plan') - ->callback([$this, 'action']); + ->callback($this->action(...)); } /** diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Create.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Create.php index 43f7d4ac02..e534769bb2 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Create.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Create.php @@ -57,7 +57,7 @@ class Create extends Action ->inject('user') ->inject('response') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $projectId, string $name, ?string $expire, Document $user, Response $response, Database $dbForPlatform) diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php index f6cb966f50..71bd7d96d2 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php @@ -49,7 +49,7 @@ class Delete extends Action ->param('keyId', '', new UID(), 'Key unique ID.') ->inject('response') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $projectId, string $keyId, Response $response, Database $dbForPlatform) diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php index bd472b26e7..0440748b7b 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php @@ -49,7 +49,7 @@ class Get extends Action ->param('keyId', '', new UID(), 'Key unique ID.') ->inject('response') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $projectId, string $keyId, Response $response, Database $dbForPlatform) diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php index d5e6839174..cb2498e68c 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php @@ -52,7 +52,7 @@ class Update extends Action ->param('expire', null, new DatetimeValidator(), 'Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.') ->inject('response') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $projectId, string $keyId, string $name, ?string $expire, Response $response, Database $dbForPlatform) { diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/XList.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/XList.php index 864531d32d..17029c5a36 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/XList.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/XList.php @@ -53,7 +53,7 @@ class XList extends Action ->param('queries', [], new DevKeys(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', DevKeys::ALLOWED_ATTRIBUTES), true) ->inject('response') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $projectId, ?array $queries, Response $response, Database $dbForPlatform) 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 e4d0d2899f..f459672268 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php @@ -66,7 +66,7 @@ class Create extends Action ->inject('queueForCertificates') ->inject('queueForEvents') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $domain, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform) 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 6c5a87a68d..b77f78bf67 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php @@ -71,7 +71,7 @@ class Create extends Action ->inject('queueForEvents') ->inject('dbForPlatform') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $domain, string $functionId, string $branch, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform, Database $dbForProject) 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 d0c9dbbbe3..1cb671a76a 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php @@ -70,7 +70,7 @@ class Create extends Action ->inject('queueForCertificates') ->inject('queueForEvents') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $domain, string $url, int $statusCode, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform) 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 894c954a32..830fade45c 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php @@ -71,7 +71,7 @@ class Create extends Action ->inject('queueForEvents') ->inject('dbForPlatform') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $domain, string $siteId, string $branch, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php index d78d43aec7..380d418fd1 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php @@ -86,7 +86,7 @@ class Create extends Action ->inject('deviceForLocal') ->inject('queueForBuilds') ->inject('plan') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php index 27db10c484..64c26bb4d7 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php @@ -62,7 +62,7 @@ class Delete extends Action ->inject('queueForDeletes') ->inject('queueForEvents') ->inject('deviceForSites') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( 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 e83af0bab6..9c05f3f3fd 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -60,7 +60,7 @@ class Get extends Action ->inject('dbForProject') ->inject('deviceForSites') ->inject('deviceForBuilds') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( 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 bff0735328..e12777f9d5 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php @@ -65,7 +65,7 @@ class Create extends Action ->inject('queueForEvents') ->inject('queueForBuilds') ->inject('deviceForSites') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php index d280231159..d583c62fb1 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php @@ -49,7 +49,7 @@ class Get extends Action ->param('deploymentId', '', new UID(), 'Deployment ID.') ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $siteId, string $deploymentId, Response $response, Database $dbForProject) 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 2c6da43893..51ee252609 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php @@ -57,7 +57,7 @@ class Update extends Action ->inject('project') ->inject('queueForEvents') ->inject('executor') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function 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 5b29521ce5..fc0ea5898c 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php @@ -77,7 +77,7 @@ class Create extends Base ->inject('queueForEvents') ->inject('queueForBuilds') ->inject('gitHub') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( 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 eb6fdf4094..ddad5d793a 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php @@ -72,7 +72,7 @@ class Create extends Base ->inject('queueForEvents') ->inject('queueForBuilds') ->inject('gitHub') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php index d7cfc1d3ad..d709c26ab2 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php @@ -57,7 +57,7 @@ class XList extends Action ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $siteId, array $queries, string $search, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php index cf2bb8c62b..a042fd6e7c 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php @@ -46,7 +46,7 @@ class XList extends Base ] )) ->inject('response') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(Response $response) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php index a411cee91f..cfb35163af 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php @@ -55,7 +55,7 @@ class Delete extends Base ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $siteId, string $logId, Response $response, Database $dbForProject, Event $queueForEvents) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php index 3d1ace2d20..bcfbd715e1 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php @@ -50,7 +50,7 @@ class Get extends Base ->param('logId', '', new UID(), 'Log ID.') ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $siteId, string $logId, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php index a873d32603..79cd49b724 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php @@ -57,7 +57,7 @@ class XList extends Base ->param('queries', [], new Logs(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Executions::ALLOWED_ATTRIBUTES), true) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $siteId, array $queries, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php index c509799024..1bc9e11c3e 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php @@ -89,7 +89,7 @@ class Create extends Base ->inject('project') ->inject('queueForEvents') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php index 37666215e5..ed9b059c33 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php @@ -58,7 +58,7 @@ class Delete extends Base ->inject('dbForProject') ->inject('queueForDeletes') ->inject('queueForEvents') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( 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 a54d0c7889..227e7a6982 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php @@ -60,7 +60,7 @@ class Update extends Base ->inject('dbForProject') ->inject('queueForEvents') ->inject('dbForPlatform') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php index 88ff5f1d51..d86d98ef71 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php @@ -49,7 +49,7 @@ class Get extends Base ->param('siteId', '', new UID(), 'Site ID.') ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $siteId, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 212b410178..b7e140f3ad 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -97,7 +97,7 @@ class Update extends Base ->inject('dbForPlatform') ->inject('gitHub') ->inject('executor') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php index 0a3b257f59..988a2d2e20 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php @@ -56,7 +56,7 @@ class XList extends Base ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(array $queries, string $search, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php index 2a9447f8c6..a76f067114 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php @@ -48,7 +48,7 @@ class XList extends Base )) ->inject('response') ->inject('plan') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(Response $response, array $plan) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php index a4066fb787..633ef31e68 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php @@ -49,7 +49,7 @@ class Get extends Base )) ->param('templateId', '', new Text(128), 'Template ID.') ->inject('response') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $templateId, Response $response) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php index 414ecc9987..4fe00f3edf 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php @@ -53,7 +53,7 @@ class XList extends Base ->param('limit', 25, new Range(1, 5000), 'Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.', true) ->param('offset', 0, new Range(0, 5000), 'Offset the list of returned templates. Maximum offset is 5000.', true) ->inject('response') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php index 8bf19a9c28..f969f5b3af 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php @@ -55,7 +55,7 @@ class Get extends Base ->param('range', '30d', new WhiteList(['24h', '30d', '90d']), 'Date range.', true) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php index e37d3e792e..d36cc56ae5 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php @@ -52,7 +52,7 @@ class XList extends Base ->param('range', '30d', new WhiteList(['24h', '30d', '90d']), 'Date range.', true) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $range, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php index ff1a5c50ec..aa17298cf0 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php @@ -62,7 +62,7 @@ class Create extends Base ->inject('response') ->inject('dbForProject') ->inject('project') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $siteId, string $key, string $value, bool $secret, Response $response, Database $dbForProject, Document $project) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php index e4594a7c3d..840464535f 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php @@ -54,7 +54,7 @@ class Delete extends Base ->param('variableId', '', new UID(), 'Variable unique ID.', false) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $siteId, string $variableId, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php index a14129d432..964453e348 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php @@ -53,7 +53,7 @@ class Get extends Base ->param('variableId', '', new UID(), 'Variable unique ID.', false) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $siteId, string $variableId, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php index cd438a0ebb..aba375c471 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php @@ -58,7 +58,7 @@ class Update extends Base ->param('secret', null, new Boolean(), 'Secret variables can be updated or deleted, but only sites can read them during build and runtime.', true) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php index 15e21296a5..51ab355c75 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php @@ -53,7 +53,7 @@ class XList extends Base ->param('siteId', '', new UID(), 'Site unique ID.', false) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php index fb96849ed2..3f8ef96b92 100644 --- a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php @@ -65,7 +65,7 @@ class Create extends Action ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $bucketId, string $fileId, ?string $expire, Response $response, Database $dbForProject, Event $queueForEvents): void diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.php index 38fe10e2d9..214707177b 100644 --- a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.php +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.php @@ -55,7 +55,7 @@ class XList extends Action ->param('queries', [], new FileTokens(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', FileTokens::ALLOWED_ATTRIBUTES), true) ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $bucketId, string $fileId, array $queries, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php index fcac9a6b24..c36df367ee 100644 --- a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php @@ -58,7 +58,7 @@ class Delete extends Action ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $tokenId, Response $response, Database $dbForProject, Event $queueForEvents) diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Get.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Get.php index 66b9c1b5cb..4da9e125f2 100644 --- a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Get.php +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Get.php @@ -50,7 +50,7 @@ class Get extends Action ->param('tokenId', '', new UID(), 'Token ID.') ->inject('response') ->inject('dbForProject') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $tokenId, Response $response, Database $dbForProject) diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php index c341831c0d..7a15708011 100644 --- a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php @@ -61,7 +61,7 @@ class Update extends Action ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $tokenId, ?string $expire, Response $response, Database $dbForProject, Event $queueForEvents) diff --git a/src/Appwrite/Platform/Tasks/Doctor.php b/src/Appwrite/Platform/Tasks/Doctor.php index b543555477..20eeb0826e 100644 --- a/src/Appwrite/Platform/Tasks/Doctor.php +++ b/src/Appwrite/Platform/Tasks/Doctor.php @@ -34,7 +34,7 @@ class Doctor extends Action $this ->desc('Validate server health') ->inject('register') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(Registry $register): void diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index c7b1f72453..c3b4e33593 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -31,7 +31,7 @@ class Install extends Action ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void diff --git a/src/Appwrite/Platform/Tasks/Maintenance.php b/src/Appwrite/Platform/Tasks/Maintenance.php index fd9d05dec9..d3776129e7 100644 --- a/src/Appwrite/Platform/Tasks/Maintenance.php +++ b/src/Appwrite/Platform/Tasks/Maintenance.php @@ -27,7 +27,7 @@ class Maintenance extends Action ->inject('console') ->inject('queueForCertificates') ->inject('queueForDeletes') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(Database $dbForPlatform, Document $console, Certificate $queueForCertificates, Delete $queueForDeletes): void diff --git a/src/Appwrite/Platform/Tasks/QueueRetry.php b/src/Appwrite/Platform/Tasks/QueueRetry.php index f8099dcb00..442fa39823 100644 --- a/src/Appwrite/Platform/Tasks/QueueRetry.php +++ b/src/Appwrite/Platform/Tasks/QueueRetry.php @@ -24,7 +24,7 @@ class QueueRetry extends Action ->param('name', '', new Text(100), 'Queue name') ->param('limit', 0, new Wildcard(), 'jobs limit', true) ->inject('publisher') - ->callback([$this, 'action']); + ->callback($this->action(...)); } /** diff --git a/src/Appwrite/Platform/Tasks/SDKs.php b/src/Appwrite/Platform/Tasks/SDKs.php index a0009fd59f..2d3fad383e 100644 --- a/src/Appwrite/Platform/Tasks/SDKs.php +++ b/src/Appwrite/Platform/Tasks/SDKs.php @@ -46,7 +46,7 @@ class SDKs extends Action ->param('git', null, new Nullable(new WhiteList(['yes', 'no'])), 'Should we use git push?', optional: true) ->param('production', null, new Nullable(new WhiteList(['yes', 'no'])), 'Should we push to production?', optional: true) ->param('message', null, new Nullable(new Text(256)), 'Commit Message', optional: true) - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(?string $selectedPlatform, ?string $selectedSDK, ?string $version, ?string $git, ?string $production, ?string $message): void diff --git a/src/Appwrite/Platform/Tasks/SSL.php b/src/Appwrite/Platform/Tasks/SSL.php index ae1c93a360..651cb4de11 100644 --- a/src/Appwrite/Platform/Tasks/SSL.php +++ b/src/Appwrite/Platform/Tasks/SSL.php @@ -24,7 +24,7 @@ class SSL extends Action ->param('domain', System::getEnv('_APP_DOMAIN', ''), new Hostname(), 'Domain to generate certificate for. If empty, main domain will be used.', true) ->param('skip-check', true, new Boolean(true), 'If DNS and renew check should be skipped. Defaults to true, and when true, all jobs will result in certificate generation attempt.', true) ->inject('queueForCertificates') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $domain, bool|string $skipCheck, Certificate $queueForCertificates): void diff --git a/src/Appwrite/Platform/Tasks/Screenshot.php b/src/Appwrite/Platform/Tasks/Screenshot.php index 3a9c9a64f5..5a4d8a76b7 100644 --- a/src/Appwrite/Platform/Tasks/Screenshot.php +++ b/src/Appwrite/Platform/Tasks/Screenshot.php @@ -21,7 +21,7 @@ class Screenshot extends Action $this ->desc('Create Site template screenshot') ->param('templateId', '', new Text(128), 'Template ID.') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $templateId): void diff --git a/src/Appwrite/Platform/Tasks/StatsResources.php b/src/Appwrite/Platform/Tasks/StatsResources.php index ca2a6860ff..dce26d2180 100644 --- a/src/Appwrite/Platform/Tasks/StatsResources.php +++ b/src/Appwrite/Platform/Tasks/StatsResources.php @@ -45,7 +45,7 @@ class StatsResources extends Action ->inject('dbForPlatform') ->inject('logError') ->inject('queueForStatsResources') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(Database $dbForPlatform, callable $logError, EventStatsResources $queue): void diff --git a/src/Appwrite/Platform/Tasks/Upgrade.php b/src/Appwrite/Platform/Tasks/Upgrade.php index dfd10d347e..d6159d2718 100644 --- a/src/Appwrite/Platform/Tasks/Upgrade.php +++ b/src/Appwrite/Platform/Tasks/Upgrade.php @@ -23,7 +23,7 @@ class Upgrade extends Install ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void diff --git a/src/Appwrite/Platform/Tasks/Vars.php b/src/Appwrite/Platform/Tasks/Vars.php index 70ae550ef9..542b5bdc9f 100644 --- a/src/Appwrite/Platform/Tasks/Vars.php +++ b/src/Appwrite/Platform/Tasks/Vars.php @@ -18,7 +18,7 @@ class Vars extends Action { $this ->desc('List all the server environment variables') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action(): void diff --git a/src/Appwrite/Platform/Workers/Audits.php b/src/Appwrite/Platform/Workers/Audits.php index 76309145b8..aadb58f971 100644 --- a/src/Appwrite/Platform/Workers/Audits.php +++ b/src/Appwrite/Platform/Workers/Audits.php @@ -47,7 +47,7 @@ class Audits extends Action ->inject('message') ->inject('getProjectDB') ->inject('project') - ->callback([$this, 'action']); + ->callback($this->action(...)); $this->lastTriggeredTime = time(); } diff --git a/src/Appwrite/Platform/Workers/Databases.php b/src/Appwrite/Platform/Workers/Databases.php index b2691b420e..30f9fef5b6 100644 --- a/src/Appwrite/Platform/Workers/Databases.php +++ b/src/Appwrite/Platform/Workers/Databases.php @@ -38,7 +38,7 @@ class Databases extends Action ->inject('dbForProject') ->inject('queueForRealtime') ->inject('log') - ->callback([$this, 'action']); + ->callback($this->action(...)); } /** diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index c8c68a58ba..d42de68178 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -53,7 +53,7 @@ class Functions extends Action ->inject('log') ->inject('executor') ->inject('isResourceBlocked') - ->callback([$this, 'action']); + ->callback($this->action(...)); } public function action( diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index 3a15182e51..4e8b5e085c 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -29,7 +29,7 @@ class Mails extends Action ->inject('message') ->inject('register') ->inject('log') - ->callback([$this, 'action']); + ->callback($this->action(...)); } /** diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index 8491e91a6c..ae9a10efc0 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -72,7 +72,7 @@ class Messaging extends Action ->inject('dbForProject') ->inject('deviceForFiles') ->inject('queueForStatsUsage') - ->callback([$this, 'action']); + ->callback($this->action(...)); } /** diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index b746365f20..0067df863a 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -69,7 +69,7 @@ class Migrations extends Action ->inject('logError') ->inject('queueForRealtime') ->inject('deviceForImports') - ->callback([$this, 'action']); + ->callback($this->action(...)); } /** diff --git a/src/Appwrite/Platform/Workers/StatsResources.php b/src/Appwrite/Platform/Workers/StatsResources.php index 19d1223d95..430a0a38a0 100644 --- a/src/Appwrite/Platform/Workers/StatsResources.php +++ b/src/Appwrite/Platform/Workers/StatsResources.php @@ -49,7 +49,7 @@ class StatsResources extends Action ->inject('getLogsDB') ->inject('dbForPlatform') ->inject('logError') - ->callback([$this, 'action']); + ->callback($this->action(...)); } /** diff --git a/src/Appwrite/Platform/Workers/StatsUsage.php b/src/Appwrite/Platform/Workers/StatsUsage.php index 25c80fabdc..d5bf3fbf5f 100644 --- a/src/Appwrite/Platform/Workers/StatsUsage.php +++ b/src/Appwrite/Platform/Workers/StatsUsage.php @@ -119,7 +119,7 @@ class StatsUsage extends Action ->inject('getProjectDB') ->inject('getLogsDB') ->inject('register') - ->callback([$this, 'action']); + ->callback($this->action(...)); $this->lastTriggeredTime = time(); } diff --git a/src/Appwrite/Platform/Workers/StatsUsageDump.php b/src/Appwrite/Platform/Workers/StatsUsageDump.php index 77ec3f13e6..e1b25b0f04 100644 --- a/src/Appwrite/Platform/Workers/StatsUsageDump.php +++ b/src/Appwrite/Platform/Workers/StatsUsageDump.php @@ -95,7 +95,7 @@ class StatsUsageDump extends Action ->inject('getProjectDB') ->inject('getLogsDB') ->inject('register') - ->callback([$this, 'action']); + ->callback($this->action(...)); } /** diff --git a/src/Appwrite/Platform/Workers/Webhooks.php b/src/Appwrite/Platform/Workers/Webhooks.php index ada4d6faaa..2388e05413 100644 --- a/src/Appwrite/Platform/Workers/Webhooks.php +++ b/src/Appwrite/Platform/Workers/Webhooks.php @@ -38,7 +38,7 @@ class Webhooks extends Action ->inject('queueForStatsUsage') ->inject('log') ->inject('plan') - ->callback([$this, 'action']); + ->callback($this->action(...)); } /** From 54552bf1b4ac1896e843d3c46e83041385fa45cd Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Wed, 4 Jun 2025 18:34:01 +0530 Subject: [PATCH 02/20] Create branch url for first git deployment --- .../Platform/Modules/Compute/Base.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index 0541df551a..a6afee0f6d 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -6,6 +6,7 @@ use Appwrite\Event\Build; use Appwrite\Extend\Exception; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Exception\Duplicate; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; @@ -226,6 +227,43 @@ class Base extends Action ])) ); + // VCS branch preview + if (!empty($providerBranch)) { + $branchPrefix = substr($providerBranch, 0, 16); + if (strlen($providerBranch) > 16) { + $remainingChars = substr($providerBranch, 16); + $branchPrefix .= '-' . substr(hash('sha256', $remainingChars), 0, 7); + } + $resourceProjectHash = substr(hash('sha256', $site->getId() . $project->getId()), 0, 7); + $domain = "branch-{$branchPrefix}-{$resourceProjectHash}.{$sitesDomain}"; + $ruleId = md5($domain); + try { + Authorization::skip( + fn () => $dbForPlatform->createDocument('rules', new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'domain' => $domain, + 'type' => 'deployment', + 'trigger' => 'deployment', + 'deploymentId' => $deployment->getId(), + 'deploymentInternalId' => $deployment->getInternalId(), + 'deploymentResourceType' => 'site', + 'deploymentResourceId' => $site->getId(), + 'deploymentResourceInternalId' => $site->getInternalId(), + 'deploymentVcsProviderBranch' => $providerBranch, + 'status' => 'verified', + 'certificateId' => '', + 'search' => implode(' ', [$ruleId, $domain]), + 'owner' => 'Appwrite', + 'region' => $project->getAttribute('region') + ])) + ); + } catch (Duplicate $err) { + // Ignore, rule already exists; will be updated by builds worker + } + } + $queueForBuilds ->setType(BUILD_TYPE_DEPLOYMENT) ->setResource($site) From fa8e5b5b8e5ae8cbdd733cc093179ba9239cf897 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Wed, 4 Jun 2025 19:11:07 +0530 Subject: [PATCH 03/20] Add commit url --- .../Platform/Modules/Compute/Base.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index a6afee0f6d..204570db4e 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -227,6 +227,36 @@ class Base extends Action ])) ); + if (!empty($commitDetails['commitHash'])) { + $domain = "commit-" . substr($commitDetails['commitHash'], 0, 16) . ".{$sitesDomain}"; + $ruleId = md5($domain); + try { + Authorization::skip( + fn () => $dbForPlatform->createDocument('rules', new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'domain' => $domain, + 'type' => 'deployment', + 'trigger' => 'deployment', + 'deploymentId' => $deployment->getId(), + 'deploymentInternalId' => $deployment->getInternalId(), + 'deploymentResourceType' => 'site', + 'deploymentResourceId' => $site->getId(), + 'deploymentResourceInternalId' => $site->getInternalId(), + 'deploymentVcsProviderBranch' => $providerBranch, + 'status' => 'verified', + 'certificateId' => '', + 'search' => implode(' ', [$ruleId, $domain]), + 'owner' => 'Appwrite', + 'region' => $project->getAttribute('region') + ])) + ); + } catch (Duplicate $err) { + // Ignore, rule already exists; will be updated by builds worker + } + } + // VCS branch preview if (!empty($providerBranch)) { $branchPrefix = substr($providerBranch, 0, 16); From 37388fcf1b4a6ea1cee8a2952e534090b0a275b5 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Fri, 13 Jun 2025 18:08:19 +0530 Subject: [PATCH 04/20] Change php version in composer.lock --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index fdde3f2750..3120d937ae 100644 --- a/composer.lock +++ b/composer.lock @@ -3357,7 +3357,7 @@ "shasum": "" }, "require": { - "php": ">=7.4", + "php": ">=8.3", "utopia-php/framework": "0.*.*" }, "require-dev": { From fc656167d5c659c2e32afe29a52877888c6d4f35 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Fri, 13 Jun 2025 18:11:51 +0530 Subject: [PATCH 05/20] Composer update --- composer.lock | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/composer.lock b/composer.lock index 3120d937ae..4e434d714a 100644 --- a/composer.lock +++ b/composer.lock @@ -3357,7 +3357,7 @@ "shasum": "" }, "require": { - "php": ">=8.3", + "php": ">=7.4", "utopia-php/framework": "0.*.*" }, "require-dev": { @@ -4807,16 +4807,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.41.4", + "version": "0.41.6", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "07804269131f411576aac60c795a5ebc3afaa48a" + "reference": "bfcebb968c527e17fdf18d40b8986c83d9c18c93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/07804269131f411576aac60c795a5ebc3afaa48a", - "reference": "07804269131f411576aac60c795a5ebc3afaa48a", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/bfcebb968c527e17fdf18d40b8986c83d9c18c93", + "reference": "bfcebb968c527e17fdf18d40b8986c83d9c18c93", "shasum": "" }, "require": { @@ -4852,9 +4852,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.41.4" + "source": "https://github.com/appwrite/sdk-generator/tree/0.41.6" }, - "time": "2025-06-10T08:28:11+00:00" + "time": "2025-06-12T03:27:26+00:00" }, { "name": "doctrine/annotations", @@ -5147,16 +5147,16 @@ }, { "name": "matthiasmullie/minify", - "version": "1.3.73", + "version": "1.3.74", "source": { "type": "git", "url": "https://github.com/matthiasmullie/minify.git", - "reference": "cb7a9297b4ab070909cefade30ee95054d4ae87a" + "reference": "a2593286a4135d03c6a6a9e9aeded5d41e931ce4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/cb7a9297b4ab070909cefade30ee95054d4ae87a", - "reference": "cb7a9297b4ab070909cefade30ee95054d4ae87a", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/a2593286a4135d03c6a6a9e9aeded5d41e931ce4", + "reference": "a2593286a4135d03c6a6a9e9aeded5d41e931ce4", "shasum": "" }, "require": { @@ -5167,8 +5167,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": ">=2.0", "matthiasmullie/scrapbook": ">=1.3", - "phpunit/phpunit": ">=4.8", - "squizlabs/php_codesniffer": ">=3.0" + "phpunit/phpunit": ">=4.8" }, "suggest": { "psr/cache-implementation": "Cache implementation to use with Minify::cache" @@ -5206,7 +5205,7 @@ ], "support": { "issues": "https://github.com/matthiasmullie/minify/issues", - "source": "https://github.com/matthiasmullie/minify/tree/1.3.73" + "source": "https://github.com/matthiasmullie/minify/tree/1.3.74" }, "funding": [ { @@ -5214,7 +5213,7 @@ "type": "github" } ], - "time": "2024-03-15T10:27:10+00:00" + "time": "2025-06-12T08:06:04+00:00" }, { "name": "matthiasmullie/path-converter", From 96c035401ba7420929fcf8e90c9600e099dbef87 Mon Sep 17 00:00:00 2001 From: shimon Date: Sun, 15 Jun 2025 11:30:57 +0300 Subject: [PATCH 06/20] Override project resource to update hooks, since x-appwrite-project is not available when executing custom domain function --- app/controllers/general.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/controllers/general.php b/app/controllers/general.php index 5beac9e1e8..aeb4c5bd9c 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -10,6 +10,7 @@ use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Event\Func; use Appwrite\Event\StatsUsage; +use Appwrite\Extend\Exception; use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Network\Validator\Origin; use Appwrite\Platform\Appwrite; @@ -118,6 +119,11 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw $project->setAttribute('accessedAt', DateTime::now()); Authorization::skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $project)); } + /** + * Override project resource to update hooks, since x-appwrite-project is not available when executing custom domain function + */ + App::setResource('project', fn () => $project); + } if (array_key_exists('proxy', $project->getAttribute('services', []))) { @@ -1136,6 +1142,12 @@ App::error() ->inject('queueForStatsUsage') ->inject('devKey') ->action(function (Throwable $error, App $utopia, Request $request, Response $response, Document $project, ?Logger $logger, Log $log, StatsUsage $queueForStatsUsage) { + + var_dump([ + 'location' => 'error hook', + 'project' => $project->getId(), + ]); + $version = System::getEnv('_APP_VERSION', 'UNKNOWN'); $route = $utopia->getRoute(); $class = \get_class($error); From 4d41c903673c3d55bd45f3c247f80047d13e530b Mon Sep 17 00:00:00 2001 From: shimon Date: Sun, 15 Jun 2025 12:00:39 +0300 Subject: [PATCH 07/20] remove duplicate use --- app/controllers/general.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index aeb4c5bd9c..8ad7e188fd 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -10,7 +10,6 @@ use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Event\Func; use Appwrite\Event\StatsUsage; -use Appwrite\Extend\Exception; use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Network\Validator\Origin; use Appwrite\Platform\Appwrite; From 7d54a6191d675ba522b70f5de3df790e36286710 Mon Sep 17 00:00:00 2001 From: shimon Date: Sun, 15 Jun 2025 12:13:15 +0300 Subject: [PATCH 08/20] remove duplicate use --- app/controllers/general.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 8ad7e188fd..17e855e9ac 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1142,11 +1142,6 @@ App::error() ->inject('devKey') ->action(function (Throwable $error, App $utopia, Request $request, Response $response, Document $project, ?Logger $logger, Log $log, StatsUsage $queueForStatsUsage) { - var_dump([ - 'location' => 'error hook', - 'project' => $project->getId(), - ]); - $version = System::getEnv('_APP_VERSION', 'UNKNOWN'); $route = $utopia->getRoute(); $class = \get_class($error); From c0c30fe767f8c197b8793bf562f57146e5ba15a8 Mon Sep 17 00:00:00 2001 From: shimon Date: Sun, 15 Jun 2025 12:40:22 +0300 Subject: [PATCH 09/20] remove duplicate use --- app/controllers/general.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 17e855e9ac..3ab1a23401 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1141,7 +1141,6 @@ App::error() ->inject('queueForStatsUsage') ->inject('devKey') ->action(function (Throwable $error, App $utopia, Request $request, Response $response, Document $project, ?Logger $logger, Log $log, StatsUsage $queueForStatsUsage) { - $version = System::getEnv('_APP_VERSION', 'UNKNOWN'); $route = $utopia->getRoute(); $class = \get_class($error); From 68fc0f898f5d238c67dab5322d482aafd7678754 Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 19 Jun 2025 17:15:43 +0300 Subject: [PATCH 10/20] set log projectId on the router method --- app/controllers/general.php | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index f3470bc206..ab2aa73e4d 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -56,7 +56,7 @@ Config::setParam('domainVerification', false); Config::setParam('cookieDomain', 'localhost'); Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE); -function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, string $previewHostname, ?Key $apiKey) +function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, string $previewHostname, ?Key $apiKey) { $host = $request->getHostname() ?? ''; if (!empty($previewHostname)) { @@ -118,11 +118,11 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw $project->setAttribute('accessedAt', DateTime::now()); Authorization::skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $project)); } - /** - * Override project resource to update hooks, since x-appwrite-project is not available when executing custom domain function - */ - App::setResource('project', fn () => $project); + /** + * Set projectId to update the Error hook logger, since x-appwrite-project is not available when executing custom domain function + */ + $log->addTag('projectId', $project->getId()); } if (array_key_exists('proxy', $project->getAttribute('services', []))) { @@ -792,6 +792,7 @@ App::init() ->inject('swooleRequest') ->inject('request') ->inject('response') + ->inject('log') ->inject('console') ->inject('project') ->inject('dbForPlatform') @@ -809,7 +810,7 @@ App::init() ->inject('previewHostname') ->inject('devKey') ->inject('apiKey') - ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Document $console, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, array $clients, Reader $geodb, StatsUsage $queueForStatsUsage, Event $queueForEvents, Certificate $queueForCertificates, Func $queueForFunctions, Executor $executor, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey) { + ->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $console, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, array $clients, Reader $geodb, StatsUsage $queueForStatsUsage, Event $queueForEvents, Certificate $queueForCertificates, Func $queueForFunctions, Executor $executor, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey) { /* * Appwrite Router */ @@ -817,7 +818,7 @@ App::init() $mainDomain = System::getEnv('_APP_DOMAIN', ''); // Only run Router when external domain if ($host !== $mainDomain || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) { $utopia->getRoute()?->label('router', true); } } @@ -1099,7 +1100,7 @@ App::options() $mainDomain = System::getEnv('_APP_DOMAIN', ''); // Only run Router when external domain if ($host !== $mainDomain || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) { $utopia->getRoute()?->label('router', true); } } @@ -1272,7 +1273,12 @@ App::error() $log->addTag('url', $request->getURI()); $log->addTag('verboseType', get_class($error)); $log->addTag('code', $error->getCode()); - $log->addTag('projectId', $project->getId()); + + $tags = $log->getTags(); + if (isset($tags['projectId'])){ + $log->addTag('projectId', $project->getId()); + } + $log->addTag('hostname', $request->getHostname()); $log->addTag('locale', (string)$request->getParam('locale', $request->getHeader('x-appwrite-locale', ''))); @@ -1408,7 +1414,7 @@ App::get('/robots.txt') $template = new View(__DIR__ . '/../views/general/robots.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) { $utopia->getRoute()?->label('router', true); } } @@ -1440,7 +1446,7 @@ App::get('/humans.txt') $template = new View(__DIR__ . '/../views/general/humans.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $previewHostname, $apiKey)) { $utopia->getRoute()?->label('router', true); } } From d8c88fb420a7e0b22fde01680cec333613776eb0 Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 19 Jun 2025 19:44:33 +0300 Subject: [PATCH 11/20] composer --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index ab2aa73e4d..f06c46e8d9 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1275,7 +1275,7 @@ App::error() $log->addTag('code', $error->getCode()); $tags = $log->getTags(); - if (isset($tags['projectId'])){ + if (isset($tags['projectId'])) { $log->addTag('projectId', $project->getId()); } From 54748b7d3274b521ada36bc7fd952d77e79e203f Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 23 Jun 2025 20:50:59 +0400 Subject: [PATCH 12/20] Update app/controllers/general.php Co-authored-by: Steven Nguyen <1477010+stnguyen90@users.noreply.github.com> --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index f06c46e8d9..943743d956 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1275,7 +1275,7 @@ App::error() $log->addTag('code', $error->getCode()); $tags = $log->getTags(); - if (isset($tags['projectId'])) { + if (!isset($tags['projectId'])) { $log->addTag('projectId', $project->getId()); } From 3059eecbeb48ee62e6a997d0c2704c4d3d3f2f24 Mon Sep 17 00:00:00 2001 From: shimon Date: Mon, 23 Jun 2025 20:27:12 +0300 Subject: [PATCH 13/20] benchmark cli --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 6d73787d00..5ca639849e 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -65,7 +65,7 @@ jobs: sudo apt update sudo apt install oha - name: Benchmark PR - run: 'oha -z 180s http://localhost/v1/health/version -j > benchmark.json' + run: 'oha -z 180s http://localhost/v1/health/version --j > benchmark.json' - name: Cleaning run: docker compose down -v - name: Installing latest version From 4e0faf67f7c6c6311cf1ac6b5a283e75dee09bb8 Mon Sep 17 00:00:00 2001 From: shimon Date: Mon, 23 Jun 2025 20:39:52 +0300 Subject: [PATCH 14/20] benchmark cli --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 5ca639849e..799f1192cc 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -65,7 +65,7 @@ jobs: sudo apt update sudo apt install oha - name: Benchmark PR - run: 'oha -z 180s http://localhost/v1/health/version --j > benchmark.json' + run: 'oha -z 180s http://localhost/v1/health/version > benchmark.json' - name: Cleaning run: docker compose down -v - name: Installing latest version From 213b1ae20e96393888c114ddcd859d730c4f7074 Mon Sep 17 00:00:00 2001 From: shimon Date: Mon, 23 Jun 2025 20:57:39 +0300 Subject: [PATCH 15/20] benchmark cli --- .github/workflows/benchmark.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 799f1192cc..f1051497a8 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -65,7 +65,7 @@ jobs: sudo apt update sudo apt install oha - name: Benchmark PR - run: 'oha -z 180s http://localhost/v1/health/version > benchmark.json' + run: 'oha -z 180s http://localhost/v1/health/version --output-format json > benchmark.json' - name: Cleaning run: docker compose down -v - name: Installing latest version @@ -78,7 +78,7 @@ jobs: docker compose up -d sleep 10 - name: Benchmark Latest - run: oha -z 180s http://localhost/v1/health/version -j > benchmark-latest.json + run: oha -z 180s http://localhost/v1/health/version --output-format json > benchmark-latest.json - name: Prepare comment run: | echo '## :sparkles: Benchmark results' > benchmark.txt From 4b1966997b3389787b75478ba826fb68e40e5a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 25 Jun 2025 10:30:07 +0200 Subject: [PATCH 16/20] Fix build duration calculation --- .../Modules/Functions/Workers/Builds.php | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 8ff1690da9..3d2b42346d 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -209,6 +209,9 @@ class Builds extends Action Executor $executor, array $plan ): void { + $startTime = DateTime::now(); + $durationStart = \microtime(true); + $resourceKey = match ($resource->getCollection()) { 'functions' => 'functionId', 'sites' => 'siteId', @@ -260,9 +263,6 @@ class Builds extends Action ->setParam($resourceKey, $resource->getId()) ->setParam('deploymentId', $deployment->getId()); - $startTime = DateTime::now(); - $durationStart = \microtime(true); - if ($deployment->getAttribute('status') === 'canceled') { Console::info('Build has been canceled'); return; @@ -810,9 +810,6 @@ class Builds extends Action throw $err; } - $endTime = DateTime::now(); - $durationEnd = \microtime(true); - $buildSizeLimit = (int)System::getEnv('_APP_COMPUTE_BUILD_SIZE_LIMIT', '2000000000'); if (isset($plan['buildSize'])) { $buildSizeLimit = $plan['buildSize'] * 1000 * 1000; @@ -821,10 +818,6 @@ class Builds extends Action throw new \Exception('Build size should be less than ' . number_format($buildSizeLimit / (1000 * 1000), 2) . ' MBs.'); } - /** Update the build document */ - $deployment->setAttribute('buildStartedAt', DateTime::format((new \DateTime())->setTimestamp(floor($response['startTime'])))); - $deployment->setAttribute('buildEndedAt', $endTime); - $deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart))); $deployment->setAttribute('buildPath', $response['path']); $deployment->setAttribute('buildSize', $response['size']); $deployment->setAttribute('totalSize', $deployment->getAttribute('buildSize', 0) + $deployment->getAttribute('sourceSize', 0)); @@ -1191,6 +1184,15 @@ class Builds extends Action } } + $endTime = DateTime::now(); + $durationEnd = \microtime(true); + $deployment->setAttribute('buildEndedAt', $endTime); + $deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart))); + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { Console::info('Build has been canceled'); return; From b6d4baf4dc40bf2deda0104734295cc3fe4da9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 25 Jun 2025 13:14:08 +0200 Subject: [PATCH 17/20] Fix tests --- .../Platform/Modules/Functions/Workers/Builds.php | 2 +- .../Services/Realtime/RealtimeConsoleClientTest.php | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 3d2b42346d..817cc58c9f 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -1236,7 +1236,7 @@ class Builds extends Action // Combine with previous logs if deployment got past build process $previousLogs = ''; - if (!empty($deployment->getAttribute('buildEndedAt', ''))) { + if (!is_null($deployment->getAttribute('buildSize', null))) { $previousLogs = $deployment->getAttribute('buildLogs', ''); if (!empty($previousLogs)) { $message = $previousLogs . "\n" . $message; diff --git a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php index ba2d18694a..1f60f9fde6 100644 --- a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php @@ -607,10 +607,8 @@ class RealtimeConsoleClientTest extends Scope $this->assertContains("projects.{$projectId}", $response['data']['channels']); $this->assertArrayHasKey('buildLogs', $response['data']['payload']); - if (!empty($response['data']['payload']['buildEndedAt'])) { - $this->assertNotEmpty($response['data']['payload']['buildEndedAt']); + if (!empty($response['data']['payload']['buildSize'])) { $this->assertNotEmpty($response['data']['payload']['buildStartedAt']); - $this->assertNotEmpty($response['data']['payload']['buildDuration']); $this->assertNotEmpty($response['data']['payload']['buildPath']); $this->assertNotEmpty($response['data']['payload']['buildSize']); $this->assertNotEmpty($response['data']['payload']['totalSize']); @@ -634,6 +632,13 @@ class RealtimeConsoleClientTest extends Scope $this->assertContains("projects.{$projectId}", $response['data']['channels']); $this->assertEquals("ready", $response['data']['payload']['status']); + $response = json_decode($client->receive(), true); + $this->assertContains("functions.{$functionId}.deployments.{$deploymentId}.update", $response['data']['events']); + $this->assertContains('console', $response['data']['channels']); + $this->assertContains("projects.{$projectId}", $response['data']['channels']); + $this->assertNotEmpty($response['data']['payload']['buildDuration']); + $this->assertNotEmpty($response['data']['payload']['buildEndedAt']); + $client->close(); } } From 347f035105160c4682c58e85e33cbd1329f14e76 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 25 Jun 2025 15:27:51 +0400 Subject: [PATCH 18/20] chore: fix benchmark CI --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 6d73787d00..6726f7b48f 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -65,7 +65,7 @@ jobs: sudo apt update sudo apt install oha - name: Benchmark PR - run: 'oha -z 180s http://localhost/v1/health/version -j > benchmark.json' + run: 'oha -z 180s http://localhost/v1/health/version --output_format json > benchmark.json' - name: Cleaning run: docker compose down -v - name: Installing latest version From 93651c776e178a18f94542d474b01a380aa2a911 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Wed, 25 Jun 2025 15:32:19 +0400 Subject: [PATCH 19/20] chore: fix benchmark CI --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 6726f7b48f..562f2223f3 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -78,7 +78,7 @@ jobs: docker compose up -d sleep 10 - name: Benchmark Latest - run: oha -z 180s http://localhost/v1/health/version -j > benchmark-latest.json + run: oha -z 180s http://localhost/v1/health/version --output_format json > benchmark-latest.json - name: Prepare comment run: | echo '## :sparkles: Benchmark results' > benchmark.txt From c85cfe132e30803a6d5ca47428215d3c5128d2a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 25 Jun 2025 15:53:59 +0200 Subject: [PATCH 20/20] Improve flaky tests logging --- tests/e2e/Services/Account/AccountCustomClientTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index f9da3f73cf..86c78d5d81 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -2421,7 +2421,7 @@ class AccountCustomClientTest extends Scope $smsRequest = $this->assertLastRequest(function ($request) { $this->assertArrayHasKey('data', $request); - $this->assertArrayHasKey('message', $request['data']); + $this->assertArrayHasKey('message', $request['data'], "Last request missing message: " . \json_encode($request)); }); /**