From f6157dd2c03216763ba08e1b8e5397a031a867ad Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 12 Dec 2024 16:44:41 +0200 Subject: [PATCH 1/2] payload bug fix --- src/Appwrite/Platform/Workers/UsageDump.php | 23 +++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/UsageDump.php b/src/Appwrite/Platform/Workers/UsageDump.php index 3c3ad0d0f3..1b6d4f81a8 100644 --- a/src/Appwrite/Platform/Workers/UsageDump.php +++ b/src/Appwrite/Platform/Workers/UsageDump.php @@ -57,9 +57,28 @@ class UsageDump extends Action throw new Exception('Missing payload'); } - // TODO: rename both usage workers @shimonewman + foreach ($payload['stats'] ?? [] as $stats) { - $project = new Document($stats['project'] ?? []); + //$project = new Document($stats['project'] ?? []); + + /** + * Start temp bug fallback + */ + $document = $stats['project'] ?? []; + if(!empty($document['$uid'])) { + $document['$id'] = $document['$uid']; + } + + $project = new Document($document); + + if(empty($project->getAttribute('database'))){ + var_dump($stats); + } + + /** + * End temp bug fallback + */ + $numberOfKeys = !empty($stats['keys']) ? count($stats['keys']) : 0; $receivedAt = $stats['receivedAt'] ?? 'NONE'; if ($numberOfKeys === 0) { From 6a28d4eee630ced990b75e3f90052794230bc4d5 Mon Sep 17 00:00:00 2001 From: shimon Date: Thu, 12 Dec 2024 16:55:14 +0200 Subject: [PATCH 2/2] payload bug fix --- src/Appwrite/Platform/Workers/UsageDump.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/UsageDump.php b/src/Appwrite/Platform/Workers/UsageDump.php index 1b6d4f81a8..1fe6b742b8 100644 --- a/src/Appwrite/Platform/Workers/UsageDump.php +++ b/src/Appwrite/Platform/Workers/UsageDump.php @@ -65,13 +65,13 @@ class UsageDump extends Action * Start temp bug fallback */ $document = $stats['project'] ?? []; - if(!empty($document['$uid'])) { + if (!empty($document['$uid'])) { $document['$id'] = $document['$uid']; } $project = new Document($document); - if(empty($project->getAttribute('database'))){ + if (empty($project->getAttribute('database'))) { var_dump($stats); }