diff --git a/app/config/collections.php b/app/config/collections.php index 6d1cc81f41..2a01acc8e5 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -1003,7 +1003,7 @@ $collections = [ '$id' => ID::custom('secret'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 512, // var_dump of \bin2hex(\random_bytes(128)) => string(256) doubling for encryption + 'size' => 512, // Output of \bin2hex(\random_bytes(128)) => string(256) doubling for encryption 'signed' => true, 'required' => true, 'default' => null, diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index ace987d726..c3056db574 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -1574,7 +1574,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes') Query::equal('databaseInternalId', [$db->getInternalId()]) ], 61); - $limit = 64 - MariaDB::getCountOfDefaultIndexes(); + $limit = $dbForProject->getLimitForIndexes(); if ($count >= $limit) { throw new Exception(Exception::INDEX_LIMIT_EXCEEDED, 'Index limit exceeded'); diff --git a/app/http.php b/app/http.php index 7b4ac39cef..b497c466f3 100644 --- a/app/http.php +++ b/app/http.php @@ -61,7 +61,6 @@ $http->on('start', function (Server $http) use ($payloadSize, $register) { $app = new App('UTC'); go(function () use ($register, $app) { - $pools = $register->get('pools'); /** @var Group $pools */ App::setResource('pools', fn() => $pools); @@ -119,7 +118,7 @@ $http->on('start', function (Server $http) use ($payloadSize, $register) { /** * Skip to prevent 0.16 migration issues. */ - if (in_array($key, ['cache', 'variables']) && $dbForConsole->exists(App::getEnv('_APP_DB_SCHEMA', 'appwrite'), 'bucket_1')) { + if (in_array($key, ['cache', 'variables']) && $dbForConsole->exists($dbForConsole->getDefaultDatabase(), 'bucket_1')) { continue; } @@ -155,7 +154,7 @@ $http->on('start', function (Server $http) use ($payloadSize, $register) { $dbForConsole->createCollection($key, $attributes, $indexes); } - if ($dbForConsole->getDocument('buckets', 'default')->isEmpty() && !$dbForConsole->exists(App::getEnv('_APP_DB_SCHEMA', 'appwrite'), 'bucket_1')) { + if ($dbForConsole->getDocument('buckets', 'default')->isEmpty() && !$dbForConsole->exists($dbForConsole->getDefaultDatabase(), 'bucket_1')) { Console::success('[Setup] - Creating default bucket...'); $dbForConsole->createDocument('buckets', new Document([ '$id' => ID::custom('default'), diff --git a/app/init.php b/app/init.php index 3a05ea5ddf..09d5ce0589 100644 --- a/app/init.php +++ b/app/init.php @@ -65,7 +65,6 @@ use Utopia\Storage\Device\Wasabi; use Utopia\Cache\Adapter\Redis as RedisCache; use Utopia\Cache\Adapter\Sharding; use Utopia\Cache\Cache; -use Utopia\CLI\Console; use Utopia\Database\Adapter\MariaDB; use Utopia\Database\Adapter\MySQL; use Utopia\Pools\Group; @@ -498,7 +497,6 @@ $register->set('logger', function () { return new Logger($adapter); }); $register->set('pools', function () { - $group = new Group(); $fallbackForDB = AppwriteURL::unparse([ @@ -634,7 +632,6 @@ $register->set('pools', function () { default => null }; - var_dump($dsn->getDatabase()); $adapter->setDefaultDatabase($dsn->getDatabase()); break; @@ -665,12 +662,6 @@ $register->set('pools', function () { Config::setParam('pools-' . $key, $config); } - try { - $group->fill(); - } catch (\Throwable $th) { - Console::error('Connection failure: ' . $th->getMessage()); - } - return $group; }); $register->set('influxdb', function () { diff --git a/app/preload.php b/app/preload.php index 8789936417..4935db3da4 100644 --- a/app/preload.php +++ b/app/preload.php @@ -35,7 +35,7 @@ foreach ( realpath(__DIR__ . '/../vendor/symfony'), realpath(__DIR__ . '/../vendor/mongodb'), realpath(__DIR__ . '/../vendor/utopia-php/websocket'), // TODO: remove workerman autoload - realpath(__DIR__ . '/../vendor/utopia-php/cache'), // TODO: remove memcache autoload + realpath(__DIR__ . '/../vendor/utopia-php/cache'), // TODO: remove memcached autoload ] as $key => $value ) { if ($value !== false) { diff --git a/app/realtime.php b/app/realtime.php index 8cd28c193f..f0a2b6e4a2 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -32,7 +32,6 @@ require_once __DIR__ . '/init.php'; Runtime::enableCoroutine(SWOOLE_HOOK_ALL); - function getConsoleDB(): Database { global $register; diff --git a/app/tasks/specs.php b/app/tasks/specs.php index 8d1bc5039f..b3ac763b39 100644 --- a/app/tasks/specs.php +++ b/app/tasks/specs.php @@ -206,7 +206,7 @@ $cli unset($models[$key]); } } - // var_dump($models); + $arguments = [new App('UTC'), $services, $routes, $models, $keys[$platform], $authCounts[$platform] ?? 0]; foreach (['swagger2', 'open-api3'] as $format) { $formatInstance = match ($format) { diff --git a/composer.json b/composer.json index adc193fcae..1775a2bdf5 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "ext-sockets": "*", "appwrite/php-clamav": "1.1.*", "appwrite/php-runtimes": "0.11.*", - "utopia-php/framework": "0.21.*", + "utopia-php/framework": "0.23.*", "utopia-php/logger": "0.3.*", "utopia-php/abuse": "0.16.*", "utopia-php/analytics": "0.2.*", @@ -56,12 +56,12 @@ "utopia-php/registry": "0.5.*", "utopia-php/preloader": "0.2.*", "utopia-php/domains": "1.1.*", - "utopia-php/swoole": "0.3.*", + "utopia-php/swoole": "0.5.*", "utopia-php/storage": "0.11.*", "utopia-php/websocket": "0.1.0", "utopia-php/image": "0.5.*", "utopia-php/orchestration": "0.6.*", - "utopia-php/pools": "0.1.*", + "utopia-php/pools": "dev-feat-optimize-filling as 0.3.0", "resque/php-resque": "1.3.6", "matomo/device-detector": "6.0.0", "dragonmantank/cron-expression": "3.3.1", diff --git a/composer.lock b/composer.lock index 16709511ab..52153a52de 100644 --- a/composer.lock +++ b/composer.lock @@ -1879,24 +1879,24 @@ }, { "name": "utopia-php/framework", - "version": "0.21.1", + "version": "0.23.4", "source": { "type": "git", "url": "https://github.com/utopia-php/framework.git", - "reference": "c81789b87a917da2daf336738170ebe01f50ea18" + "reference": "97f64aa1732af92b967c3576f16967dc762ad47b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/framework/zipball/c81789b87a917da2daf336738170ebe01f50ea18", - "reference": "c81789b87a917da2daf336738170ebe01f50ea18", + "url": "https://api.github.com/repos/utopia-php/framework/zipball/97f64aa1732af92b967c3576f16967dc762ad47b", + "reference": "97f64aa1732af92b967c3576f16967dc762ad47b", "shasum": "" }, "require": { "php": ">=8.0.0" }, "require-dev": { - "phpunit/phpunit": "^9.5.10", - "vimeo/psalm": "4.13.1" + "phpunit/phpunit": "^9.5.25", + "vimeo/psalm": "^4.27.0" }, "type": "library", "autoload": { @@ -1908,12 +1908,6 @@ "license": [ "MIT" ], - "authors": [ - { - "name": "Eldad Fux", - "email": "eldad@appwrite.io" - } - ], "description": "A simple, light and advanced PHP framework", "keywords": [ "framework", @@ -1922,9 +1916,9 @@ ], "support": { "issues": "https://github.com/utopia-php/framework/issues", - "source": "https://github.com/utopia-php/framework/tree/0.21.1" + "source": "https://github.com/utopia-php/framework/tree/0.23.4" }, - "time": "2022-09-07T09:56:28+00:00" + "time": "2022-10-31T11:57:14+00:00" }, { "name": "utopia-php/image", @@ -2152,23 +2146,24 @@ }, { "name": "utopia-php/pools", - "version": "0.1.0", + "version": "dev-feat-optimize-filling", "source": { "type": "git", "url": "https://github.com/utopia-php/pools.git", - "reference": "5a467a569a80aefc846a97dc195b4adc2fd71805" + "reference": "be603898142f55df9db5058f81a610ead7769d7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/pools/zipball/5a467a569a80aefc846a97dc195b4adc2fd71805", - "reference": "5a467a569a80aefc846a97dc195b4adc2fd71805", + "url": "https://api.github.com/repos/utopia-php/pools/zipball/be603898142f55df9db5058f81a610ead7769d7d", + "reference": "be603898142f55df9db5058f81a610ead7769d7d", "shasum": "" }, "require": { "ext-mongodb": "*", "ext-pdo": "*", "ext-redis": "*", - "php": ">=8.0" + "php": ">=8.0", + "utopia-php/cli": "^0.13.0" }, "require-dev": { "phpunit/phpunit": "^9.4", @@ -2199,9 +2194,9 @@ ], "support": { "issues": "https://github.com/utopia-php/pools/issues", - "source": "https://github.com/utopia-php/pools/tree/0.1.0" + "source": "https://github.com/utopia-php/pools/tree/feat-optimize-filling" }, - "time": "2022-10-11T19:31:07+00:00" + "time": "2022-11-03T18:50:28+00:00" }, { "name": "utopia-php/preloader", @@ -2365,16 +2360,16 @@ }, { "name": "utopia-php/swoole", - "version": "0.3.3", + "version": "0.5.0", "source": { "type": "git", "url": "https://github.com/utopia-php/swoole.git", - "reference": "8312df69233b5dcd3992de88f131f238002749de" + "reference": "c2a3a4f944a2f22945af3cbcb95b13f0769628b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/swoole/zipball/8312df69233b5dcd3992de88f131f238002749de", - "reference": "8312df69233b5dcd3992de88f131f238002749de", + "url": "https://api.github.com/repos/utopia-php/swoole/zipball/c2a3a4f944a2f22945af3cbcb95b13f0769628b1", + "reference": "c2a3a4f944a2f22945af3cbcb95b13f0769628b1", "shasum": "" }, "require": { @@ -2383,6 +2378,7 @@ "utopia-php/framework": "0.*.*" }, "require-dev": { + "laravel/pint": "1.2.*", "phpunit/phpunit": "^9.3", "swoole/ide-helper": "4.8.3", "vimeo/psalm": "4.15.0" @@ -2397,12 +2393,6 @@ "license": [ "MIT" ], - "authors": [ - { - "name": "Eldad Fux", - "email": "team@appwrite.io" - } - ], "description": "An extension for Utopia Framework to work with PHP Swoole as a PHP FPM alternative", "keywords": [ "framework", @@ -2415,9 +2405,9 @@ ], "support": { "issues": "https://github.com/utopia-php/swoole/issues", - "source": "https://github.com/utopia-php/swoole/tree/0.3.3" + "source": "https://github.com/utopia-php/swoole/tree/0.5.0" }, - "time": "2022-01-20T09:58:43+00:00" + "time": "2022-10-19T22:19:07+00:00" }, { "name": "utopia-php/system", @@ -5127,7 +5117,7 @@ ], "minimum-stability": "stable", "stability-flags": { - "utopia-php/database": 20 + "utopia-php/pools": 20 }, "prefer-stable": false, "prefer-lowest": false, @@ -5152,5 +5142,5 @@ "platform-overrides": { "php": "8.0" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/docker-compose.yml b/docker-compose.yml index f7229ce27b..34a9d5993c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -84,7 +84,6 @@ services: - ./public:/usr/src/code/public - ./src:/usr/src/code/src - ./dev:/usr/local/dev - - ./vendor/utopia-php/framework:/usr/src/code/vendor/utopia-php/framework depends_on: - mariadb - redis @@ -361,7 +360,6 @@ services: volumes: - ./app:/usr/src/code/app - ./src:/usr/src/code/src - #- ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database depends_on: - redis - mariadb @@ -619,7 +617,6 @@ services: volumes: - ./app:/usr/src/code/app - ./src:/usr/src/code/src - #- ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database depends_on: - redis environment: