From e4adff4edcecea89340fef3cb58dfbb359558584 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 3 Sep 2025 10:29:49 +0100 Subject: [PATCH] chore: jake review --- app/controllers/api/health.php | 22 +++++++-------- src/Appwrite/Event/Database.php | 28 +++++++++++++++++++ src/Appwrite/Event/Func.php | 3 -- .../Platform/Tasks/ScheduleExecutions.php | 4 +-- .../Platform/Tasks/ScheduleFunctions.php | 2 +- .../Platform/Tasks/ScheduleMessages.php | 2 +- 6 files changed, 42 insertions(+), 19 deletions(-) diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 818c431de7..988f061ed5 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -977,17 +977,17 @@ App::get('/v1/health/queue/failed/:name') int|string $threshold, Response $response, Database $queueForDatabase, - Database $queueForDeletes, - Database $queueForAudits, - Database $queueForMails, - Database $queueForFunctions, - Database $queueForStatsResources, - Database $queueForStatsUsage, - Database $queueForWebhooks, - Database $queueForCertificates, - Database $queueForBuilds, - Database $queueForMessaging, - Database $queueForMigrations + Delete $queueForDeletes, + Audit $queueForAudits, + Mail $queueForMails, + Func $queueForFunctions, + StatsResources $queueForStatsResources, + StatsUsage $queueForStatsUsage, + Webhook $queueForWebhooks, + Certificate $queueForCertificates, + Build $queueForBuilds, + Messaging $queueForMessaging, + Migration $queueForMigrations ) { $threshold = \intval($threshold); diff --git a/src/Appwrite/Event/Database.php b/src/Appwrite/Event/Database.php index 70051f9055..26639fc60b 100644 --- a/src/Appwrite/Event/Database.php +++ b/src/Appwrite/Event/Database.php @@ -193,4 +193,32 @@ class Database extends Event 'events' => Event::generateEvents($this->getEvent(), $this->getParams()) ]; } + + /** + * Clone the database event instance. + */ + public function __clone(): void + { + parent::__clone(); + + if ($this->database !== null) { + $this->database = clone $this->database; + } + + if ($this->row !== null) { + $this->row = clone $this->row; + } + + if ($this->table !== null) { + $this->table = clone $this->table; + } + + if ($this->document !== null) { + $this->document = clone $this->document; + } + + if ($this->collection !== null) { + $this->collection = clone $this->collection; + } + } } diff --git a/src/Appwrite/Event/Func.php b/src/Appwrite/Event/Func.php index df356b1ad5..9741576ecc 100644 --- a/src/Appwrite/Event/Func.php +++ b/src/Appwrite/Event/Func.php @@ -222,9 +222,6 @@ class Func extends Event /** * Clone the function event instance. - * - * Handles deep copying of Func-specific properties - * after parent cloning completes. */ public function __clone(): void { diff --git a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php index 6b19ef24e6..cdfb188190 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php @@ -31,10 +31,8 @@ class ScheduleExecutions extends ScheduleBase public function __construct() { - $type = static::getSupportedResource(); - $this - ->desc("Execute executions scheduled in Appwrite") + ->desc('Execute executions scheduled in Appwrite') ->inject('queueForFunctions') ->inject('dbForPlatform') ->inject('getProjectDB') diff --git a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php index 6e45fda408..d8ded60ec6 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php @@ -35,7 +35,7 @@ class ScheduleFunctions extends ScheduleBase public function __construct() { $this - ->desc("Execute functions scheduled in Appwrite") + ->desc('Execute functions scheduled in Appwrite') ->inject('queueForFunctions') ->inject('dbForPlatform') ->inject('getProjectDB') diff --git a/src/Appwrite/Platform/Tasks/ScheduleMessages.php b/src/Appwrite/Platform/Tasks/ScheduleMessages.php index 62d5344e0d..58a0a76b3e 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleMessages.php +++ b/src/Appwrite/Platform/Tasks/ScheduleMessages.php @@ -31,7 +31,7 @@ class ScheduleMessages extends ScheduleBase public function __construct() { $this - ->desc("Execute messages scheduled in Appwrite") + ->desc('Execute messages scheduled in Appwrite') ->inject('queueForMessaging') ->inject('dbForPlatform') ->inject('getProjectDB')