mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
reverting
This commit is contained in:
1 parent
eaf021cf17
commit
9f2e3028c2
4 files changed
+49
-7
No files matched your search
@@ -8,4 +8,23 @@ use Utopia\Mongo\Adapter;
|
||||
class SwooleClient extends Adapter
|
||||
{
|
||||
|
||||
public function isConnected(): bool
|
||||
{
|
||||
// TODO: Implement isConnected() method.
|
||||
}
|
||||
|
||||
public function connect(string $host, int $port = null, float $timeout = null): bool
|
||||
{
|
||||
// TODO: Implement connect() method.
|
||||
}
|
||||
|
||||
public function send(mixed $data): int|bool
|
||||
{
|
||||
// TODO: Implement send() method.
|
||||
}
|
||||
|
||||
public function recv(int $timeout = null): string|bool
|
||||
{
|
||||
// TODO: Implement recv() method.
|
||||
}
|
||||
}
|
||||
@@ -7,4 +7,23 @@ use Utopia\Mongo\Adapter;
|
||||
class SwooleCoroutineClient extends Adapter
|
||||
{
|
||||
|
||||
public function isConnected(): bool
|
||||
{
|
||||
// TODO: Implement isConnected() method.
|
||||
}
|
||||
|
||||
public function connect(string $host, int $port = null, float $timeout = null): bool
|
||||
{
|
||||
// TODO: Implement connect() method.
|
||||
}
|
||||
|
||||
public function send(mixed $data): int|bool
|
||||
{
|
||||
// TODO: Implement send() method.
|
||||
}
|
||||
|
||||
public function recv(int $timeout = null): string|bool
|
||||
{
|
||||
// TODO: Implement recv() method.
|
||||
}
|
||||
}
|
||||
+10
-7
@@ -17,7 +17,7 @@ class Client
|
||||
/**
|
||||
* Socket (sync or async) client.
|
||||
*/
|
||||
private Adapter $client;
|
||||
private SwooleClient|CoroutineClient $client;
|
||||
|
||||
/**
|
||||
* Defines commands Mongo uses over wire protocol.
|
||||
@@ -72,13 +72,16 @@ class Client
|
||||
int $port,
|
||||
string $user,
|
||||
string $password,
|
||||
Adapter $adapter
|
||||
bool $useCoroutine = true
|
||||
){
|
||||
$this->id = uniqid('utopia.mongo.client');
|
||||
$this->database = $database;
|
||||
$this->host = $host;
|
||||
$this->port = $port;
|
||||
$this->client = $adapter;
|
||||
|
||||
$this->client = $useCoroutine
|
||||
? new CoroutineClient(SWOOLE_SOCK_TCP | SWOOLE_KEEP)
|
||||
: new SwooleClient(SWOOLE_SOCK_TCP | SWOOLE_KEEP);
|
||||
|
||||
$this->auth = new Auth([
|
||||
'authcid' => $user,
|
||||
@@ -215,7 +218,7 @@ class Client
|
||||
}
|
||||
|
||||
if ($result->ok === 1.0) {
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
return $result->cursor->firstBatch;
|
||||
@@ -714,13 +717,13 @@ class Client
|
||||
|
||||
private function cleanFilters($filters):array {
|
||||
$cleanedFilters = [];
|
||||
|
||||
|
||||
foreach($filters as $k => $v) {
|
||||
$value = $v;
|
||||
|
||||
if(in_array($k, ['$and', '$or', '$nor']) && is_array($v)) {
|
||||
$values = [];
|
||||
|
||||
|
||||
foreach($v as $item) {
|
||||
if(is_null($item)) continue;
|
||||
|
||||
@@ -735,4 +738,4 @@ class Client
|
||||
|
||||
return $cleanedFilters;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace Utopia\Tests;
|
||||
|
||||
use MongoDB\BSON\ObjectId;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Utopia\Mongo\Adapter\SwooleClient;
|
||||
use Utopia\Mongo\Client;
|
||||
use Utopia\Mongo\Exception;
|
||||
|
||||
|
||||
Reference in new issue
Block a user