1
0
Fork 0
mirror of synced 2024-09-30 09:18:14 +13:00

sync with 0.9.x

This commit is contained in:
Torsten Dittmann 2021-06-14 16:54:16 +02:00
parent 3d896af4bb
commit 346b04b94b
4 changed files with 18 additions and 108 deletions

View file

@ -6,6 +6,7 @@ use Appwrite\Database\Adapter\MySQL as MySQLAdapter;
use Appwrite\Database\Adapter\Redis as RedisAdapter; use Appwrite\Database\Adapter\Redis as RedisAdapter;
use Appwrite\Database\Validator\Authorization; use Appwrite\Database\Validator\Authorization;
use Appwrite\Event\Event; use Appwrite\Event\Event;
use Appwrite\Event\Realtime;
use Appwrite\Resque\Worker; use Appwrite\Resque\Worker;
use Cron\CronExpression; use Cron\CronExpression;
use Swoole\Runtime; use Swoole\Runtime;

34
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "399d2426ca92e04b6d6fb84a91c316c3", "content-hash": "ecfe641507c78e5e886eeece09c01d50",
"packages": [ "packages": [
{ {
"name": "adhocore/jwt", "name": "adhocore/jwt",
@ -2713,20 +2713,20 @@
}, },
{ {
"name": "felixfbecker/advanced-json-rpc", "name": "felixfbecker/advanced-json-rpc",
"version": "v3.2.0", "version": "v3.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git",
"reference": "06f0b06043c7438959dbdeed8bb3f699a19be22e" "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/06f0b06043c7438959dbdeed8bb3f699a19be22e", "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447",
"reference": "06f0b06043c7438959dbdeed8bb3f699a19be22e", "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"netresearch/jsonmapper": "^1.0 || ^2.0", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
"php": "^7.1 || ^8.0", "php": "^7.1 || ^8.0",
"phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0"
}, },
@ -2752,9 +2752,9 @@
"description": "A more advanced JSONRPC implementation", "description": "A more advanced JSONRPC implementation",
"support": { "support": {
"issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues",
"source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.0" "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1"
}, },
"time": "2021-01-10T17:48:47+00:00" "time": "2021-06-11T22:34:44+00:00"
}, },
{ {
"name": "felixfbecker/language-server-protocol", "name": "felixfbecker/language-server-protocol",
@ -3003,16 +3003,16 @@
}, },
{ {
"name": "netresearch/jsonmapper", "name": "netresearch/jsonmapper",
"version": "v2.1.0", "version": "v4.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/cweiske/jsonmapper.git", "url": "https://github.com/cweiske/jsonmapper.git",
"reference": "e0f1e33a71587aca81be5cffbb9746510e1fe04e" "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/e0f1e33a71587aca81be5cffbb9746510e1fe04e", "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d",
"reference": "e0f1e33a71587aca81be5cffbb9746510e1fe04e", "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3020,10 +3020,10 @@
"ext-pcre": "*", "ext-pcre": "*",
"ext-reflection": "*", "ext-reflection": "*",
"ext-spl": "*", "ext-spl": "*",
"php": ">=5.6" "php": ">=7.1"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4 || ~7.0", "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0",
"squizlabs/php_codesniffer": "~3.5" "squizlabs/php_codesniffer": "~3.5"
}, },
"type": "library", "type": "library",
@ -3048,9 +3048,9 @@
"support": { "support": {
"email": "cweiske@cweiske.de", "email": "cweiske@cweiske.de",
"issues": "https://github.com/cweiske/jsonmapper/issues", "issues": "https://github.com/cweiske/jsonmapper/issues",
"source": "https://github.com/cweiske/jsonmapper/tree/master" "source": "https://github.com/cweiske/jsonmapper/tree/v4.0.0"
}, },
"time": "2020-04-16T18:48:43+00:00" "time": "2020-12-01T19:48:11+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
@ -6074,5 +6074,5 @@
"platform-overrides": { "platform-overrides": {
"php": "8.0" "php": "8.0"
}, },
"plugin-api-version": "2.1.0" "plugin-api-version": "2.0.0"
} }

View file

@ -1,49 +0,0 @@
<?php
namespace Appwrite\Database\Pool;
use Appwrite\Database\Pool;
use Appwrite\Extend\PDO;
use SplQueue;
class PDOPool extends Pool
{
public function __construct(int $size, string $host = 'localhost', string $schema = 'appwrite', string $user = '', string $pass = '', string $charset = 'utf8mb4')
{
$this->pool = new SplQueue;
$this->size = $size;
for ($i=0; $i < $this->size; $i++) {
$pdo = new PDO(
"mysql:".
"host={$host};".
"dbname={$schema};" .
"charset={$charset}",
$user,
$pass,
[
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4',
PDO::ATTR_TIMEOUT => 3, // Seconds
PDO::ATTR_PERSISTENT => true,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true
]
);
$this->pool->enqueue($pdo);
}
}
public function put (PDO $pdo)
{
$this->pool->enqueue($pdo);
}
public function get (): PDO
{
if ($this->available && count($this->pool) > 0) {
return $this->pool->dequeue();
}
sleep(0.01);
return $this->get();
}
}

View file

@ -1,42 +0,0 @@
<?php
namespace Appwrite\Database\Pool;
use Appwrite\Database\Pool;
use SplQueue;
use Redis;
class RedisPool extends Pool
{
public function __construct(int $size, string $host, int $port, array $auth = [])
{
$this->pool = new SplQueue;
$this->size = $size;
for ($i=0; $i < $this->size; $i++) {
$redis = new Redis();
$redis->pconnect($host, $port);
$redis->setOption(Redis::OPT_READ_TIMEOUT, -1);
if ($auth) {
$redis->auth($auth);
}
$this->pool->enqueue($redis);
}
}
public function put (Redis $redis)
{
$this->pool->enqueue($redis);
}
public function get (): Redis
{
if ($this->available && !$this->pool->isEmpty()) {
return $this->pool->dequeue();
}
sleep(0.1);
return $this->get();
}
}