From 0816dd15f955cd0815772e289b30bb960a2a5065 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 14 Jul 2022 16:12:44 +0300 Subject: [PATCH] remove comments --- app/controllers/api/teams.php | 1 + app/realtime.php | 12 ++++++------ src/Appwrite/Messaging/Adapter/Realtime.php | 3 ++- tests/e2e/Services/Webhooks/WebhooksBase.php | 3 +-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 31c260da83..6e9a8b23e4 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -16,6 +16,7 @@ use Appwrite\Utopia\Response; use MaxMind\Db\Reader; use Utopia\App; use Utopia\Audit\Audit; +use Utopia\CLI\Console; use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; diff --git a/app/realtime.php b/app/realtime.php index d13e1c867f..c56197f12d 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -1,7 +1,6 @@ onStart(function () use ($stats, $register, $containerId, &$statsDocume '$read' => [], '$write' => [], 'container' => $containerId, - 'timestamp' => time(), + 'timestamp' => DateTime::now(), 'value' => '{}' ]); @@ -181,7 +181,7 @@ $server->onStart(function () use ($stats, $register, $containerId, &$statsDocume [$database, $returnDatabase] = getDatabase($register, '_console'); $statsDocument - ->setAttribute('timestamp', time()) + ->setAttribute('timestamp', DateTime::now()) ->setAttribute('value', json_encode($payload)); Authorization::skip(fn () => $database->updateDocument('realtime', $statsDocument->getId(), $statsDocument)); @@ -209,7 +209,7 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats, $payload = []; $list = Authorization::skip(fn () => $database->find('realtime', [ - new Query('timestamp', Query::TYPE_GREATER, [(time() - 15)]) + new Query('timestamp', Query::TYPE_GREATER, [DateTime::addSeconds(new \DateTime(), -15)]) ])); /** @@ -236,7 +236,7 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats, 'data' => [ 'events' => ['stats.connections'], 'channels' => ['project'], - 'timestamp' => time(), + 'timestamp' => DateTime::now(), 'payload' => [ $projectId => $payload[$projectId] ] @@ -263,7 +263,7 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats, 'data' => [ 'events' => ['test.event'], 'channels' => ['tests'], - 'timestamp' => time(), + 'timestamp' => DateTime::now(), 'payload' => $payload ] ]; diff --git a/src/Appwrite/Messaging/Adapter/Realtime.php b/src/Appwrite/Messaging/Adapter/Realtime.php index 60e2fdbbb8..86185e7757 100644 --- a/src/Appwrite/Messaging/Adapter/Realtime.php +++ b/src/Appwrite/Messaging/Adapter/Realtime.php @@ -2,6 +2,7 @@ namespace Appwrite\Messaging\Adapter; +use Utopia\Database\DateTime; use Utopia\Database\Document; use Appwrite\Messaging\Adapter; use Utopia\App; @@ -146,7 +147,7 @@ class Realtime extends Adapter 'data' => [ 'events' => $events, 'channels' => $channels, - 'timestamp' => time(), + 'timestamp' => DateTime::now(), 'payload' => $payload ] ])); diff --git a/tests/e2e/Services/Webhooks/WebhooksBase.php b/tests/e2e/Services/Webhooks/WebhooksBase.php index 59b099db33..02be959c60 100644 --- a/tests/e2e/Services/Webhooks/WebhooksBase.php +++ b/tests/e2e/Services/Webhooks/WebhooksBase.php @@ -861,7 +861,7 @@ trait WebhooksBase $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['teamId']); $this->assertCount(2, $webhook['data']['roles']); - $this->assertEquals(false, DateTime::isValid($webhook['data']['joined'])); + $this->assertEquals(false, DateTime::isValid($webhook['data']['invited'])); //isAppUser=1 not consistent $this->assertEquals(('server' === $this->getSide()), $webhook['data']['confirm']); /** @@ -933,7 +933,6 @@ trait WebhooksBase $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['teamId']); $this->assertCount(2, $webhook['data']['roles']); - $this->assertEquals(false, DateTime::isValid($webhook['data']['joined'])); $this->assertEquals(true, DateTime::isValid($webhook['data']['invited'])); $this->assertEquals(('server' === $this->getSide()), $webhook['data']['confirm']); }