From bfdcd13f80beb7ba42a49f5a085ade45b3fe8c65 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 14:11:45 +0530 Subject: [PATCH 01/96] add postges installtion command --- .env | 1 + app/init/registers.php | 28 ++++++++++++++++++---- app/views/install/compose.phtml | 24 +++++++++++++++++-- composer.lock | 12 +++++----- src/Appwrite/Platform/Tasks/Install.php | 31 +++++++++++++++++++++---- src/Appwrite/Platform/Tasks/Upgrade.php | 7 +++--- 6 files changed, 83 insertions(+), 20 deletions(-) diff --git a/.env b/.env index 89b76cb740..35ad688f4a 100644 --- a/.env +++ b/.env @@ -29,6 +29,7 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_PASS= _APP_REDIS_USER= +_APP_DB_SCHEME=postgresql _APP_DB_HOST=mariadb _APP_DB_PORT=3306 _APP_DB_SCHEMA=appwrite diff --git a/app/init/registers.php b/app/init/registers.php index 1adaaf35ce..020335abce 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -14,6 +14,7 @@ use Utopia\CLI\Console; use Utopia\Config\Config; use Utopia\Database\Adapter\MariaDB; use Utopia\Database\Adapter\MySQL; +use Utopia\Database\Adapter\Postgres; use Utopia\Database\Adapter\SQL; use Utopia\Database\PDO; use Utopia\Domains\Validator\PublicDomain; @@ -120,19 +121,19 @@ $register->set('pools', function () { 'type' => 'database', 'dsns' => $fallbackForDB, 'multiple' => false, - 'schemes' => ['mariadb', 'mysql'], + 'schemes' => ['mariadb', 'mysql','postgresql'], ], 'database' => [ 'type' => 'database', 'dsns' => $fallbackForDB, 'multiple' => true, - 'schemes' => ['mariadb', 'mysql'], + 'schemes' => ['mariadb', 'mysql','postgresql'], ], 'logs' => [ 'type' => 'database', 'dsns' => System::getEnv('_APP_CONNECTIONS_DB_LOGS', $fallbackForDB), 'multiple' => false, - 'schemes' => ['mariadb', 'mysql'], + 'schemes' => ['mariadb', 'mysql','postgresql'], ], 'publisher' => [ 'type' => 'publisher', @@ -225,6 +226,17 @@ $register->set('pools', function () { )); }); }, + 'postgresql' => function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { + return new PDOProxy(function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { + return new PDO("pgsql:host={$dsnHost};port={$dsnPort};dbname={$dsnDatabase}", $dsnUser, $dsnPass, array( + \PDO::ATTR_TIMEOUT => 3, // Seconds + \PDO::ATTR_PERSISTENT => false, + \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC, + \PDO::ATTR_EMULATE_PREPARES => true, + \PDO::ATTR_STRINGIFY_FETCHES => true + )); + }); + }, 'redis' => function () use ($dsnHost, $dsnPort, $dsnPass) { $redis = new \Redis(); @$redis->pconnect($dsnHost, (int)$dsnPort); @@ -245,6 +257,7 @@ $register->set('pools', function () { $adapter = match ($dsn->getScheme()) { 'mariadb' => new MariaDB($resource()), 'mysql' => new MySQL($resource()), + 'postgresql' => new Postgres($resource), default => null }; @@ -286,10 +299,15 @@ $register->set('db', function () { $dbPort = System::getEnv('_APP_DB_PORT', ''); $dbUser = System::getEnv('_APP_DB_USER', ''); $dbPass = System::getEnv('_APP_DB_PASS', ''); - $dbScheme = System::getEnv('_APP_DB_SCHEMA', ''); + $dbSchema = System::getEnv('_APP_DB_SCHEMA', ''); + $dbScheme = System::getEnv('_APP_DB_SCHEME', 'mariadb'); + $dsn = ($dbScheme === 'postgresql') + ? "pgsql:host={$dbHost};port={$dbPort};dbname={$dbSchema}" + : "mysql:host={$dbHost};port={$dbPort};dbname={$dbSchema};charset=utf8mb4"; + return new PDO( - "mysql:host={$dbHost};port={$dbPort};dbname={$dbScheme};charset=utf8mb4", + $dsn, $dbUser, $dbPass, SQL::getPDOAttributes() diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 816f88299b..88cffdcc8b 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -66,8 +66,12 @@ $image = $this->getParam('image', ''); - appwrite-certificates:/storage/certificates:rw - appwrite-functions:/storage/functions:rw depends_on: - - mariadb - redis + getParam('_APP_DB_SCHEME', 'mariadb') === 'mariadb'): ?> + - mariadb + + - postgres + # - clamav environment: - _APP_ENV @@ -100,6 +104,7 @@ $image = $this->getParam('image', ''); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_SCHEME - _APP_SMTP_HOST - _APP_SMTP_PORT - _APP_SMTP_SECURE @@ -211,8 +216,8 @@ $image = $this->getParam('image', ''); networks: - appwrite depends_on: - - mariadb - redis + - mariadb environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -897,6 +902,20 @@ $image = $this->getParam('image', ''); - MARIADB_AUTO_UPGRADE=1 command: 'mysqld --innodb-flush-method=fsync' + postgres: + image: postgres:15-alpine + container_name: appwrite-postgres + <<: *x-logging + restart: unless-stopped + networks: + - appwrite + volumes: + - appwrite-postgres:/var/lib/postgresql/data:rw + environment: + - POSTGRES_DB=${_APP_DB_SCHEMA} + - POSTGRES_USER=${_APP_DB_USER} + - POSTGRES_PASSWORD=${_APP_DB_PASS} + redis: image: redis:7.2.4-alpine container_name: appwrite-redis @@ -938,3 +957,4 @@ volumes: appwrite-functions: appwrite-builds: appwrite-config: + appwrite-postgres: diff --git a/composer.lock b/composer.lock index e108e45171..a26a3751dd 100644 --- a/composer.lock +++ b/composer.lock @@ -3499,16 +3499,16 @@ }, { "name": "utopia-php/database", - "version": "0.69.2", + "version": "0.69.3", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "60591ab073bb80bb9843338754b679bb8169e4ed" + "reference": "1f48ccc939199a9bf45c68d44dcfbc2b5dfdb5a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/60591ab073bb80bb9843338754b679bb8169e4ed", - "reference": "60591ab073bb80bb9843338754b679bb8169e4ed", + "url": "https://api.github.com/repos/utopia-php/database/zipball/1f48ccc939199a9bf45c68d44dcfbc2b5dfdb5a7", + "reference": "1f48ccc939199a9bf45c68d44dcfbc2b5dfdb5a7", "shasum": "" }, "require": { @@ -3549,9 +3549,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.69.2" + "source": "https://github.com/utopia-php/database/tree/0.69.3" }, - "time": "2025-05-14T07:51:44+00:00" + "time": "2025-05-16T05:54:54+00:00" }, { "name": "utopia-php/domains", diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 4abd267684..c157374893 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -31,16 +31,25 @@ class Install extends Action ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart)); + ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) + ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); } - public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void + public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart, string $database): void { $config = Config::getParam('variables'); $defaultHTTPPort = '80'; $defaultHTTPSPort = '443'; /** @var array> $vars array whre key is variable name and value is variable */ $vars = []; + $vars['_APP_DB_SCHEME'] = [ + 'name' => '_APP_DB_SCHEME', + 'default' => $database, + 'required' => false, + 'filter' => '', + 'overwrite' => true, + 'question' => 'Choose your database (mariadb|postgresql)', + ]; foreach ($config as $category) { foreach ($category['variables'] ?? [] as $var) { @@ -171,6 +180,19 @@ class Install extends Action continue; } + if ($var['name'] === '_APP_DB_SCHEME') { + $input[$var['name']] = Console::confirm('Choose your database (mariadb|postgresql): (default: ' . $var['default'] . ')'); + if (empty($input[$var['name']])) { + $input[$var['name']] = $var['default']; + } + if (!in_array($input[$var['name']], ['mariadb', 'postgresql'])) { + Console::error('Invalid database choice. Please choose either mariadb or postgresql.'); + Console::exit(1); + } + $database = $input[$var['name']]; + continue; + } + $input[$var['name']] = Console::confirm($var['question'] . ' (default: \'' . $var['default'] . '\')'); if (empty($input[$var['name']])) { @@ -196,8 +218,9 @@ class Install extends Action ->setParam('httpsPort', $httpsPort) ->setParam('version', APP_VERSION_STABLE) ->setParam('organization', $organization) - ->setParam('image', $image); - + ->setParam('image', $image) + ->setParam('database',$database); + $input['_APP_DB_SCHEME'] = $database; $templateForEnv->setParam('vars', $input); if (!file_put_contents($this->path . '/docker-compose.yml', $templateForCompose->render(false))) { diff --git a/src/Appwrite/Platform/Tasks/Upgrade.php b/src/Appwrite/Platform/Tasks/Upgrade.php index 341ce42fc4..5f4b625462 100644 --- a/src/Appwrite/Platform/Tasks/Upgrade.php +++ b/src/Appwrite/Platform/Tasks/Upgrade.php @@ -23,10 +23,11 @@ class Upgrade extends Install ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart)); + ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) + ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); } - public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void + public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart, string $database): void { // Check for previous installation $data = @file_get_contents($this->path . '/docker-compose.yml'); @@ -39,6 +40,6 @@ class Upgrade extends Install Console::log(' └── docker-compose.yml'); Console::exit(1); } - parent::action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart); + parent::action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database); } } From 083e490cc20759f7d33c04d167d91d455ad0a811 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 16:19:20 +0530 Subject: [PATCH 02/96] updated compose file and installation script --- .env | 2 +- app/views/install/compose.phtml | 48 ++++++++++++------------- src/Appwrite/Platform/Tasks/Install.php | 44 ++++++++++------------- 3 files changed, 43 insertions(+), 51 deletions(-) diff --git a/.env b/.env index 35ad688f4a..e79f745ddc 100644 --- a/.env +++ b/.env @@ -29,7 +29,7 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_PASS= _APP_REDIS_USER= -_APP_DB_SCHEME=postgresql +_APP_DB_SCHEME=mariadb _APP_DB_HOST=mariadb _APP_DB_PORT=3306 _APP_DB_SCHEMA=appwrite diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 88cffdcc8b..bf27311df5 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -11,6 +11,7 @@ $httpsPort = $this->getParam('httpsPort', ''); $version = $this->getParam('version', ''); $organization = $this->getParam('organization', ''); $image = $this->getParam('image', ''); +$dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' : 'postgresql'; ?>services: traefik: image: traefik:2.11 @@ -67,11 +68,7 @@ $image = $this->getParam('image', ''); - appwrite-functions:/storage/functions:rw depends_on: - redis - getParam('_APP_DB_SCHEME', 'mariadb') === 'mariadb'): ?> - - mariadb - - - postgres - + - # - clamav environment: - _APP_ENV @@ -217,7 +214,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -246,7 +243,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -272,7 +269,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -300,7 +297,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - volumes: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw @@ -362,7 +359,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -388,7 +385,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - volumes: - appwrite-functions:/storage/functions:rw - appwrite-builds:/storage/builds:rw @@ -452,7 +449,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - volumes: - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw @@ -485,7 +482,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - - openruntimes-executor environment: - _APP_ENV @@ -523,6 +520,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -559,6 +557,7 @@ $image = $this->getParam('image', ''); - appwrite-uploads:/storage/uploads:rw depends_on: - redis + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -607,7 +606,7 @@ $image = $this->getParam('image', ''); networks: - appwrite depends_on: - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -638,6 +637,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -675,7 +675,7 @@ $image = $this->getParam('image', ''); - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -704,7 +704,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -732,7 +732,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -759,7 +759,7 @@ $image = $this->getParam('image', ''); networks: - appwrite depends_on: - - mariadb + - - redis environment: - _APP_ENV @@ -784,7 +784,7 @@ $image = $this->getParam('image', ''); networks: - appwrite depends_on: - - mariadb + - - redis environment: - _APP_ENV @@ -809,7 +809,7 @@ $image = $this->getParam('image', ''); networks: - appwrite depends_on: - - mariadb + - - redis environment: - _APP_ENV @@ -902,15 +902,15 @@ $image = $this->getParam('image', ''); - MARIADB_AUTO_UPGRADE=1 command: 'mysqld --innodb-flush-method=fsync' - postgres: + postgresql: image: postgres:15-alpine - container_name: appwrite-postgres + container_name: appwrite-postgresql <<: *x-logging restart: unless-stopped networks: - appwrite volumes: - - appwrite-postgres:/var/lib/postgresql/data:rw + - appwrite-postgresql:/var/lib/postgresql/data:rw environment: - POSTGRES_DB=${_APP_DB_SCHEMA} - POSTGRES_USER=${_APP_DB_USER} @@ -957,4 +957,4 @@ volumes: appwrite-functions: appwrite-builds: appwrite-config: - appwrite-postgres: + appwrite-postgresql: diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index c157374893..bc1ee40362 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -31,7 +31,7 @@ class Install extends Action ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) + ->param('database', '', new Text(0), 'Database to use (mariadb|postgresql)', true) ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); } @@ -45,7 +45,7 @@ class Install extends Action $vars['_APP_DB_SCHEME'] = [ 'name' => '_APP_DB_SCHEME', 'default' => $database, - 'required' => false, + 'required' => true, 'filter' => '', 'overwrite' => true, 'question' => 'Choose your database (mariadb|postgresql)', @@ -59,13 +59,6 @@ class Install extends Action Console::success('Starting Appwrite installation...'); - // Create directory with write permissions - if (!\file_exists(\dirname($this->path))) { - if (!@\mkdir(\dirname($this->path), 0755, true)) { - Console::error('Can\'t create directory ' . \dirname($this->path)); - Console::exit(1); - } - } $data = @file_get_contents($this->path . '/docker-compose.yml'); @@ -146,6 +139,18 @@ class Install extends Action } } + // if ($interactive == 'Y' && Console::isInteractive()) { + // $dbChoice = Console::confirm('Choose your database (mariadb|postgresql): (default: ' . $database . ')'); + // if (!empty($dbChoice)) { + // $database = $dbChoice; + // if (!in_array($database, ['mariadb', 'postgresql'])) { + // Console::error('Invalid database choice. Please choose either mariadb or postgresql.'); + // Console::exit(1); + // } + // } + // $vars['_APP_DB_SCHEME']['default'] = $database; + // } + if (empty($httpPort)) { $httpPort = Console::confirm('Choose your server HTTP port: (default: ' . $defaultHTTPPort . ')'); $httpPort = ($httpPort) ? $httpPort : $defaultHTTPPort; @@ -180,19 +185,6 @@ class Install extends Action continue; } - if ($var['name'] === '_APP_DB_SCHEME') { - $input[$var['name']] = Console::confirm('Choose your database (mariadb|postgresql): (default: ' . $var['default'] . ')'); - if (empty($input[$var['name']])) { - $input[$var['name']] = $var['default']; - } - if (!in_array($input[$var['name']], ['mariadb', 'postgresql'])) { - Console::error('Invalid database choice. Please choose either mariadb or postgresql.'); - Console::exit(1); - } - $database = $input[$var['name']]; - continue; - } - $input[$var['name']] = Console::confirm($var['question'] . ' (default: \'' . $var['default'] . '\')'); if (empty($input[$var['name']])) { @@ -209,18 +201,18 @@ class Install extends Action } } } + $database = $input['_APP_DB_SCHEME']; $templateForCompose = new View(__DIR__ . '/../../../../app/views/install/compose.phtml'); $templateForEnv = new View(__DIR__ . '/../../../../app/views/install/env.phtml'); - $templateForCompose ->setParam('httpPort', $httpPort) ->setParam('httpsPort', $httpsPort) ->setParam('version', APP_VERSION_STABLE) ->setParam('organization', $organization) ->setParam('image', $image) - ->setParam('database',$database); - $input['_APP_DB_SCHEME'] = $database; + ->setParam('database', $database); + $templateForEnv->setParam('vars', $input); if (!file_put_contents($this->path . '/docker-compose.yml', $templateForCompose->render(false))) { @@ -261,4 +253,4 @@ class Install extends Action Console::success($message); } } -} +} \ No newline at end of file From f846e417fcb00896caa0f87d45617840b4cd8468 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 16:19:37 +0530 Subject: [PATCH 03/96] linting --- src/Appwrite/Platform/Tasks/Install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index bc1ee40362..43c5289f02 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -253,4 +253,4 @@ class Install extends Action Console::success($message); } } -} \ No newline at end of file +} From 5f7afa25ce4fa92a8ecd79ad0be87266b6bac2ee Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 17:01:18 +0530 Subject: [PATCH 04/96] added conditonal for .env for mariadb and psotgres --- src/Appwrite/Platform/Tasks/Install.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 43c5289f02..d18f6b7c88 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -31,7 +31,7 @@ class Install extends Action ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->param('database', '', new Text(0), 'Database to use (mariadb|postgresql)', true) + ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); } @@ -139,17 +139,6 @@ class Install extends Action } } - // if ($interactive == 'Y' && Console::isInteractive()) { - // $dbChoice = Console::confirm('Choose your database (mariadb|postgresql): (default: ' . $database . ')'); - // if (!empty($dbChoice)) { - // $database = $dbChoice; - // if (!in_array($database, ['mariadb', 'postgresql'])) { - // Console::error('Invalid database choice. Please choose either mariadb or postgresql.'); - // Console::exit(1); - // } - // } - // $vars['_APP_DB_SCHEME']['default'] = $database; - // } if (empty($httpPort)) { $httpPort = Console::confirm('Choose your server HTTP port: (default: ' . $defaultHTTPPort . ')'); @@ -202,6 +191,13 @@ class Install extends Action } } $database = $input['_APP_DB_SCHEME']; + if ($database === 'postgresql') { + $input['_APP_DB_HOST'] = 'postgresql'; + $input['_APP_DB_PORT'] = 5432; + } elseif ($database === 'mariadb') { + $input['_APP_DB_HOST'] = 'mariadb'; + $input['_APP_DB_PORT'] = 3306; + } $templateForCompose = new View(__DIR__ . '/../../../../app/views/install/compose.phtml'); $templateForEnv = new View(__DIR__ . '/../../../../app/views/install/env.phtml'); From 26c3248375115f40eb841f065bfa68e89029e33b Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 17:53:44 +0530 Subject: [PATCH 05/96] used env var in the registers for the pool --- app/init/registers.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/init/registers.php b/app/init/registers.php index 020335abce..61e69d1952 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -99,9 +99,10 @@ $register->set('logger', function () { $register->set('pools', function () { $group = new Group(); + $dbScheme = System::getEnv('_APP_DB_SCHEME', 'mariadb'); $fallbackForDB = 'db_main=' . AppwriteURL::unparse([ - 'scheme' => 'mariadb', + 'scheme' => $dbScheme, 'host' => System::getEnv('_APP_DB_HOST', 'mariadb'), 'port' => System::getEnv('_APP_DB_PORT', '3306'), 'user' => System::getEnv('_APP_DB_USER', ''), From 9f22ab4ef5c14660ae78c787ae35296533403c85 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 18:07:17 +0530 Subject: [PATCH 06/96] added the callable resource in the pg adapter --- app/init/registers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/init/registers.php b/app/init/registers.php index 61e69d1952..a7632888c8 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -258,7 +258,7 @@ $register->set('pools', function () { $adapter = match ($dsn->getScheme()) { 'mariadb' => new MariaDB($resource()), 'mysql' => new MySQL($resource()), - 'postgresql' => new Postgres($resource), + 'postgresql' => new Postgres($resource()), default => null }; From 2460f0cb368b131fac4972c665511f8edca56300 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 19:50:42 +0530 Subject: [PATCH 07/96] updated composer lock --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index a26a3751dd..4ba9694eaf 100644 --- a/composer.lock +++ b/composer.lock @@ -3499,16 +3499,16 @@ }, { "name": "utopia-php/database", - "version": "0.69.3", + "version": "0.69.4", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "1f48ccc939199a9bf45c68d44dcfbc2b5dfdb5a7" + "reference": "31f913a9c5c363e6427e69a0b8bbb9b8d901e061" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/1f48ccc939199a9bf45c68d44dcfbc2b5dfdb5a7", - "reference": "1f48ccc939199a9bf45c68d44dcfbc2b5dfdb5a7", + "url": "https://api.github.com/repos/utopia-php/database/zipball/31f913a9c5c363e6427e69a0b8bbb9b8d901e061", + "reference": "31f913a9c5c363e6427e69a0b8bbb9b8d901e061", "shasum": "" }, "require": { @@ -3549,9 +3549,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.69.3" + "source": "https://github.com/utopia-php/database/tree/0.69.4" }, - "time": "2025-05-16T05:54:54+00:00" + "time": "2025-05-16T13:51:43+00:00" }, { "name": "utopia-php/domains", From 78de031c74f2f0972ec9e4e3d9f534099eba090a Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 21:07:47 +0530 Subject: [PATCH 08/96] added changes --- app/config/variables.php | 9 +++++++++ app/init/registers.php | 3 +-- app/views/install/compose.phtml | 18 +++++++++++++----- src/Appwrite/Platform/Tasks/Install.php | 9 ++++++++- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index f79d4cb517..8afef87c46 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -294,6 +294,15 @@ return [ 'required' => false, 'question' => '', 'filter' => '' + ], + [ + 'name' => '_APP_DB_SCHEME', + 'description' => 'To switch between mariadb and postgresql', + 'introduction' => '1.6.0', + 'default' => 'mariadb', + 'required' => true, + 'question' => 'Choose your database (mariadb|postgresql)', + 'filter' => '' ] ], ], diff --git a/app/init/registers.php b/app/init/registers.php index a7632888c8..8c293628e3 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -99,10 +99,9 @@ $register->set('logger', function () { $register->set('pools', function () { $group = new Group(); - $dbScheme = System::getEnv('_APP_DB_SCHEME', 'mariadb'); $fallbackForDB = 'db_main=' . AppwriteURL::unparse([ - 'scheme' => $dbScheme, + 'scheme' => System::getEnv('_APP_DB_SCHEME', 'mariadb'), 'host' => System::getEnv('_APP_DB_HOST', 'mariadb'), 'port' => System::getEnv('_APP_DB_PORT', '3306'), 'user' => System::getEnv('_APP_DB_USER', ''), diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index bf27311df5..e8af80df3f 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -11,7 +11,7 @@ $httpsPort = $this->getParam('httpsPort', ''); $version = $this->getParam('version', ''); $organization = $this->getParam('organization', ''); $image = $this->getParam('image', ''); -$dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' : 'postgresql'; +$dbService = $this->getParam('database'); ?>services: traefik: image: traefik:2.11 @@ -885,10 +885,12 @@ $dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' : - OPR_EXECUTOR_STORAGE_WASABI_REGION=$_APP_STORAGE_WASABI_REGION - OPR_EXECUTOR_STORAGE_WASABI_BUCKET=$_APP_STORAGE_WASABI_BUCKET + + + mariadb: - image: mariadb:10.11 # fix issues when upgrading using: mysql_upgrade -u root -p + image: mariadb:10.11 container_name: appwrite-mariadb - <<: *x-logging restart: unless-stopped networks: - appwrite @@ -902,10 +904,11 @@ $dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' : - MARIADB_AUTO_UPGRADE=1 command: 'mysqld --innodb-flush-method=fsync' + + postgresql: image: postgres:15-alpine container_name: appwrite-postgresql - <<: *x-logging restart: unless-stopped networks: - appwrite @@ -916,6 +919,8 @@ $dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' : - POSTGRES_USER=${_APP_DB_USER} - POSTGRES_PASSWORD=${_APP_DB_PASS} + + redis: image: redis:7.2.4-alpine container_name: appwrite-redis @@ -949,7 +954,11 @@ networks: name: runtimes volumes: + appwrite-mariadb: + + appwrite-postgresql: + appwrite-redis: appwrite-cache: appwrite-uploads: @@ -957,4 +966,3 @@ volumes: appwrite-functions: appwrite-builds: appwrite-config: - appwrite-postgresql: diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index d18f6b7c88..7d13973003 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -32,7 +32,7 @@ class Install extends Action ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) - ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); + ->callback($this->action(...)); } public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart, string $database): void @@ -59,6 +59,13 @@ class Install extends Action Console::success('Starting Appwrite installation...'); + // Create directory with write permissions + if (!\file_exists(\dirname($this->path))) { + if (!@\mkdir(\dirname($this->path), 0755, true)) { + Console::error('Can\'t create directory ' . \dirname($this->path)); + Console::exit(1); + } + } $data = @file_get_contents($this->path . '/docker-compose.yml'); From e1207caee0395ce3e6b84f329ecec401736f9060 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 23:33:21 +0530 Subject: [PATCH 09/96] updated the environment of the services in the docker compose of install --- app/views/install/compose.phtml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index e8af80df3f..f0e282b876 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -216,6 +216,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPTIONS_ABUSE @@ -245,6 +246,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -271,6 +273,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -305,6 +308,7 @@ $dbService = $this->getParam('database'); - appwrite-builds:/storage/builds:rw - appwrite-certificates:/storage/certificates:rw environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -361,6 +365,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -390,6 +395,7 @@ $dbService = $this->getParam('database'); - appwrite-functions:/storage/functions:rw - appwrite-builds:/storage/builds:rw environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -454,6 +460,7 @@ $dbService = $this->getParam('database'); - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -485,6 +492,7 @@ $dbService = $this->getParam('database'); - - openruntimes-executor environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -522,6 +530,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -559,6 +568,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -608,6 +618,7 @@ $dbService = $this->getParam('database'); depends_on: - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -639,6 +650,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN @@ -677,6 +689,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -706,6 +719,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -734,6 +748,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -762,6 +777,7 @@ $dbService = $this->getParam('database'); - - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -787,6 +803,7 @@ $dbService = $this->getParam('database'); - - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -812,6 +829,7 @@ $dbService = $this->getParam('database'); - - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 From e88aebd4ad5603cc623b91f93e0d3fb0ddb2c49b Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Sat, 17 May 2025 00:05:11 +0530 Subject: [PATCH 10/96] added upgrade limit for db --- src/Appwrite/Platform/Tasks/Install.php | 4 ++++ src/Appwrite/Platform/Tasks/Upgrade.php | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 7d13973003..1ac2fbac5f 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -181,6 +181,10 @@ class Install extends Action continue; } + if ($var['name'] === '_APP_DB_SCHEME' && $data !== false) { + continue; + } + $input[$var['name']] = Console::confirm($var['question'] . ' (default: \'' . $var['default'] . '\')'); if (empty($input[$var['name']])) { diff --git a/src/Appwrite/Platform/Tasks/Upgrade.php b/src/Appwrite/Platform/Tasks/Upgrade.php index 5f4b625462..ecf71d27a1 100644 --- a/src/Appwrite/Platform/Tasks/Upgrade.php +++ b/src/Appwrite/Platform/Tasks/Upgrade.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Tasks; use Utopia\CLI\Console; +use Utopia\System\System; use Utopia\Validator\Boolean; use Utopia\Validator\Text; @@ -23,8 +24,8 @@ class Upgrade extends Install ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) - ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); + ->param('database', 'mariadb', new Text(length: 0), 'Database to use (mariadb|postgresql)', true) + ->callback($this->action(...)); } public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart, string $database): void @@ -40,6 +41,7 @@ class Upgrade extends Install Console::log(' └── docker-compose.yml'); Console::exit(1); } + $database = System::getEnv('_APP_DB_SCHEME', 'mariadb'); parent::action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database); } } From e45befbdf20cd85229d91bb23b9a5a1789cb6374 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 20 May 2025 14:46:50 +0530 Subject: [PATCH 11/96] updated local docker for ci test on github actions and tests yml --- .github/workflows/tests.yml | 26 +++++++++++++++++++++++ app/views/install/compose.phtml | 3 ++- docker-compose.yml | 37 +++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6fd4e89858..ccd287ec04 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -141,6 +141,11 @@ jobs: strategy: fail-fast: false matrix: + db_adapter:[ + MARIADB + POSTGRESQL, + ] + service: [ Account, Avatars, @@ -192,12 +197,33 @@ jobs: - name: Run ${{ matrix.service }} tests with Project table mode run: | echo "Using project tables" + export _APP_DATABASE_SHARED_TABLES= export _APP_DATABASE_SHARED_TABLES_V1= + # Set DB Adapter Specific ENV Vars using if-elif + if [ "${{ matrix.db_adapter }}" = "MARIADB" ]; then + export _APP_DB_SCHEME=mariadb + export _APP_DB_HOST=mariadb + export _APP_DB_PORT=3306 + export _APP_DB_SCHEMA=appwrite + elif [ "${{ matrix.db_adapter }}" = "POSTGRESQL" ]; then + export _APP_DB_SCHEME=postgresql + export _APP_DB_HOST=postgresql + export _APP_DB_PORT=5432 + export _APP_DB_SCHEMA=appwrite + else + echo "Unknown DB adapter: ${{ matrix.db_adapter }}" + exit 1 + fi + docker compose exec -T \ -e _APP_DATABASE_SHARED_TABLES \ -e _APP_DATABASE_SHARED_TABLES_V1 \ + -e _APP_DB_SCHEME \ + -e _APP_DB_HOST \ + -e _APP_DB_PORT \ + -e _APP_DB_SCHEMA \ appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude=devKeys e2e_shared_mode_test: diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 66214a67bd..b916849137 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -955,7 +955,7 @@ $dbService = $this->getParam('database'); postgresql: - image: postgres:15-alpine + image: postgres:15 container_name: appwrite-postgresql restart: unless-stopped networks: @@ -966,6 +966,7 @@ $dbService = $this->getParam('database'); - POSTGRES_DB=${_APP_DB_SCHEMA} - POSTGRES_USER=${_APP_DB_USER} - POSTGRES_PASSWORD=${_APP_DB_PASS} + command: "postgres" diff --git a/docker-compose.yml b/docker-compose.yml index 7b0eca52a1..46f8ea6426 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -86,6 +86,7 @@ services: - ./public:/usr/src/code/public - ./src:/usr/src/code/src - ./dev:/usr/src/code/dev + - ./.env:/usr/src/code/.env depends_on: - mariadb - redis @@ -95,6 +96,7 @@ services: - -e - app/http.php environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_EDITION - _APP_WORKER_PER_CORE @@ -263,6 +265,7 @@ services: - mariadb - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPTIONS_ABUSE @@ -295,6 +298,7 @@ services: - redis - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -325,6 +329,7 @@ services: - mariadb - request-catcher environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -362,6 +367,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -419,6 +425,7 @@ services: - redis - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -454,6 +461,7 @@ services: - redis - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -524,6 +532,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -560,6 +569,7 @@ services: - mariadb - openruntimes-executor environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -603,6 +613,7 @@ services: - maildev # - smtp environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -637,6 +648,7 @@ services: depends_on: - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -693,6 +705,7 @@ services: depends_on: - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -728,6 +741,7 @@ services: depends_on: - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN @@ -770,6 +784,7 @@ services: - redis - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -801,6 +816,7 @@ services: - redis - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -832,6 +848,7 @@ services: - redis - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -863,6 +880,7 @@ services: - mariadb - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -891,6 +909,7 @@ services: - mariadb - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -918,6 +937,7 @@ services: - mariadb - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -1038,6 +1058,22 @@ services: - MARIADB_AUTO_UPGRADE=1 command: "mysqld --innodb-flush-method=fsync" + postgresql: + image: postgres:15 + container_name: appwrite-postgresql + <<: *x-logging + networks: + - appwrite + volumes: + - appwrite-postgresql:/var/lib/postgresql/data:rw + ports: + - "5432:5432" + environment: + - POSTGRES_DB=${_APP_DB_SCHEMA} + - POSTGRES_USER=${_APP_DB_USER} + - POSTGRES_PASSWORD=${_APP_DB_PASS} + command: "postgres" + redis: image: redis:7.2.4-alpine <<: *x-logging @@ -1127,6 +1163,7 @@ networks: volumes: appwrite-mariadb: + appwrite-postgresql: appwrite-redis: appwrite-cache: appwrite-uploads: From 60be48268ce8bad838892dec04361c407f98122e Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 20 May 2025 15:35:12 +0530 Subject: [PATCH 12/96] changed the depends on to scheme --- docker-compose.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 46f8ea6426..8b824d047e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -88,7 +88,7 @@ services: - ./dev:/usr/src/code/dev - ./.env:/usr/src/code/.env depends_on: - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - redis # - clamav entrypoint: @@ -262,7 +262,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - redis environment: - _APP_DB_SCHEME @@ -296,7 +296,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -326,7 +326,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - request-catcher environment: - _APP_DB_SCHEME @@ -356,7 +356,7 @@ services: - appwrite depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} volumes: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw @@ -423,7 +423,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -459,7 +459,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -525,7 +525,7 @@ services: - appwrite depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} volumes: - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw @@ -566,7 +566,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - openruntimes-executor environment: - _APP_DB_SCHEME @@ -703,7 +703,7 @@ services: - ./src:/usr/src/code/src - ./tests:/usr/src/code/tests depends_on: - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -782,7 +782,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -814,7 +814,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -846,7 +846,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -877,7 +877,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - redis environment: - _APP_DB_SCHEME @@ -906,7 +906,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - redis environment: - _APP_DB_SCHEME @@ -934,7 +934,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - redis environment: - _APP_DB_SCHEME @@ -1055,7 +1055,7 @@ services: - MYSQL_DATABASE=${_APP_DB_SCHEMA} - MYSQL_USER=${_APP_DB_USER} - MYSQL_PASSWORD=${_APP_DB_PASS} - - MARIADB_AUTO_UPGRADE=1 + - ${_APP_DB_SCHEME:-mariadb}_AUTO_UPGRADE=1 command: "mysqld --innodb-flush-method=fsync" postgresql: From 58e04b4950f5cc8a4b606c14bce7a5e6ab631ac8 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 20 May 2025 19:01:25 +0530 Subject: [PATCH 13/96] removed trailing comma from the matrix db adapter of the test --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ccd287ec04..1bd05808dc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -142,8 +142,8 @@ jobs: fail-fast: false matrix: db_adapter:[ - MARIADB - POSTGRESQL, + MARIADB, + POSTGRESQL ] service: [ From f5c54bb94550dc3bebd41955fa73245012bf81e4 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 21 May 2025 17:36:50 +0530 Subject: [PATCH 14/96] added _APP_DB_ADAPTER --- .env | 2 +- .github/workflows/tests.yml | 6 +-- app/config/variables.php | 2 +- app/init/registers.php | 20 +++++-- app/views/install/compose.phtml | 38 ++++++------- docker-compose.yml | 72 ++++++++++++------------- src/Appwrite/Platform/Tasks/Install.php | 12 +---- src/Appwrite/Platform/Tasks/Upgrade.php | 2 +- 8 files changed, 78 insertions(+), 76 deletions(-) diff --git a/.env b/.env index b6418840a6..c916cf0db6 100644 --- a/.env +++ b/.env @@ -32,7 +32,7 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_PASS= _APP_REDIS_USER= -_APP_DB_SCHEME=mariadb +_APP_DB_ADAPTER=mariadb _APP_DB_HOST=mariadb _APP_DB_PORT=3306 _APP_DB_SCHEMA=appwrite diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1bd05808dc..cfa8182ac3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -203,12 +203,12 @@ jobs: # Set DB Adapter Specific ENV Vars using if-elif if [ "${{ matrix.db_adapter }}" = "MARIADB" ]; then - export _APP_DB_SCHEME=mariadb + export _APP_DB_ADAPTER=mariadb export _APP_DB_HOST=mariadb export _APP_DB_PORT=3306 export _APP_DB_SCHEMA=appwrite elif [ "${{ matrix.db_adapter }}" = "POSTGRESQL" ]; then - export _APP_DB_SCHEME=postgresql + export _APP_DB_ADAPTER=postgresql export _APP_DB_HOST=postgresql export _APP_DB_PORT=5432 export _APP_DB_SCHEMA=appwrite @@ -220,7 +220,7 @@ jobs: docker compose exec -T \ -e _APP_DATABASE_SHARED_TABLES \ -e _APP_DATABASE_SHARED_TABLES_V1 \ - -e _APP_DB_SCHEME \ + -e _APP_DB_ADAPTER \ -e _APP_DB_HOST \ -e _APP_DB_PORT \ -e _APP_DB_SCHEMA \ diff --git a/app/config/variables.php b/app/config/variables.php index 941b41f4c2..d6b8069f13 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -332,7 +332,7 @@ return [ 'filter' => '' ], [ - 'name' => '_APP_DB_SCHEME', + 'name' => '_APP_DB_ADAPTER', 'description' => 'To switch between mariadb and postgresql', 'introduction' => '1.6.0', 'default' => 'mariadb', diff --git a/app/init/registers.php b/app/init/registers.php index 8c293628e3..883c4f66bb 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -101,7 +101,7 @@ $register->set('pools', function () { $group = new Group(); $fallbackForDB = 'db_main=' . AppwriteURL::unparse([ - 'scheme' => System::getEnv('_APP_DB_SCHEME', 'mariadb'), + 'scheme' => System::getEnv('_APP_DB_ADAPTER', 'mariadb'), 'host' => System::getEnv('_APP_DB_HOST', 'mariadb'), 'port' => System::getEnv('_APP_DB_PORT', '3306'), 'user' => System::getEnv('_APP_DB_USER', ''), @@ -300,10 +300,20 @@ $register->set('db', function () { $dbUser = System::getEnv('_APP_DB_USER', ''); $dbPass = System::getEnv('_APP_DB_PASS', ''); $dbSchema = System::getEnv('_APP_DB_SCHEMA', ''); - $dbScheme = System::getEnv('_APP_DB_SCHEME', 'mariadb'); - $dsn = ($dbScheme === 'postgresql') - ? "pgsql:host={$dbHost};port={$dbPort};dbname={$dbSchema}" - : "mysql:host={$dbHost};port={$dbPort};dbname={$dbSchema};charset=utf8mb4"; + $dbAdapter = System::getEnv('_APP_DB_ADAPTER', 'mariadb'); + $dsn = ''; + + switch ($dbAdapter) { + case 'postgresql': + $dsn = "pgsql:host={$dbHost};port={$dbPort};dbname={$dbSchema}"; + break; + + case 'mysql': + case 'mariadb': + default: + $dsn = "mysql:host={$dbHost};port={$dbPort};dbname={$dbSchema};charset=utf8mb4"; + break; + } return new PDO( diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index b916849137..6012e095ad 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -106,7 +106,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_SMTP_HOST - _APP_SMTP_PORT - _APP_SMTP_SECURE @@ -224,7 +224,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPTIONS_ABUSE @@ -254,7 +254,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -281,7 +281,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -317,7 +317,7 @@ $dbService = $this->getParam('database'); - appwrite-builds:/storage/builds:rw - appwrite-certificates:/storage/certificates:rw environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -374,7 +374,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -406,7 +406,7 @@ $dbService = $this->getParam('database'); - appwrite-builds:/storage/builds:rw - appwrite-uploads:/storage/uploads:rw environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -473,7 +473,7 @@ $dbService = $this->getParam('database'); - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -507,7 +507,7 @@ $dbService = $this->getParam('database'); - - openruntimes-executor environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -546,7 +546,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -584,7 +584,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -636,7 +636,7 @@ $dbService = $this->getParam('database'); depends_on: - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -670,7 +670,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN @@ -709,7 +709,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -739,7 +739,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -768,7 +768,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -797,7 +797,7 @@ $dbService = $this->getParam('database'); - - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -823,7 +823,7 @@ $dbService = $this->getParam('database'); - - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -849,7 +849,7 @@ $dbService = $this->getParam('database'); - - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 diff --git a/docker-compose.yml b/docker-compose.yml index 7d903c2996..1d8643309a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -88,7 +88,7 @@ services: - ./dev:/usr/src/code/dev - ./.env:/usr/src/code/.env depends_on: - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - redis # - clamav entrypoint: @@ -96,7 +96,7 @@ services: - -e - app/http.php environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_EDITION - _APP_WORKER_PER_CORE @@ -262,10 +262,10 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPTIONS_ABUSE @@ -296,9 +296,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -326,10 +326,10 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - request-catcher environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -356,7 +356,7 @@ services: - appwrite depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} volumes: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw @@ -367,7 +367,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -423,9 +423,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -459,9 +459,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -525,14 +525,14 @@ services: - appwrite depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} volumes: - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw - ./app:/usr/src/code/app - ./src:/usr/src/code/src environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -566,10 +566,10 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - openruntimes-executor environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -613,7 +613,7 @@ services: - maildev # - smtp environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -648,7 +648,7 @@ services: depends_on: - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -703,9 +703,9 @@ services: - ./src:/usr/src/code/src - ./tests:/usr/src/code/tests depends_on: - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -741,7 +741,7 @@ services: depends_on: - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN @@ -782,9 +782,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -814,9 +814,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -846,9 +846,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -877,10 +877,10 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -906,10 +906,10 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -934,10 +934,10 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -1055,7 +1055,7 @@ services: - MYSQL_DATABASE=${_APP_DB_SCHEMA} - MYSQL_USER=${_APP_DB_USER} - MYSQL_PASSWORD=${_APP_DB_PASS} - - ${_APP_DB_SCHEME:-mariadb}_AUTO_UPGRADE=1 + - ${_APP_DB_ADAPTER:-mariadb}_AUTO_UPGRADE=1 command: "mysqld --innodb-flush-method=fsync" postgresql: diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 1ac2fbac5f..387c8dbc56 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -42,14 +42,6 @@ class Install extends Action $defaultHTTPSPort = '443'; /** @var array> $vars array whre key is variable name and value is variable */ $vars = []; - $vars['_APP_DB_SCHEME'] = [ - 'name' => '_APP_DB_SCHEME', - 'default' => $database, - 'required' => true, - 'filter' => '', - 'overwrite' => true, - 'question' => 'Choose your database (mariadb|postgresql)', - ]; foreach ($config as $category) { foreach ($category['variables'] ?? [] as $var) { @@ -181,7 +173,7 @@ class Install extends Action continue; } - if ($var['name'] === '_APP_DB_SCHEME' && $data !== false) { + if ($var['name'] === '_APP_DB_ADAPTER' && $data !== false) { continue; } @@ -201,7 +193,7 @@ class Install extends Action } } } - $database = $input['_APP_DB_SCHEME']; + $database = $input['_APP_DB_ADAPTER']; if ($database === 'postgresql') { $input['_APP_DB_HOST'] = 'postgresql'; $input['_APP_DB_PORT'] = 5432; diff --git a/src/Appwrite/Platform/Tasks/Upgrade.php b/src/Appwrite/Platform/Tasks/Upgrade.php index ecf71d27a1..5b9a9e1f3a 100644 --- a/src/Appwrite/Platform/Tasks/Upgrade.php +++ b/src/Appwrite/Platform/Tasks/Upgrade.php @@ -41,7 +41,7 @@ class Upgrade extends Install Console::log(' └── docker-compose.yml'); Console::exit(1); } - $database = System::getEnv('_APP_DB_SCHEME', 'mariadb'); + $database = System::getEnv('_APP_DB_ADAPTER', 'mariadb'); parent::action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database); } } From e7f51023bf030dea168c5a4e9812c967ed51b002 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 21 May 2025 18:13:20 +0530 Subject: [PATCH 15/96] updated updating database in the installation --- docker-compose.yml | 1 - src/Appwrite/Platform/Tasks/Install.php | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1d8643309a..280f690fbc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -86,7 +86,6 @@ services: - ./public:/usr/src/code/public - ./src:/usr/src/code/src - ./dev:/usr/src/code/dev - - ./.env:/usr/src/code/.env depends_on: - ${_APP_DB_ADAPTER:-mariadb} - redis diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 387c8dbc56..550c50f4c9 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -174,6 +174,7 @@ class Install extends Action } if ($var['name'] === '_APP_DB_ADAPTER' && $data !== false) { + $input[$var['name']] = $database; continue; } From f1b2ac0d1335ed2df25dfe4020e8c66a0e0d1eae Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 21 May 2025 18:22:16 +0530 Subject: [PATCH 16/96] updated tests yml --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cfa8182ac3..7ee1e50abe 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -141,7 +141,7 @@ jobs: strategy: fail-fast: false matrix: - db_adapter:[ + db_adapter: [ MARIADB, POSTGRESQL ] From be1e52529a0cf6021a673e7754715c6aee8a0f8e Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 27 May 2025 22:07:49 +0530 Subject: [PATCH 17/96] updated depends on to the host instead of adapter and changed to the grouping of env vars --- app/views/install/compose.phtml | 36 ++++++++--------- docker-compose.yml | 71 ++++++++++++++++----------------- 2 files changed, 53 insertions(+), 54 deletions(-) diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 6012e095ad..afeab4033e 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -224,7 +224,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPTIONS_ABUSE @@ -239,6 +238,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_USAGE_STATS - _APP_LOGGING_CONFIG @@ -254,7 +254,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -267,6 +266,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG appwrite-worker-webhooks: @@ -281,7 +281,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -292,6 +291,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -317,7 +317,6 @@ $dbService = $this->getParam('database'); - appwrite-builds:/storage/builds:rw - appwrite-certificates:/storage/certificates:rw environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -330,6 +329,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_STORAGE_DEVICE - _APP_STORAGE_S3_ACCESS_KEY - _APP_STORAGE_S3_SECRET @@ -374,7 +374,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -387,6 +386,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG appwrite-worker-builds: @@ -406,7 +406,6 @@ $dbService = $this->getParam('database'); - appwrite-builds:/storage/builds:rw - appwrite-uploads:/storage/uploads:rw environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -421,6 +420,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_VCS_GITHUB_APP_NAME - _APP_VCS_GITHUB_PRIVATE_KEY @@ -473,7 +473,6 @@ $dbService = $this->getParam('database'); - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -492,6 +491,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG appwrite-worker-functions: @@ -507,7 +507,6 @@ $dbService = $this->getParam('database'); - - openruntimes-executor environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -522,6 +521,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_FUNCTIONS_TIMEOUT - _APP_SITES_TIMEOUT - _APP_COMPUTE_BUILD_TIMEOUT @@ -546,7 +546,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -557,6 +556,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -584,7 +584,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -597,6 +596,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_SMS_FROM - _APP_SMS_PROVIDER @@ -636,7 +636,6 @@ $dbService = $this->getParam('database'); depends_on: - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -654,6 +653,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_MIGRATIONS_FIREBASE_CLIENT_ID - _APP_MIGRATIONS_FIREBASE_CLIENT_SECRET @@ -670,7 +670,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN @@ -688,6 +687,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_MAINTENANCE_INTERVAL - _APP_MAINTENANCE_RETENTION_EXECUTION - _APP_MAINTENANCE_RETENTION_CACHE @@ -709,7 +709,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -718,6 +717,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -739,7 +739,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -748,6 +747,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -768,7 +768,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -777,6 +776,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -797,7 +797,6 @@ $dbService = $this->getParam('database'); - - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -810,6 +809,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER appwrite-task-scheduler-executions: image: /: @@ -823,7 +823,6 @@ $dbService = $this->getParam('database'); - - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -836,6 +835,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER appwrite-task-scheduler-messages: image: /: @@ -849,7 +849,6 @@ $dbService = $this->getParam('database'); - - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -862,6 +861,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER appwrite-assistant: image: appwrite/assistant:0.4.0 diff --git a/docker-compose.yml b/docker-compose.yml index 280f690fbc..7888bebeea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -87,7 +87,7 @@ services: - ./src:/usr/src/code/src - ./dev:/usr/src/code/dev depends_on: - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - redis # - clamav entrypoint: @@ -95,7 +95,6 @@ services: - -e - app/http.php environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_EDITION - _APP_WORKER_PER_CORE @@ -130,6 +129,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_SMTP_HOST - _APP_SMTP_PORT - _APP_SMTP_SECURE @@ -261,10 +261,9 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPTIONS_ABUSE @@ -279,6 +278,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_USAGE_STATS - _APP_LOGGING_CONFIG - _APP_DATABASE_SHARED_TABLES @@ -295,9 +295,8 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -310,6 +309,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_DATABASE_SHARED_TABLES @@ -325,10 +325,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - request-catcher environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -338,6 +337,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -355,7 +355,7 @@ services: - appwrite depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} volumes: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw @@ -366,7 +366,6 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -379,6 +378,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_STORAGE_DEVICE - _APP_STORAGE_S3_ACCESS_KEY - _APP_STORAGE_S3_SECRET @@ -422,9 +422,8 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -437,6 +436,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_WORKERS_NUM - _APP_QUEUE_NAME @@ -458,9 +458,8 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -475,6 +474,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_VCS_GITHUB_APP_NAME - _APP_VCS_GITHUB_PRIVATE_KEY @@ -524,14 +524,13 @@ services: - appwrite depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} volumes: - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw - ./app:/usr/src/code/app - ./src:/usr/src/code/src environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -550,6 +549,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_DATABASE_SHARED_TABLES @@ -565,10 +565,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - openruntimes-executor environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -583,6 +582,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_FUNCTIONS_TIMEOUT - _APP_SITES_TIMEOUT - _APP_COMPUTE_BUILD_TIMEOUT @@ -612,7 +612,6 @@ services: - maildev # - smtp environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -647,7 +646,6 @@ services: depends_on: - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -660,6 +658,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_SMS_FROM - _APP_SMS_PROVIDER @@ -702,9 +701,8 @@ services: - ./src:/usr/src/code/src - ./tests:/usr/src/code/tests depends_on: - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -722,6 +720,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_MIGRATIONS_FIREBASE_CLIENT_ID - _APP_MIGRATIONS_FIREBASE_CLIENT_SECRET @@ -740,7 +739,6 @@ services: depends_on: - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN @@ -758,6 +756,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_MAINTENANCE_INTERVAL - _APP_MAINTENANCE_RETENTION_EXECUTION - _APP_MAINTENANCE_RETENTION_CACHE @@ -781,9 +780,8 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -792,6 +790,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -813,9 +812,8 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -824,6 +822,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -845,9 +844,8 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -856,6 +854,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -876,10 +875,9 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -892,6 +890,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_DATABASE_SHARED_TABLES appwrite-task-scheduler-executions: @@ -905,10 +904,9 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -921,6 +919,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER appwrite-task-scheduler-messages: entrypoint: schedule-messages @@ -933,10 +932,9 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -949,6 +947,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_DATABASE_SHARED_TABLES appwrite-assistant: @@ -1054,7 +1053,7 @@ services: - MYSQL_DATABASE=${_APP_DB_SCHEMA} - MYSQL_USER=${_APP_DB_USER} - MYSQL_PASSWORD=${_APP_DB_PASS} - - ${_APP_DB_ADAPTER:-mariadb}_AUTO_UPGRADE=1 + - MARIADB_AUTO_UPGRADE=1 command: "mysqld --innodb-flush-method=fsync" postgresql: From 8048a82a5df0f192f90606722a58d260ced6c61c Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 14:11:45 +0530 Subject: [PATCH 18/96] add postges installtion command --- .env | 1 + app/init/registers.php | 28 ++++++++++++++++++---- app/views/install/compose.phtml | 24 +++++++++++++++++-- src/Appwrite/Platform/Tasks/Install.php | 31 +++++++++++++++++++++---- src/Appwrite/Platform/Tasks/Upgrade.php | 7 +++--- 5 files changed, 77 insertions(+), 14 deletions(-) diff --git a/.env b/.env index b7dd9e24f3..fa22be4586 100644 --- a/.env +++ b/.env @@ -32,6 +32,7 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_PASS= _APP_REDIS_USER= +_APP_DB_SCHEME=postgresql _APP_DB_HOST=mariadb _APP_DB_PORT=3306 _APP_DB_SCHEMA=appwrite diff --git a/app/init/registers.php b/app/init/registers.php index 415730f936..b2f1a54dbe 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -14,6 +14,7 @@ use Utopia\CLI\Console; use Utopia\Config\Config; use Utopia\Database\Adapter\MariaDB; use Utopia\Database\Adapter\MySQL; +use Utopia\Database\Adapter\Postgres; use Utopia\Database\Adapter\SQL; use Utopia\Database\PDO; use Utopia\Domains\Validator\PublicDomain; @@ -120,19 +121,19 @@ $register->set('pools', function () { 'type' => 'database', 'dsns' => $fallbackForDB, 'multiple' => false, - 'schemes' => ['mariadb', 'mysql'], + 'schemes' => ['mariadb', 'mysql','postgresql'], ], 'database' => [ 'type' => 'database', 'dsns' => $fallbackForDB, 'multiple' => true, - 'schemes' => ['mariadb', 'mysql'], + 'schemes' => ['mariadb', 'mysql','postgresql'], ], 'logs' => [ 'type' => 'database', 'dsns' => System::getEnv('_APP_CONNECTIONS_DB_LOGS', $fallbackForDB), 'multiple' => false, - 'schemes' => ['mariadb', 'mysql'], + 'schemes' => ['mariadb', 'mysql','postgresql'], ], 'publisher' => [ 'type' => 'publisher', @@ -225,6 +226,17 @@ $register->set('pools', function () { ]); }); }, + 'postgresql' => function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { + return new PDOProxy(function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { + return new PDO("pgsql:host={$dsnHost};port={$dsnPort};dbname={$dsnDatabase}", $dsnUser, $dsnPass, array( + \PDO::ATTR_TIMEOUT => 3, // Seconds + \PDO::ATTR_PERSISTENT => false, + \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC, + \PDO::ATTR_EMULATE_PREPARES => true, + \PDO::ATTR_STRINGIFY_FETCHES => true + )); + }); + }, 'redis' => function () use ($dsnHost, $dsnPort, $dsnPass) { $redis = new \Redis(); @$redis->pconnect($dsnHost, (int)$dsnPort); @@ -245,6 +257,7 @@ $register->set('pools', function () { $adapter = match ($dsn->getScheme()) { 'mariadb' => new MariaDB($resource()), 'mysql' => new MySQL($resource()), + 'postgresql' => new Postgres($resource), default => null }; @@ -286,10 +299,15 @@ $register->set('db', function () { $dbPort = System::getEnv('_APP_DB_PORT', ''); $dbUser = System::getEnv('_APP_DB_USER', ''); $dbPass = System::getEnv('_APP_DB_PASS', ''); - $dbScheme = System::getEnv('_APP_DB_SCHEMA', ''); + $dbSchema = System::getEnv('_APP_DB_SCHEMA', ''); + $dbScheme = System::getEnv('_APP_DB_SCHEME', 'mariadb'); + $dsn = ($dbScheme === 'postgresql') + ? "pgsql:host={$dbHost};port={$dbPort};dbname={$dbSchema}" + : "mysql:host={$dbHost};port={$dbPort};dbname={$dbSchema};charset=utf8mb4"; + return new PDO( - "mysql:host={$dbHost};port={$dbPort};dbname={$dbScheme};charset=utf8mb4", + $dsn, $dbUser, $dbPass, SQL::getPDOAttributes() diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 2d8f2b35ab..774a72537d 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -69,8 +69,12 @@ $image = $this->getParam('image', ''); - appwrite-sites:/storage/sites:rw - appwrite-builds:/storage/builds:rw depends_on: - - mariadb - redis + getParam('_APP_DB_SCHEME', 'mariadb') === 'mariadb'): ?> + - mariadb + + - postgres + # - clamav environment: - _APP_ENV @@ -105,6 +109,7 @@ $image = $this->getParam('image', ''); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_SCHEME - _APP_SMTP_HOST - _APP_SMTP_PORT - _APP_SMTP_SECURE @@ -219,8 +224,8 @@ $image = $this->getParam('image', ''); networks: - appwrite depends_on: - - mariadb - redis + - mariadb environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -927,6 +932,20 @@ $image = $this->getParam('image', ''); - MARIADB_AUTO_UPGRADE=1 command: 'mysqld --innodb-flush-method=fsync' + postgres: + image: postgres:15-alpine + container_name: appwrite-postgres + <<: *x-logging + restart: unless-stopped + networks: + - appwrite + volumes: + - appwrite-postgres:/var/lib/postgresql/data:rw + environment: + - POSTGRES_DB=${_APP_DB_SCHEMA} + - POSTGRES_USER=${_APP_DB_USER} + - POSTGRES_PASSWORD=${_APP_DB_PASS} + redis: image: redis:7.2.4-alpine container_name: appwrite-redis @@ -970,3 +989,4 @@ volumes: appwrite-sites: appwrite-builds: appwrite-config: + appwrite-postgres: diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index c7b1f72453..c157374893 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -31,16 +31,25 @@ class Install extends Action ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->callback([$this, 'action']); + ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) + ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); } - public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void + public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart, string $database): void { $config = Config::getParam('variables'); $defaultHTTPPort = '80'; $defaultHTTPSPort = '443'; /** @var array> $vars array whre key is variable name and value is variable */ $vars = []; + $vars['_APP_DB_SCHEME'] = [ + 'name' => '_APP_DB_SCHEME', + 'default' => $database, + 'required' => false, + 'filter' => '', + 'overwrite' => true, + 'question' => 'Choose your database (mariadb|postgresql)', + ]; foreach ($config as $category) { foreach ($category['variables'] ?? [] as $var) { @@ -171,6 +180,19 @@ class Install extends Action continue; } + if ($var['name'] === '_APP_DB_SCHEME') { + $input[$var['name']] = Console::confirm('Choose your database (mariadb|postgresql): (default: ' . $var['default'] . ')'); + if (empty($input[$var['name']])) { + $input[$var['name']] = $var['default']; + } + if (!in_array($input[$var['name']], ['mariadb', 'postgresql'])) { + Console::error('Invalid database choice. Please choose either mariadb or postgresql.'); + Console::exit(1); + } + $database = $input[$var['name']]; + continue; + } + $input[$var['name']] = Console::confirm($var['question'] . ' (default: \'' . $var['default'] . '\')'); if (empty($input[$var['name']])) { @@ -196,8 +218,9 @@ class Install extends Action ->setParam('httpsPort', $httpsPort) ->setParam('version', APP_VERSION_STABLE) ->setParam('organization', $organization) - ->setParam('image', $image); - + ->setParam('image', $image) + ->setParam('database',$database); + $input['_APP_DB_SCHEME'] = $database; $templateForEnv->setParam('vars', $input); if (!file_put_contents($this->path . '/docker-compose.yml', $templateForCompose->render(false))) { diff --git a/src/Appwrite/Platform/Tasks/Upgrade.php b/src/Appwrite/Platform/Tasks/Upgrade.php index dfd10d347e..5f4b625462 100644 --- a/src/Appwrite/Platform/Tasks/Upgrade.php +++ b/src/Appwrite/Platform/Tasks/Upgrade.php @@ -23,10 +23,11 @@ class Upgrade extends Install ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->callback([$this, 'action']); + ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) + ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); } - public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void + public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart, string $database): void { // Check for previous installation $data = @file_get_contents($this->path . '/docker-compose.yml'); @@ -39,6 +40,6 @@ class Upgrade extends Install Console::log(' └── docker-compose.yml'); Console::exit(1); } - parent::action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart); + parent::action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database); } } From dee9736c8a14b321725fa23248290d911bc13616 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 16:19:20 +0530 Subject: [PATCH 19/96] updated compose file and installation script --- .env | 2 +- app/views/install/compose.phtml | 48 ++++++++++++------------- src/Appwrite/Platform/Tasks/Install.php | 44 ++++++++++------------- 3 files changed, 43 insertions(+), 51 deletions(-) diff --git a/.env b/.env index fa22be4586..7d458a58fd 100644 --- a/.env +++ b/.env @@ -32,7 +32,7 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_PASS= _APP_REDIS_USER= -_APP_DB_SCHEME=postgresql +_APP_DB_SCHEME=mariadb _APP_DB_HOST=mariadb _APP_DB_PORT=3306 _APP_DB_SCHEMA=appwrite diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 774a72537d..d3cab3285b 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -11,6 +11,7 @@ $httpsPort = $this->getParam('httpsPort', ''); $version = $this->getParam('version', ''); $organization = $this->getParam('organization', ''); $image = $this->getParam('image', ''); +$dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' : 'postgresql'; ?>services: traefik: image: traefik:2.11 @@ -70,11 +71,7 @@ $image = $this->getParam('image', ''); - appwrite-builds:/storage/builds:rw depends_on: - redis - getParam('_APP_DB_SCHEME', 'mariadb') === 'mariadb'): ?> - - mariadb - - - postgres - + - # - clamav environment: - _APP_ENV @@ -225,7 +222,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -254,7 +251,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -280,7 +277,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -308,7 +305,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - volumes: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw @@ -371,7 +368,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -397,7 +394,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - volumes: - appwrite-functions:/storage/functions:rw - appwrite-sites:/storage/sites:rw @@ -465,7 +462,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - volumes: - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw @@ -500,7 +497,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - - openruntimes-executor environment: - _APP_ENV @@ -539,6 +536,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -575,6 +573,7 @@ $image = $this->getParam('image', ''); - appwrite-uploads:/storage/uploads:rw depends_on: - redis + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -625,7 +624,7 @@ $image = $this->getParam('image', ''); volumes: - appwrite-imports:/storage/imports:rw depends_on: - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -658,6 +657,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -695,7 +695,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -724,7 +724,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -752,7 +752,7 @@ $image = $this->getParam('image', ''); - appwrite depends_on: - redis - - mariadb + - environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -779,7 +779,7 @@ $image = $this->getParam('image', ''); networks: - appwrite depends_on: - - mariadb + - - redis environment: - _APP_ENV @@ -804,7 +804,7 @@ $image = $this->getParam('image', ''); networks: - appwrite depends_on: - - mariadb + - - redis environment: - _APP_ENV @@ -829,7 +829,7 @@ $image = $this->getParam('image', ''); networks: - appwrite depends_on: - - mariadb + - - redis environment: - _APP_ENV @@ -932,15 +932,15 @@ $image = $this->getParam('image', ''); - MARIADB_AUTO_UPGRADE=1 command: 'mysqld --innodb-flush-method=fsync' - postgres: + postgresql: image: postgres:15-alpine - container_name: appwrite-postgres + container_name: appwrite-postgresql <<: *x-logging restart: unless-stopped networks: - appwrite volumes: - - appwrite-postgres:/var/lib/postgresql/data:rw + - appwrite-postgresql:/var/lib/postgresql/data:rw environment: - POSTGRES_DB=${_APP_DB_SCHEMA} - POSTGRES_USER=${_APP_DB_USER} @@ -989,4 +989,4 @@ volumes: appwrite-sites: appwrite-builds: appwrite-config: - appwrite-postgres: + appwrite-postgresql: diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index c157374893..bc1ee40362 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -31,7 +31,7 @@ class Install extends Action ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) + ->param('database', '', new Text(0), 'Database to use (mariadb|postgresql)', true) ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); } @@ -45,7 +45,7 @@ class Install extends Action $vars['_APP_DB_SCHEME'] = [ 'name' => '_APP_DB_SCHEME', 'default' => $database, - 'required' => false, + 'required' => true, 'filter' => '', 'overwrite' => true, 'question' => 'Choose your database (mariadb|postgresql)', @@ -59,13 +59,6 @@ class Install extends Action Console::success('Starting Appwrite installation...'); - // Create directory with write permissions - if (!\file_exists(\dirname($this->path))) { - if (!@\mkdir(\dirname($this->path), 0755, true)) { - Console::error('Can\'t create directory ' . \dirname($this->path)); - Console::exit(1); - } - } $data = @file_get_contents($this->path . '/docker-compose.yml'); @@ -146,6 +139,18 @@ class Install extends Action } } + // if ($interactive == 'Y' && Console::isInteractive()) { + // $dbChoice = Console::confirm('Choose your database (mariadb|postgresql): (default: ' . $database . ')'); + // if (!empty($dbChoice)) { + // $database = $dbChoice; + // if (!in_array($database, ['mariadb', 'postgresql'])) { + // Console::error('Invalid database choice. Please choose either mariadb or postgresql.'); + // Console::exit(1); + // } + // } + // $vars['_APP_DB_SCHEME']['default'] = $database; + // } + if (empty($httpPort)) { $httpPort = Console::confirm('Choose your server HTTP port: (default: ' . $defaultHTTPPort . ')'); $httpPort = ($httpPort) ? $httpPort : $defaultHTTPPort; @@ -180,19 +185,6 @@ class Install extends Action continue; } - if ($var['name'] === '_APP_DB_SCHEME') { - $input[$var['name']] = Console::confirm('Choose your database (mariadb|postgresql): (default: ' . $var['default'] . ')'); - if (empty($input[$var['name']])) { - $input[$var['name']] = $var['default']; - } - if (!in_array($input[$var['name']], ['mariadb', 'postgresql'])) { - Console::error('Invalid database choice. Please choose either mariadb or postgresql.'); - Console::exit(1); - } - $database = $input[$var['name']]; - continue; - } - $input[$var['name']] = Console::confirm($var['question'] . ' (default: \'' . $var['default'] . '\')'); if (empty($input[$var['name']])) { @@ -209,18 +201,18 @@ class Install extends Action } } } + $database = $input['_APP_DB_SCHEME']; $templateForCompose = new View(__DIR__ . '/../../../../app/views/install/compose.phtml'); $templateForEnv = new View(__DIR__ . '/../../../../app/views/install/env.phtml'); - $templateForCompose ->setParam('httpPort', $httpPort) ->setParam('httpsPort', $httpsPort) ->setParam('version', APP_VERSION_STABLE) ->setParam('organization', $organization) ->setParam('image', $image) - ->setParam('database',$database); - $input['_APP_DB_SCHEME'] = $database; + ->setParam('database', $database); + $templateForEnv->setParam('vars', $input); if (!file_put_contents($this->path . '/docker-compose.yml', $templateForCompose->render(false))) { @@ -261,4 +253,4 @@ class Install extends Action Console::success($message); } } -} +} \ No newline at end of file From b5a82109f14e16e8baa0c33b65d6f6edf4371054 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 16:19:37 +0530 Subject: [PATCH 20/96] linting --- src/Appwrite/Platform/Tasks/Install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index bc1ee40362..43c5289f02 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -253,4 +253,4 @@ class Install extends Action Console::success($message); } } -} \ No newline at end of file +} From 3cb0894091bd47a25f8b3fec87364aee34bfcba9 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 17:01:18 +0530 Subject: [PATCH 21/96] added conditonal for .env for mariadb and psotgres --- src/Appwrite/Platform/Tasks/Install.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 43c5289f02..d18f6b7c88 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -31,7 +31,7 @@ class Install extends Action ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->param('database', '', new Text(0), 'Database to use (mariadb|postgresql)', true) + ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); } @@ -139,17 +139,6 @@ class Install extends Action } } - // if ($interactive == 'Y' && Console::isInteractive()) { - // $dbChoice = Console::confirm('Choose your database (mariadb|postgresql): (default: ' . $database . ')'); - // if (!empty($dbChoice)) { - // $database = $dbChoice; - // if (!in_array($database, ['mariadb', 'postgresql'])) { - // Console::error('Invalid database choice. Please choose either mariadb or postgresql.'); - // Console::exit(1); - // } - // } - // $vars['_APP_DB_SCHEME']['default'] = $database; - // } if (empty($httpPort)) { $httpPort = Console::confirm('Choose your server HTTP port: (default: ' . $defaultHTTPPort . ')'); @@ -202,6 +191,13 @@ class Install extends Action } } $database = $input['_APP_DB_SCHEME']; + if ($database === 'postgresql') { + $input['_APP_DB_HOST'] = 'postgresql'; + $input['_APP_DB_PORT'] = 5432; + } elseif ($database === 'mariadb') { + $input['_APP_DB_HOST'] = 'mariadb'; + $input['_APP_DB_PORT'] = 3306; + } $templateForCompose = new View(__DIR__ . '/../../../../app/views/install/compose.phtml'); $templateForEnv = new View(__DIR__ . '/../../../../app/views/install/env.phtml'); From f18fbc792e4226cdb89c3734f6c69f7e485f36e2 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 17:53:44 +0530 Subject: [PATCH 22/96] used env var in the registers for the pool --- app/init/registers.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/init/registers.php b/app/init/registers.php index b2f1a54dbe..fea8138fcc 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -99,9 +99,10 @@ $register->set('logger', function () { $register->set('pools', function () { $group = new Group(); + $dbScheme = System::getEnv('_APP_DB_SCHEME', 'mariadb'); $fallbackForDB = 'db_main=' . AppwriteURL::unparse([ - 'scheme' => 'mariadb', + 'scheme' => $dbScheme, 'host' => System::getEnv('_APP_DB_HOST', 'mariadb'), 'port' => System::getEnv('_APP_DB_PORT', '3306'), 'user' => System::getEnv('_APP_DB_USER', ''), From e6f8055f602e7028700e5660c23c152c5ae84191 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 18:07:17 +0530 Subject: [PATCH 23/96] added the callable resource in the pg adapter --- app/init/registers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/init/registers.php b/app/init/registers.php index fea8138fcc..2308ff833c 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -258,7 +258,7 @@ $register->set('pools', function () { $adapter = match ($dsn->getScheme()) { 'mariadb' => new MariaDB($resource()), 'mysql' => new MySQL($resource()), - 'postgresql' => new Postgres($resource), + 'postgresql' => new Postgres($resource()), default => null }; From 0452ed460578921e0ef42f007a2d8f6686451b4e Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 21:07:47 +0530 Subject: [PATCH 24/96] added changes --- app/config/variables.php | 9 +++++++++ app/init/registers.php | 3 +-- app/views/install/compose.phtml | 18 +++++++++++++----- src/Appwrite/Platform/Tasks/Install.php | 9 ++++++++- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 2f9a5ab41a..ad0fb212ee 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -339,6 +339,15 @@ return [ 'required' => false, 'question' => '', 'filter' => '' + ], + [ + 'name' => '_APP_DB_SCHEME', + 'description' => 'To switch between mariadb and postgresql', + 'introduction' => '1.6.0', + 'default' => 'mariadb', + 'required' => true, + 'question' => 'Choose your database (mariadb|postgresql)', + 'filter' => '' ] ], ], diff --git a/app/init/registers.php b/app/init/registers.php index 2308ff833c..c9ba77ec4b 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -99,10 +99,9 @@ $register->set('logger', function () { $register->set('pools', function () { $group = new Group(); - $dbScheme = System::getEnv('_APP_DB_SCHEME', 'mariadb'); $fallbackForDB = 'db_main=' . AppwriteURL::unparse([ - 'scheme' => $dbScheme, + 'scheme' => System::getEnv('_APP_DB_SCHEME', 'mariadb'), 'host' => System::getEnv('_APP_DB_HOST', 'mariadb'), 'port' => System::getEnv('_APP_DB_PORT', '3306'), 'user' => System::getEnv('_APP_DB_USER', ''), diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index d3cab3285b..9b74f67650 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -11,7 +11,7 @@ $httpsPort = $this->getParam('httpsPort', ''); $version = $this->getParam('version', ''); $organization = $this->getParam('organization', ''); $image = $this->getParam('image', ''); -$dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' : 'postgresql'; +$dbService = $this->getParam('database'); ?>services: traefik: image: traefik:2.11 @@ -915,10 +915,12 @@ $dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' : - OPR_EXECUTOR_STORAGE_WASABI_REGION=$_APP_STORAGE_WASABI_REGION - OPR_EXECUTOR_STORAGE_WASABI_BUCKET=$_APP_STORAGE_WASABI_BUCKET + + + mariadb: - image: mariadb:10.11 # fix issues when upgrading using: mysql_upgrade -u root -p + image: mariadb:10.11 container_name: appwrite-mariadb - <<: *x-logging restart: unless-stopped networks: - appwrite @@ -932,10 +934,11 @@ $dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' : - MARIADB_AUTO_UPGRADE=1 command: 'mysqld --innodb-flush-method=fsync' + + postgresql: image: postgres:15-alpine container_name: appwrite-postgresql - <<: *x-logging restart: unless-stopped networks: - appwrite @@ -946,6 +949,8 @@ $dbService = $this->getParam('database', 'mariadb') === 'mariadb' ? 'mariadb' : - POSTGRES_USER=${_APP_DB_USER} - POSTGRES_PASSWORD=${_APP_DB_PASS} + + redis: image: redis:7.2.4-alpine container_name: appwrite-redis @@ -979,7 +984,11 @@ networks: name: runtimes volumes: + appwrite-mariadb: + + appwrite-postgresql: + appwrite-redis: appwrite-cache: appwrite-uploads: @@ -989,4 +998,3 @@ volumes: appwrite-sites: appwrite-builds: appwrite-config: - appwrite-postgresql: diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index d18f6b7c88..7d13973003 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -32,7 +32,7 @@ class Install extends Action ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) - ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); + ->callback($this->action(...)); } public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart, string $database): void @@ -59,6 +59,13 @@ class Install extends Action Console::success('Starting Appwrite installation...'); + // Create directory with write permissions + if (!\file_exists(\dirname($this->path))) { + if (!@\mkdir(\dirname($this->path), 0755, true)) { + Console::error('Can\'t create directory ' . \dirname($this->path)); + Console::exit(1); + } + } $data = @file_get_contents($this->path . '/docker-compose.yml'); From f3d84783125648104c727504be0b2f31a44d4a5b Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 16 May 2025 23:33:21 +0530 Subject: [PATCH 25/96] updated the environment of the services in the docker compose of install --- app/views/install/compose.phtml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 9b74f67650..bb4fa48916 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -224,6 +224,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPTIONS_ABUSE @@ -253,6 +254,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -279,6 +281,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -314,6 +317,7 @@ $dbService = $this->getParam('database'); - appwrite-builds:/storage/builds:rw - appwrite-certificates:/storage/certificates:rw environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -370,6 +374,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -401,6 +406,7 @@ $dbService = $this->getParam('database'); - appwrite-builds:/storage/builds:rw - appwrite-uploads:/storage/uploads:rw environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -467,6 +473,7 @@ $dbService = $this->getParam('database'); - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -500,6 +507,7 @@ $dbService = $this->getParam('database'); - - openruntimes-executor environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -538,6 +546,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -575,6 +584,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -626,6 +636,7 @@ $dbService = $this->getParam('database'); depends_on: - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -659,6 +670,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN @@ -697,6 +709,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -726,6 +739,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -754,6 +768,7 @@ $dbService = $this->getParam('database'); - redis - environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -782,6 +797,7 @@ $dbService = $this->getParam('database'); - - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -807,6 +823,7 @@ $dbService = $this->getParam('database'); - - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -832,6 +849,7 @@ $dbService = $this->getParam('database'); - - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 From d810fb417aa748f9cf0ce8874e2276af1f766885 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Sat, 17 May 2025 00:05:11 +0530 Subject: [PATCH 26/96] added upgrade limit for db --- src/Appwrite/Platform/Tasks/Install.php | 4 ++++ src/Appwrite/Platform/Tasks/Upgrade.php | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 7d13973003..1ac2fbac5f 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -181,6 +181,10 @@ class Install extends Action continue; } + if ($var['name'] === '_APP_DB_SCHEME' && $data !== false) { + continue; + } + $input[$var['name']] = Console::confirm($var['question'] . ' (default: \'' . $var['default'] . '\')'); if (empty($input[$var['name']])) { diff --git a/src/Appwrite/Platform/Tasks/Upgrade.php b/src/Appwrite/Platform/Tasks/Upgrade.php index 5f4b625462..ecf71d27a1 100644 --- a/src/Appwrite/Platform/Tasks/Upgrade.php +++ b/src/Appwrite/Platform/Tasks/Upgrade.php @@ -3,6 +3,7 @@ namespace Appwrite\Platform\Tasks; use Utopia\CLI\Console; +use Utopia\System\System; use Utopia\Validator\Boolean; use Utopia\Validator\Text; @@ -23,8 +24,8 @@ class Upgrade extends Install ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->param('database', 'mariadb', new Text(0), 'Database to use (mariadb|postgresql)', true) - ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database)); + ->param('database', 'mariadb', new Text(length: 0), 'Database to use (mariadb|postgresql)', true) + ->callback($this->action(...)); } public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart, string $database): void @@ -40,6 +41,7 @@ class Upgrade extends Install Console::log(' └── docker-compose.yml'); Console::exit(1); } + $database = System::getEnv('_APP_DB_SCHEME', 'mariadb'); parent::action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database); } } From c63ae1832a6e81e0337c26736bb7e1746ad99840 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 20 May 2025 14:46:50 +0530 Subject: [PATCH 27/96] updated local docker for ci test on github actions and tests yml --- .github/workflows/tests.yml | 28 ++++++++++++++++++++++++- app/views/install/compose.phtml | 3 ++- docker-compose.yml | 37 +++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 97f3696e67..b9c5289105 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -141,6 +141,11 @@ jobs: strategy: fail-fast: false matrix: + db_adapter:[ + MARIADB + POSTGRESQL, + ] + service: [ Account, Avatars, @@ -192,13 +197,34 @@ jobs: - name: Run ${{ matrix.service }} tests with Project table mode run: | echo "Using project tables" + export _APP_DATABASE_SHARED_TABLES= export _APP_DATABASE_SHARED_TABLES_V1= + # Set DB Adapter Specific ENV Vars using if-elif + if [ "${{ matrix.db_adapter }}" = "MARIADB" ]; then + export _APP_DB_SCHEME=mariadb + export _APP_DB_HOST=mariadb + export _APP_DB_PORT=3306 + export _APP_DB_SCHEMA=appwrite + elif [ "${{ matrix.db_adapter }}" = "POSTGRESQL" ]; then + export _APP_DB_SCHEME=postgresql + export _APP_DB_HOST=postgresql + export _APP_DB_PORT=5432 + export _APP_DB_SCHEMA=appwrite + else + echo "Unknown DB adapter: ${{ matrix.db_adapter }}" + exit 1 + fi + docker compose exec -T \ -e _APP_DATABASE_SHARED_TABLES \ -e _APP_DATABASE_SHARED_TABLES_V1 \ - appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude-group devKeys + -e _APP_DB_SCHEME \ + -e _APP_DB_HOST \ + -e _APP_DB_PORT \ + -e _APP_DB_SCHEMA \ + appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude=devKeys e2e_shared_mode_test: name: E2E Shared Mode Service Test diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index bb4fa48916..6829d9b728 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -955,7 +955,7 @@ $dbService = $this->getParam('database'); postgresql: - image: postgres:15-alpine + image: postgres:15 container_name: appwrite-postgresql restart: unless-stopped networks: @@ -966,6 +966,7 @@ $dbService = $this->getParam('database'); - POSTGRES_DB=${_APP_DB_SCHEMA} - POSTGRES_USER=${_APP_DB_USER} - POSTGRES_PASSWORD=${_APP_DB_PASS} + command: "postgres" diff --git a/docker-compose.yml b/docker-compose.yml index 29a43aca91..b9857e63cb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -86,6 +86,7 @@ services: - ./public:/usr/src/code/public - ./src:/usr/src/code/src - ./dev:/usr/src/code/dev + - ./.env:/usr/src/code/.env depends_on: - mariadb - redis @@ -95,6 +96,7 @@ services: - -e - app/http.php environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_EDITION - _APP_WORKER_PER_CORE @@ -263,6 +265,7 @@ services: - mariadb - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPTIONS_ABUSE @@ -295,6 +298,7 @@ services: - redis - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -325,6 +329,7 @@ services: - mariadb - request-catcher environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -362,6 +367,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -419,6 +425,7 @@ services: - redis - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -454,6 +461,7 @@ services: - redis - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -524,6 +532,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -560,6 +569,7 @@ services: - mariadb - openruntimes-executor environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -603,6 +613,7 @@ services: - maildev # - smtp environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -637,6 +648,7 @@ services: depends_on: - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -693,6 +705,7 @@ services: depends_on: - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -728,6 +741,7 @@ services: depends_on: - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN @@ -770,6 +784,7 @@ services: - redis - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -801,6 +816,7 @@ services: - redis - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -832,6 +848,7 @@ services: - redis - mariadb environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -863,6 +880,7 @@ services: - mariadb - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -891,6 +909,7 @@ services: - mariadb - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -918,6 +937,7 @@ services: - mariadb - redis environment: + - _APP_DB_SCHEME - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -1038,6 +1058,22 @@ services: - MARIADB_AUTO_UPGRADE=1 command: "mysqld --innodb-flush-method=fsync" + postgresql: + image: postgres:15 + container_name: appwrite-postgresql + <<: *x-logging + networks: + - appwrite + volumes: + - appwrite-postgresql:/var/lib/postgresql/data:rw + ports: + - "5432:5432" + environment: + - POSTGRES_DB=${_APP_DB_SCHEMA} + - POSTGRES_USER=${_APP_DB_USER} + - POSTGRES_PASSWORD=${_APP_DB_PASS} + command: "postgres" + redis: image: redis:7.2.4-alpine <<: *x-logging @@ -1127,6 +1163,7 @@ networks: volumes: appwrite-mariadb: + appwrite-postgresql: appwrite-redis: appwrite-cache: appwrite-uploads: From d0a45d6d1b3d1784aeac41586c192ca5ca076e40 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 20 May 2025 15:35:12 +0530 Subject: [PATCH 28/96] changed the depends on to scheme --- docker-compose.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b9857e63cb..c828125e32 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -88,7 +88,7 @@ services: - ./dev:/usr/src/code/dev - ./.env:/usr/src/code/.env depends_on: - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - redis # - clamav entrypoint: @@ -262,7 +262,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - redis environment: - _APP_DB_SCHEME @@ -296,7 +296,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -326,7 +326,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - request-catcher environment: - _APP_DB_SCHEME @@ -356,7 +356,7 @@ services: - appwrite depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} volumes: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw @@ -423,7 +423,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -459,7 +459,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -525,7 +525,7 @@ services: - appwrite depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} volumes: - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw @@ -566,7 +566,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - openruntimes-executor environment: - _APP_DB_SCHEME @@ -703,7 +703,7 @@ services: - ./src:/usr/src/code/src - ./tests:/usr/src/code/tests depends_on: - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -782,7 +782,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -814,7 +814,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -846,7 +846,7 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - mariadb + - ${_APP_DB_SCHEME:-mariadb} environment: - _APP_DB_SCHEME - _APP_ENV @@ -877,7 +877,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - redis environment: - _APP_DB_SCHEME @@ -906,7 +906,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - redis environment: - _APP_DB_SCHEME @@ -934,7 +934,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - mariadb + - ${_APP_DB_SCHEME:-mariadb} - redis environment: - _APP_DB_SCHEME @@ -1055,7 +1055,7 @@ services: - MYSQL_DATABASE=${_APP_DB_SCHEMA} - MYSQL_USER=${_APP_DB_USER} - MYSQL_PASSWORD=${_APP_DB_PASS} - - MARIADB_AUTO_UPGRADE=1 + - ${_APP_DB_SCHEME:-mariadb}_AUTO_UPGRADE=1 command: "mysqld --innodb-flush-method=fsync" postgresql: From ba3413526dddc1a8049091d26d53e13c23d0851a Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 20 May 2025 19:01:25 +0530 Subject: [PATCH 29/96] removed trailing comma from the matrix db adapter of the test --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b9c5289105..13a5c01572 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -142,8 +142,8 @@ jobs: fail-fast: false matrix: db_adapter:[ - MARIADB - POSTGRESQL, + MARIADB, + POSTGRESQL ] service: [ From cce830e10383a741694db43a0e1e233e701c13d2 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 21 May 2025 17:36:50 +0530 Subject: [PATCH 30/96] added _APP_DB_ADAPTER --- .env | 2 +- .github/workflows/tests.yml | 6 +-- app/config/variables.php | 2 +- app/init/registers.php | 20 +++++-- app/views/install/compose.phtml | 38 ++++++------- docker-compose.yml | 72 ++++++++++++------------- src/Appwrite/Platform/Tasks/Install.php | 12 +---- src/Appwrite/Platform/Tasks/Upgrade.php | 2 +- 8 files changed, 78 insertions(+), 76 deletions(-) diff --git a/.env b/.env index 7d458a58fd..da418989bc 100644 --- a/.env +++ b/.env @@ -32,7 +32,7 @@ _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 _APP_REDIS_PASS= _APP_REDIS_USER= -_APP_DB_SCHEME=mariadb +_APP_DB_ADAPTER=mariadb _APP_DB_HOST=mariadb _APP_DB_PORT=3306 _APP_DB_SCHEMA=appwrite diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 13a5c01572..190c436283 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -203,12 +203,12 @@ jobs: # Set DB Adapter Specific ENV Vars using if-elif if [ "${{ matrix.db_adapter }}" = "MARIADB" ]; then - export _APP_DB_SCHEME=mariadb + export _APP_DB_ADAPTER=mariadb export _APP_DB_HOST=mariadb export _APP_DB_PORT=3306 export _APP_DB_SCHEMA=appwrite elif [ "${{ matrix.db_adapter }}" = "POSTGRESQL" ]; then - export _APP_DB_SCHEME=postgresql + export _APP_DB_ADAPTER=postgresql export _APP_DB_HOST=postgresql export _APP_DB_PORT=5432 export _APP_DB_SCHEMA=appwrite @@ -220,7 +220,7 @@ jobs: docker compose exec -T \ -e _APP_DATABASE_SHARED_TABLES \ -e _APP_DATABASE_SHARED_TABLES_V1 \ - -e _APP_DB_SCHEME \ + -e _APP_DB_ADAPTER \ -e _APP_DB_HOST \ -e _APP_DB_PORT \ -e _APP_DB_SCHEMA \ diff --git a/app/config/variables.php b/app/config/variables.php index ad0fb212ee..20d37be0f3 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -341,7 +341,7 @@ return [ 'filter' => '' ], [ - 'name' => '_APP_DB_SCHEME', + 'name' => '_APP_DB_ADAPTER', 'description' => 'To switch between mariadb and postgresql', 'introduction' => '1.6.0', 'default' => 'mariadb', diff --git a/app/init/registers.php b/app/init/registers.php index c9ba77ec4b..80b500c9a0 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -101,7 +101,7 @@ $register->set('pools', function () { $group = new Group(); $fallbackForDB = 'db_main=' . AppwriteURL::unparse([ - 'scheme' => System::getEnv('_APP_DB_SCHEME', 'mariadb'), + 'scheme' => System::getEnv('_APP_DB_ADAPTER', 'mariadb'), 'host' => System::getEnv('_APP_DB_HOST', 'mariadb'), 'port' => System::getEnv('_APP_DB_PORT', '3306'), 'user' => System::getEnv('_APP_DB_USER', ''), @@ -300,10 +300,20 @@ $register->set('db', function () { $dbUser = System::getEnv('_APP_DB_USER', ''); $dbPass = System::getEnv('_APP_DB_PASS', ''); $dbSchema = System::getEnv('_APP_DB_SCHEMA', ''); - $dbScheme = System::getEnv('_APP_DB_SCHEME', 'mariadb'); - $dsn = ($dbScheme === 'postgresql') - ? "pgsql:host={$dbHost};port={$dbPort};dbname={$dbSchema}" - : "mysql:host={$dbHost};port={$dbPort};dbname={$dbSchema};charset=utf8mb4"; + $dbAdapter = System::getEnv('_APP_DB_ADAPTER', 'mariadb'); + $dsn = ''; + + switch ($dbAdapter) { + case 'postgresql': + $dsn = "pgsql:host={$dbHost};port={$dbPort};dbname={$dbSchema}"; + break; + + case 'mysql': + case 'mariadb': + default: + $dsn = "mysql:host={$dbHost};port={$dbPort};dbname={$dbSchema};charset=utf8mb4"; + break; + } return new PDO( diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 6829d9b728..96f088c846 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -106,7 +106,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_SMTP_HOST - _APP_SMTP_PORT - _APP_SMTP_SECURE @@ -224,7 +224,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPTIONS_ABUSE @@ -254,7 +254,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -281,7 +281,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -317,7 +317,7 @@ $dbService = $this->getParam('database'); - appwrite-builds:/storage/builds:rw - appwrite-certificates:/storage/certificates:rw environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -374,7 +374,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -406,7 +406,7 @@ $dbService = $this->getParam('database'); - appwrite-builds:/storage/builds:rw - appwrite-uploads:/storage/uploads:rw environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -473,7 +473,7 @@ $dbService = $this->getParam('database'); - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -507,7 +507,7 @@ $dbService = $this->getParam('database'); - - openruntimes-executor environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -546,7 +546,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -584,7 +584,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -636,7 +636,7 @@ $dbService = $this->getParam('database'); depends_on: - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -670,7 +670,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN @@ -709,7 +709,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -739,7 +739,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -768,7 +768,7 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -797,7 +797,7 @@ $dbService = $this->getParam('database'); - - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -823,7 +823,7 @@ $dbService = $this->getParam('database'); - - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -849,7 +849,7 @@ $dbService = $this->getParam('database'); - - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 diff --git a/docker-compose.yml b/docker-compose.yml index c828125e32..915d5c315e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -88,7 +88,7 @@ services: - ./dev:/usr/src/code/dev - ./.env:/usr/src/code/.env depends_on: - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - redis # - clamav entrypoint: @@ -96,7 +96,7 @@ services: - -e - app/http.php environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_EDITION - _APP_WORKER_PER_CORE @@ -262,10 +262,10 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPTIONS_ABUSE @@ -296,9 +296,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -326,10 +326,10 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - request-catcher environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -356,7 +356,7 @@ services: - appwrite depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} volumes: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw @@ -367,7 +367,7 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -423,9 +423,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -459,9 +459,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -525,14 +525,14 @@ services: - appwrite depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} volumes: - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw - ./app:/usr/src/code/app - ./src:/usr/src/code/src environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -566,10 +566,10 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - openruntimes-executor environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -613,7 +613,7 @@ services: - maildev # - smtp environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -648,7 +648,7 @@ services: depends_on: - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -703,9 +703,9 @@ services: - ./src:/usr/src/code/src - ./tests:/usr/src/code/tests depends_on: - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -741,7 +741,7 @@ services: depends_on: - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN @@ -782,9 +782,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -814,9 +814,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -846,9 +846,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -877,10 +877,10 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -906,10 +906,10 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -934,10 +934,10 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_SCHEME:-mariadb} + - ${_APP_DB_ADAPTER:-mariadb} - redis environment: - - _APP_DB_SCHEME + - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -1055,7 +1055,7 @@ services: - MYSQL_DATABASE=${_APP_DB_SCHEMA} - MYSQL_USER=${_APP_DB_USER} - MYSQL_PASSWORD=${_APP_DB_PASS} - - ${_APP_DB_SCHEME:-mariadb}_AUTO_UPGRADE=1 + - ${_APP_DB_ADAPTER:-mariadb}_AUTO_UPGRADE=1 command: "mysqld --innodb-flush-method=fsync" postgresql: diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 1ac2fbac5f..387c8dbc56 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -42,14 +42,6 @@ class Install extends Action $defaultHTTPSPort = '443'; /** @var array> $vars array whre key is variable name and value is variable */ $vars = []; - $vars['_APP_DB_SCHEME'] = [ - 'name' => '_APP_DB_SCHEME', - 'default' => $database, - 'required' => true, - 'filter' => '', - 'overwrite' => true, - 'question' => 'Choose your database (mariadb|postgresql)', - ]; foreach ($config as $category) { foreach ($category['variables'] ?? [] as $var) { @@ -181,7 +173,7 @@ class Install extends Action continue; } - if ($var['name'] === '_APP_DB_SCHEME' && $data !== false) { + if ($var['name'] === '_APP_DB_ADAPTER' && $data !== false) { continue; } @@ -201,7 +193,7 @@ class Install extends Action } } } - $database = $input['_APP_DB_SCHEME']; + $database = $input['_APP_DB_ADAPTER']; if ($database === 'postgresql') { $input['_APP_DB_HOST'] = 'postgresql'; $input['_APP_DB_PORT'] = 5432; diff --git a/src/Appwrite/Platform/Tasks/Upgrade.php b/src/Appwrite/Platform/Tasks/Upgrade.php index ecf71d27a1..5b9a9e1f3a 100644 --- a/src/Appwrite/Platform/Tasks/Upgrade.php +++ b/src/Appwrite/Platform/Tasks/Upgrade.php @@ -41,7 +41,7 @@ class Upgrade extends Install Console::log(' └── docker-compose.yml'); Console::exit(1); } - $database = System::getEnv('_APP_DB_SCHEME', 'mariadb'); + $database = System::getEnv('_APP_DB_ADAPTER', 'mariadb'); parent::action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart, $database); } } From a0c974df42600e4fc215760150f4a9dee36e4c1a Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 21 May 2025 18:13:20 +0530 Subject: [PATCH 31/96] updated updating database in the installation --- docker-compose.yml | 1 - src/Appwrite/Platform/Tasks/Install.php | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 915d5c315e..89a142debe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -86,7 +86,6 @@ services: - ./public:/usr/src/code/public - ./src:/usr/src/code/src - ./dev:/usr/src/code/dev - - ./.env:/usr/src/code/.env depends_on: - ${_APP_DB_ADAPTER:-mariadb} - redis diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 387c8dbc56..550c50f4c9 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -174,6 +174,7 @@ class Install extends Action } if ($var['name'] === '_APP_DB_ADAPTER' && $data !== false) { + $input[$var['name']] = $database; continue; } From bf0bb1e2f67970764fcdf43d66eba92dd9744f82 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 21 May 2025 18:22:16 +0530 Subject: [PATCH 32/96] updated tests yml --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 190c436283..c40bca488e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -141,7 +141,7 @@ jobs: strategy: fail-fast: false matrix: - db_adapter:[ + db_adapter: [ MARIADB, POSTGRESQL ] From 15a76e598464d875fc942249bd3d4beabe9e7d84 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 27 May 2025 22:07:49 +0530 Subject: [PATCH 33/96] updated depends on to the host instead of adapter and changed to the grouping of env vars --- app/views/install/compose.phtml | 36 ++++++++--------- docker-compose.yml | 71 ++++++++++++++++----------------- 2 files changed, 53 insertions(+), 54 deletions(-) diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 96f088c846..24fe5c9337 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -224,7 +224,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPTIONS_ABUSE @@ -239,6 +238,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_USAGE_STATS - _APP_LOGGING_CONFIG @@ -254,7 +254,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -267,6 +266,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG appwrite-worker-webhooks: @@ -281,7 +281,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -292,6 +291,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -317,7 +317,6 @@ $dbService = $this->getParam('database'); - appwrite-builds:/storage/builds:rw - appwrite-certificates:/storage/certificates:rw environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -330,6 +329,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_STORAGE_DEVICE - _APP_STORAGE_S3_ACCESS_KEY - _APP_STORAGE_S3_SECRET @@ -374,7 +374,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -387,6 +386,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG appwrite-worker-builds: @@ -406,7 +406,6 @@ $dbService = $this->getParam('database'); - appwrite-builds:/storage/builds:rw - appwrite-uploads:/storage/uploads:rw environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -421,6 +420,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_VCS_GITHUB_APP_NAME - _APP_VCS_GITHUB_PRIVATE_KEY @@ -473,7 +473,6 @@ $dbService = $this->getParam('database'); - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -492,6 +491,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG appwrite-worker-functions: @@ -507,7 +507,6 @@ $dbService = $this->getParam('database'); - - openruntimes-executor environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -522,6 +521,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_FUNCTIONS_TIMEOUT - _APP_SITES_TIMEOUT - _APP_COMPUTE_BUILD_TIMEOUT @@ -546,7 +546,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -557,6 +556,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -584,7 +584,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -597,6 +596,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_SMS_FROM - _APP_SMS_PROVIDER @@ -636,7 +636,6 @@ $dbService = $this->getParam('database'); depends_on: - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -654,6 +653,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_MIGRATIONS_FIREBASE_CLIENT_ID - _APP_MIGRATIONS_FIREBASE_CLIENT_SECRET @@ -670,7 +670,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN @@ -688,6 +687,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_MAINTENANCE_INTERVAL - _APP_MAINTENANCE_RETENTION_EXECUTION - _APP_MAINTENANCE_RETENTION_CACHE @@ -709,7 +709,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -718,6 +717,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -739,7 +739,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -748,6 +747,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -768,7 +768,6 @@ $dbService = $this->getParam('database'); - redis - environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -777,6 +776,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -797,7 +797,6 @@ $dbService = $this->getParam('database'); - - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -810,6 +809,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER appwrite-task-scheduler-executions: image: /: @@ -823,7 +823,6 @@ $dbService = $this->getParam('database'); - - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -836,6 +835,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER appwrite-task-scheduler-messages: image: /: @@ -849,7 +849,6 @@ $dbService = $this->getParam('database'); - - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -862,6 +861,7 @@ $dbService = $this->getParam('database'); - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER appwrite-assistant: image: appwrite/assistant:0.4.0 diff --git a/docker-compose.yml b/docker-compose.yml index 89a142debe..dc80e3f4ce 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -87,7 +87,7 @@ services: - ./src:/usr/src/code/src - ./dev:/usr/src/code/dev depends_on: - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - redis # - clamav entrypoint: @@ -95,7 +95,6 @@ services: - -e - app/http.php environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_EDITION - _APP_WORKER_PER_CORE @@ -130,6 +129,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_SMTP_HOST - _APP_SMTP_PORT - _APP_SMTP_SECURE @@ -261,10 +261,9 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPTIONS_ABUSE @@ -279,6 +278,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_USAGE_STATS - _APP_LOGGING_CONFIG - _APP_DATABASE_SHARED_TABLES @@ -295,9 +295,8 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -310,6 +309,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_DATABASE_SHARED_TABLES @@ -325,10 +325,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - request-catcher environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -338,6 +337,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -355,7 +355,7 @@ services: - appwrite depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} volumes: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw @@ -366,7 +366,6 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -379,6 +378,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_STORAGE_DEVICE - _APP_STORAGE_S3_ACCESS_KEY - _APP_STORAGE_S3_SECRET @@ -422,9 +422,8 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -437,6 +436,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_WORKERS_NUM - _APP_QUEUE_NAME @@ -458,9 +458,8 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -475,6 +474,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_VCS_GITHUB_APP_NAME - _APP_VCS_GITHUB_PRIVATE_KEY @@ -524,14 +524,13 @@ services: - appwrite depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} volumes: - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw - ./app:/usr/src/code/app - ./src:/usr/src/code/src environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -550,6 +549,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_DATABASE_SHARED_TABLES @@ -565,10 +565,9 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - openruntimes-executor environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -583,6 +582,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_FUNCTIONS_TIMEOUT - _APP_SITES_TIMEOUT - _APP_COMPUTE_BUILD_TIMEOUT @@ -612,7 +612,6 @@ services: - maildev # - smtp environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -647,7 +646,6 @@ services: depends_on: - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -660,6 +658,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_SMS_FROM - _APP_SMS_PROVIDER @@ -702,9 +701,8 @@ services: - ./src:/usr/src/code/src - ./tests:/usr/src/code/tests depends_on: - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -722,6 +720,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_LOGGING_CONFIG - _APP_MIGRATIONS_FIREBASE_CLIENT_ID - _APP_MIGRATIONS_FIREBASE_CLIENT_SECRET @@ -740,7 +739,6 @@ services: depends_on: - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN @@ -758,6 +756,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_MAINTENANCE_INTERVAL - _APP_MAINTENANCE_RETENTION_EXECUTION - _APP_MAINTENANCE_RETENTION_CACHE @@ -781,9 +780,8 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -792,6 +790,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -813,9 +812,8 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -824,6 +822,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -845,9 +844,8 @@ services: - ./src:/usr/src/code/src depends_on: - redis - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -856,6 +854,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_REDIS_HOST - _APP_REDIS_PORT - _APP_REDIS_USER @@ -876,10 +875,9 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -892,6 +890,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_DATABASE_SHARED_TABLES appwrite-task-scheduler-executions: @@ -905,10 +904,9 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -921,6 +919,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER appwrite-task-scheduler-messages: entrypoint: schedule-messages @@ -933,10 +932,9 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_ADAPTER:-mariadb} + - ${_APP_DB_HOST:-mariadb} - redis environment: - - _APP_DB_ADAPTER - _APP_ENV - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 @@ -949,6 +947,7 @@ services: - _APP_DB_SCHEMA - _APP_DB_USER - _APP_DB_PASS + - _APP_DB_ADAPTER - _APP_DATABASE_SHARED_TABLES appwrite-assistant: @@ -1054,7 +1053,7 @@ services: - MYSQL_DATABASE=${_APP_DB_SCHEMA} - MYSQL_USER=${_APP_DB_USER} - MYSQL_PASSWORD=${_APP_DB_PASS} - - ${_APP_DB_ADAPTER:-mariadb}_AUTO_UPGRADE=1 + - MARIADB_AUTO_UPGRADE=1 command: "mysqld --innodb-flush-method=fsync" postgresql: From 74dcfc28c7d44c9bf745d7f69874606e141ea925 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 29 Dec 2025 17:17:04 +0530 Subject: [PATCH 34/96] removed duplicate postgresql from pool --- app/init/registers.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/app/init/registers.php b/app/init/registers.php index 858d088664..146d763c69 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -284,17 +284,6 @@ $register->set('pools', function () { )); }); }, - 'postgresql' => function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { - return new PDOProxy(function () use ($dsnHost, $dsnPort, $dsnUser, $dsnPass, $dsnDatabase) { - return new PDO("pgsql:host={$dsnHost};port={$dsnPort};dbname={$dsnDatabase}", $dsnUser, $dsnPass, array( - \PDO::ATTR_TIMEOUT => 3, // Seconds - \PDO::ATTR_PERSISTENT => false, - \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC, - \PDO::ATTR_EMULATE_PREPARES => true, - \PDO::ATTR_STRINGIFY_FETCHES => true - )); - }); - }, 'redis' => function () use ($dsnHost, $dsnPort, $dsnPass) { $redis = new \Redis(); @$redis->pconnect($dsnHost, (int)$dsnPort); From 88e2d5c49608ca75b1c379d6aeae680724f1eac5 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 6 Feb 2026 11:44:44 +0530 Subject: [PATCH 35/96] updated compose --- docker-compose.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1dfcd09e07..5b65a6f8c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -660,7 +660,10 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - ${_APP_DB_HOST:-mariadb:} + - mariadb: + condition: service_started + - postgresql: + condition: service_started - redis: condition: service_started - openruntimes-executor: From 6eaebaec1bfede9236a335be0429ec7de7434a02 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 6 Feb 2026 11:49:41 +0530 Subject: [PATCH 36/96] updated compose --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5b65a6f8c7..5ed609fb10 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -660,13 +660,13 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - - mariadb: + mariadb: condition: service_started - - postgresql: + postgresql: condition: service_started - - redis: + redis: condition: service_started - - openruntimes-executor: + openruntimes-executor: condition: service_healthy environment: - _APP_ENV From 4396a0ef7e373b719adc42bc78bc15d4540c76eb Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 28 Aug 2025 19:06:18 +0530 Subject: [PATCH 37/96] added processing of migration resource stats --- src/Appwrite/Platform/Workers/Migrations.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 649f62609b..01203aa394 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -25,6 +25,10 @@ use Utopia\Migration\Destination; use Utopia\Migration\Destinations\Appwrite as DestinationAppwrite; use Utopia\Migration\Destinations\CSV as DestinationCSV; use Utopia\Migration\Exception as MigrationException; +use Utopia\Migration\Resource; +use Utopia\Migration\Resources\Database\Database as ResourceDatabase; +use Utopia\Migration\Resources\Database\Row as ResourceRow; +use Utopia\Migration\Resources\Database\Table as ResourceTable; use Utopia\Migration\Source; use Utopia\Migration\Sources\Appwrite as SourceAppwrite; use Utopia\Migration\Sources\CSV; @@ -52,6 +56,7 @@ class Migrations extends Action */ protected array $sourceReport = []; + private string $source; /** * @var callable|null */ @@ -368,6 +373,7 @@ class Migrations extends Action $destination ); + $aggregatedResources = []; /** Start Transfer */ if (empty($source->getErrors())) { $migration->setAttribute('stage', 'migrating'); @@ -375,10 +381,14 @@ class Migrations extends Action $transfer->run( $migration->getAttribute('resources'), - function () use ($migration, $transfer, $project, $queueForRealtime) { + function ($resources) use ($migration, $transfer, $project, $queueForRealtime, &$aggregatedResources) { $migration->setAttribute('resourceData', json_encode($transfer->getCache())); $migration->setAttribute('statusCounters', json_encode($transfer->getStatusCounters())); - $this->updateMigrationDocument($migration, $project, $queueForRealtime); + + if (!empty($resources)) { + $aggregatedResources[] = $resources; + } + $this->updateMigrationDocument($migration, $projectDocument, $queueForRealtime); }, $migration->getAttribute('resourceId'), $migration->getAttribute('resourceType') From b517e502a94bec8cb90bd3f0b25373dc207c63ac Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 28 Aug 2025 19:10:00 +0530 Subject: [PATCH 38/96] lint From 532ec364d2c6996e65bed2a4aade7b890352c25c Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 28 Aug 2025 19:13:24 +0530 Subject: [PATCH 39/96] updated migration version From bf841442017a15af94e1ad74432ac57edd49d602 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 28 Aug 2025 19:14:14 +0530 Subject: [PATCH 40/96] updated reset of the stats usage worker to reset metrics --- src/Appwrite/Event/StatsUsage.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Appwrite/Event/StatsUsage.php b/src/Appwrite/Event/StatsUsage.php index 47ba5a3ea0..a944d70c94 100644 --- a/src/Appwrite/Event/StatsUsage.php +++ b/src/Appwrite/Event/StatsUsage.php @@ -86,4 +86,11 @@ class StatsUsage extends Event }), ]; } + + public function reset(): Event + { + $this->metrics = []; + parent::reset(); + return $this; + } } From 799776353207f109c86784c2e52d58e1c72b5afb Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 28 Aug 2025 19:21:11 +0530 Subject: [PATCH 41/96] linting --- src/Appwrite/Platform/Workers/Migrations.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 01203aa394..9585ee198e 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -388,7 +388,7 @@ class Migrations extends Action if (!empty($resources)) { $aggregatedResources[] = $resources; } - $this->updateMigrationDocument($migration, $projectDocument, $queueForRealtime); + $this->updateMigrationDocument($migration, $project, $queueForRealtime); }, $migration->getAttribute('resourceId'), $migration->getAttribute('resourceType') From 6c38c566d9a64f038aad4093ea734e1c5265ffaa Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 28 Aug 2025 19:59:48 +0530 Subject: [PATCH 42/96] optimised the memory usage by resource aggregation --- src/Appwrite/Platform/Workers/Migrations.php | 29 +++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 9585ee198e..e453625456 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -386,7 +386,34 @@ class Migrations extends Action $migration->setAttribute('statusCounters', json_encode($transfer->getStatusCounters())); if (!empty($resources)) { - $aggregatedResources[] = $resources; + /** + * @var Resource $resource + */ + $resource = $resources[0]; + $count = count($resources); + $databaseId = null; + $tableId = null; + switch ($resource->getName()) { + case ResourceTable::getName(): + /** @var ResourceTable $resource */ + $databaseId = $resource->getDatabase()->getSequence(); + break; + case ResourceRow::getName(): + /** @var ResourceRow $resource */ + $table = $resource->getTable(); + $databaseId = $table->getDatabase()->getSequence(); + $tableId = $table->getSequence(); + break; + default: + break; + } + $aggregatedResources[] = [ + "name" => $resource->getName(), + "count" => $count, + "databaseId" => $databaseId, + "tableId" => $tableId + ]; + } $this->updateMigrationDocument($migration, $project, $queueForRealtime); }, From a3574032e3ed496192208edded98a14ebf2bf35e Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 29 Aug 2025 02:48:31 +1200 Subject: [PATCH 43/96] Update src/Appwrite/Platform/Workers/Migrations.php --- src/Appwrite/Platform/Workers/Migrations.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index e453625456..8601012d00 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -408,10 +408,10 @@ class Migrations extends Action break; } $aggregatedResources[] = [ - "name" => $resource->getName(), - "count" => $count, - "databaseId" => $databaseId, - "tableId" => $tableId + 'name' => $resource->getName(), + 'count' => $count, + 'databaseId' => $databaseId, + 'tableId' => $tableId ]; } From 96532b9725b571e57f25ad4a33c2afa437f7f775 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 6 Feb 2026 18:47:22 +0530 Subject: [PATCH 44/96] linting --- src/Appwrite/Platform/Workers/Migrations.php | 68 ++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 8601012d00..cfacc0f450 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Workers; use Ahc\Jwt\JWT; use Appwrite\Event\Mail; use Appwrite\Event\Realtime; +use Appwrite\Event\StatsUsage; use Appwrite\Extend\Exception; use Appwrite\Template\Template; use Utopia\CLI\Console; @@ -83,6 +84,7 @@ class Migrations extends Action ->inject('deviceForMigrations') ->inject('deviceForFiles') ->inject('queueForMails') + ->inject('queueForStatsUsage') ->inject('plan') ->inject('authorization') ->callback($this->action(...)); @@ -101,6 +103,7 @@ class Migrations extends Action Device $deviceForMigrations, Device $deviceForFiles, Mail $queueForMails, + StatsUsage $queueForStatsUsage, array $plan, Authorization $authorization, ): void { @@ -144,6 +147,7 @@ class Migrations extends Action $migration, $queueForRealtime, $queueForMails, + $queueForStatsUsage, $platform, $authorization ); @@ -329,6 +333,7 @@ class Migrations extends Action Document $migration, Realtime $queueForRealtime, Mail $queueForMails, + StatsUsage $queueForStatsUsage, array $platform, Authorization $authorization, ): void { @@ -480,6 +485,16 @@ class Migrations extends Action } if ($migration->getAttribute('status', '') === 'completed') { + foreach ($aggregatedResources as $resource) { + $this->processMigrationResourceStats( + $resource, + $queueForStatsUsage, + $project, + $migration->getAttribute('source'), + $authorization, + $migration->getAttribute('resourceId') + ); + } $destination?->success(); $source?->success(); @@ -774,4 +789,57 @@ class Migrations extends Action return $errors; } + + private function processMigrationResourceStats(array $resources, StatsUsage $queueForStatsUsage, Document $projectDocument, string $source, Authorization $authorization, ?string $resourceId) + { + $resourceName = $resources['name']; + $count = $resources['count']; + $databaseInternalId = $resources['databaseId']; + $tableInternalId = $resources['tableId']; + + if ($source === CSV::getName()) { + [$databaseId, $tableId] = explode(':', $resourceId); + $database = $authorization->skip(fn () => $this->dbForProject->getDocument('databases', $databaseId)); + $table = $authorization->skip(fn () => $this->dbForProject->getDocument('database_' . $database->getSequence(), $tableId)); + $databaseInternalId = (int) $database->getSequence(); + $tableInternalId = (int) $table->getSequence(); + } + + switch ($resourceName) { + case ResourceDatabase::getName(): + $queueForStatsUsage->addMetric(METRIC_DATABASES, $count); + break; + + case ResourceTable::getName(): + $queueForStatsUsage + ->addMetric(METRIC_COLLECTIONS, $count) + ->addMetric( + str_replace('{databaseInternalId}', $databaseInternalId, METRIC_DATABASE_ID_COLLECTIONS), + $count + ); + break; + + case ResourceRow::getName(): + $queueForStatsUsage + ->addMetric( + str_replace( + ['{databaseInternalId}','{collectionInternalId}'], + [$databaseInternalId, $tableInternalId], + METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS + ), + $count + ) + ->addMetric( + str_replace('{databaseInternalId}', $databaseInternalId, METRIC_DATABASE_ID_DOCUMENTS), + $count + ); + break; + + default: + break; + } + + $queueForStatsUsage->setProject($projectDocument)->trigger(); + $queueForStatsUsage->reset(); + } } From 7faf14769f3b1c3ce2ff8c4531fe0876b9062e74 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 6 Feb 2026 19:10:00 +0530 Subject: [PATCH 45/96] added metric documents --- src/Appwrite/Platform/Workers/Migrations.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index cfacc0f450..e559dc0787 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -832,7 +832,8 @@ class Migrations extends Action ->addMetric( str_replace('{databaseInternalId}', $databaseInternalId, METRIC_DATABASE_ID_DOCUMENTS), $count - ); + ) + ->addMetric(METRIC_DOCUMENTS, $count); break; default: From 3c78f78ea99423106ad3f99d46cd6e348557b3d7 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 9 Feb 2026 02:54:40 +0000 Subject: [PATCH 46/96] Fix: chunk upload handling for single chunk uploads --- .../Platform/Modules/Storage/Http/Buckets/Files/Create.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php index 4757461a98..a60fb983a7 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php @@ -256,6 +256,12 @@ class Create extends Action if ($uploaded === $chunks) { throw new Exception(Exception::STORAGE_FILE_ALREADY_EXISTS); } + } else { + // Guard against manually setting range header for single chunk upload + if ($chunks === -1) { + $chunks = 1; + $chunk = 1; + } } $chunksUploaded = $deviceForFiles->upload($fileTmpName, $path, $chunk, $chunks, $metadata); From 81f4d10ad6df7506bd66d676b850b193adee6fa7 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 9 Feb 2026 11:48:04 +0530 Subject: [PATCH 47/96] Enhance Realtime channel handling for project queries and improve test coverage --- app/init/resources.php | 4 + app/realtime.php | 3 +- src/Appwrite/Messaging/Adapter/Realtime.php | 12 +- tests/e2e/Services/Realtime/RealtimeBase.php | 21 +++ .../RealtimeCustomClientQueryTest.php | 152 ++++++++++++++++++ 5 files changed, 190 insertions(+), 2 deletions(-) diff --git a/app/init/resources.php b/app/init/resources.php index 8f78df1573..55b7644488 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -520,6 +520,10 @@ Http::setResource('project', function ($dbForPlatform, $request, $console, $auth /** @var Utopia\Database\Document $console */ $projectId = $request->getParam('project', $request->getHeader('x-appwrite-project', '')); + // Realtime channel "project" can send project=Query array + if (!\is_string($projectId)) { + $projectId = $request->getHeader('x-appwrite-project', ''); + } if (empty($projectId) || $projectId === 'console') { return $console; diff --git a/app/realtime.php b/app/realtime.php index 97e7465683..6b698c356f 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -717,7 +717,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, } }); -$server->onMessage(function (int $connection, string $message) use ($server, $register, $realtime, $containerId) { +$server->onMessage(function (int $connection, string $message) use ($server, $register, $realtime, $containerId, $logError) { try { $response = new Response(new SwooleResponse()); $projectId = $realtime->connections[$connection]['projectId'] ?? null; @@ -840,6 +840,7 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'Message type is not valid.'); } } catch (Throwable $th) { + $logError($th, "realtimeMessage"); $code = $th->getCode(); if (!is_int($code)) { $code = 500; diff --git a/src/Appwrite/Messaging/Adapter/Realtime.php b/src/Appwrite/Messaging/Adapter/Realtime.php index 51aad2a635..7ff19a1d63 100644 --- a/src/Appwrite/Messaging/Adapter/Realtime.php +++ b/src/Appwrite/Messaging/Adapter/Realtime.php @@ -344,8 +344,18 @@ class Realtime extends MessagingAdapter { $subscriptions = []; + // Param names that must not be treated as subscription queries for same-named channels if string: + $reservedParamNames = ['project']; + foreach ($channelNames as $channel) { - $params = $getQueryParam(\str_replace('.', '_', $channel)); + $paramKey = \str_replace('.', '_', $channel); + $params = $getQueryParam($paramKey); + + if (\in_array($paramKey, $reservedParamNames, true)) { + if (\is_string($paramKey)) { + $params = null; + } + } if ($params === null) { if (!isset($subscriptions[0])) { diff --git a/tests/e2e/Services/Realtime/RealtimeBase.php b/tests/e2e/Services/Realtime/RealtimeBase.php index 1b77c0ad4a..92d29ba3a3 100644 --- a/tests/e2e/Services/Realtime/RealtimeBase.php +++ b/tests/e2e/Services/Realtime/RealtimeBase.php @@ -68,6 +68,27 @@ trait RealtimeBase ); } + /** + * Build WebSocket client with custom query parameters. + * Useful for testing edge cases like project in header only, or project as Query array. + * + * @param array $queryParams Custom query parameters (e.g., ['channels' => ['project'], 'project' => [...]]) + * @param array $headers HTTP headers + * @return WebSocketClient + */ + private function getWebsocketWithCustomQuery(array $queryParams, array $headers = []): WebSocketClient + { + $queryString = http_build_query($queryParams); + + return new WebSocketClient( + "ws://appwrite.test/v1/realtime?" . $queryString, + [ + "headers" => $headers, + "timeout" => 30, + ] + ); + } + public function testConnection(): void { /** diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php index 37ea1e2e05..030b917989 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php @@ -2262,4 +2262,156 @@ class RealtimeCustomClientQueryTest extends Scope $client->close(); } + + public function testProjectChannelWithQuery() + { + $user = $this->getUser(); + $session = $user['session'] ?? ''; + $projectId = $this->getProject()['$id']; + + // Test OLD SDK behavior: project=projectId (string) in query param + // The reserved param logic should treat string project param as project ID, not as subscription queries + $clientOldSdk = $this->getWebsocket(['project'], [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + ], $projectId, null); + + $response = json_decode($clientOldSdk->receive(), true); + $this->assertEquals('connected', $response['type']); + $this->assertContains('project', $response['data']['channels']); + // Should have default select(['*']) subscription since project param was treated as project ID, not queries + $this->assertArrayHasKey('subscriptions', $response['data']); + $this->assertIsArray($response['data']['subscriptions']); + $this->assertNotEmpty($response['data']['subscriptions']); + + $clientOldSdk->close(); + + // Test NEW SDK behavior: project=Query array in query param, project ID in header + // The reserved param logic should use Query array as subscription queries for project channel + $queryArray = [Query::select(['*'])->toString()]; + $clientNewSdk = $this->getWebsocketWithCustomQuery( + [ + 'channels' => ['project'], + 'project' => [ + 0 => [ + 0 => $queryArray[0] + ] + ] + ], + [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + 'x-appwrite-project' => $projectId, + ] + ); + + $response = json_decode($clientNewSdk->receive(), true); + $this->assertEquals('connected', $response['type']); + $this->assertContains('project', $response['data']['channels']); + // Should have subscription with the provided query + $this->assertArrayHasKey('subscriptions', $response['data']); + $this->assertIsArray($response['data']['subscriptions']); + $this->assertNotEmpty($response['data']['subscriptions']); + + $clientNewSdk->close(); + + // Test edge case: project param is array but not a valid Query array (should still connect, use header) + $clientEdgeCase = $this->getWebsocketWithCustomQuery( + [ + 'channels' => ['project'], + 'project' => ['invalid', 'array'] + ], + [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + 'x-appwrite-project' => $projectId, + ] + ); + + $response = json_decode($clientEdgeCase->receive(), true); + // Should connect successfully using header for project ID + $this->assertEquals('connected', $response['type']); + $this->assertContains('project', $response['data']['channels']); + + $clientEdgeCase->close(); + } + + public function testProjectChannelWithHeaderOnly() + { + $user = $this->getUser(); + $session = $user['session'] ?? ''; + $projectId = $this->getProject()['$id']; + + // Test: project ID only in header, no project query param + // This simulates a client that only uses x-appwrite-project header + $client = $this->getWebsocketWithCustomQuery( + [ + 'channels' => ['project'] + ], + [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + 'x-appwrite-project' => $projectId, + ] + ); + + $response = json_decode($client->receive(), true); + $this->assertEquals('connected', $response['type']); + $this->assertContains('project', $response['data']['channels']); + // Should have default select(['*']) subscription since no project query param + $this->assertArrayHasKey('subscriptions', $response['data']); + $this->assertIsArray($response['data']['subscriptions']); + $this->assertNotEmpty($response['data']['subscriptions']); + + $client->close(); + + // Test: project channel with queries, project ID only in header + $queryArray = [Query::select(['*'])->toString()]; + $clientWithQuery = $this->getWebsocketWithCustomQuery( + [ + 'channels' => ['project'], + 'project' => [ + 0 => [ + 0 => $queryArray[0] + ] + ] + ], + [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + 'x-appwrite-project' => $projectId, + ] + ); + + $response = json_decode($clientWithQuery->receive(), true); + $this->assertEquals('connected', $response['type']); + $this->assertContains('project', $response['data']['channels']); + $this->assertArrayHasKey('subscriptions', $response['data']); + $this->assertIsArray($response['data']['subscriptions']); + $this->assertNotEmpty($response['data']['subscriptions']); + + $clientWithQuery->close(); + + // Test: channels channel (reserved param) should not parse channels list as queries + $clientChannelsChannel = $this->getWebsocketWithCustomQuery( + [ + 'channels' => ['channels'] + ], + [ + 'origin' => 'http://localhost', + 'cookie' => 'a_session_' . $projectId . '=' . $session, + 'x-appwrite-project' => $projectId, + ] + ); + + $response = json_decode($clientChannelsChannel->receive(), true); + $this->assertEquals('connected', $response['type']); + $this->assertContains('channels', $response['data']['channels']); + // Should have default select(['*']) since channels param is reserved + $this->assertArrayHasKey('subscriptions', $response['data']); + $this->assertIsArray($response['data']['subscriptions']); + $this->assertNotEmpty($response['data']['subscriptions']); + + $clientChannelsChannel->close(); + } } From 842c274d02e0af2bbdfde88e9e4839bfcdc47398 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 9 Feb 2026 11:55:39 +0530 Subject: [PATCH 48/96] updated tests --- .../RealtimeCustomClientQueryTest.php | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php index 030b917989..468bd2592f 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php @@ -2414,4 +2414,63 @@ class RealtimeCustomClientQueryTest extends Scope $clientChannelsChannel->close(); } + + public function testTestsChannelWithQueries() + { + $projectId = 'console'; + + // Subscribe without queries - should receive all events + $clientNoQuery = $this->getWebsocket(['tests'], [ + 'origin' => 'http://localhost', + ], $projectId); + + $response = json_decode($clientNoQuery->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Subscribe with matching query - should receive events + $clientWithMatchingQuery = $this->getWebsocket(['tests'], [ + 'origin' => 'http://localhost', + ], $projectId, [ + Query::equal('response', ['WS:/v1/realtime:passed'])->toString(), + ]); + + $response = json_decode($clientWithMatchingQuery->receive(), true); + $this->assertEquals('connected', $response['type']); + + // Subscribe with non-matching query - should NOT receive events + $clientWithNonMatchingQuery = $this->getWebsocket(['tests'], [ + 'origin' => 'http://localhost', + ], $projectId, [ + Query::equal('response', ['failed'])->toString(), + ]); + + $response = json_decode($clientWithNonMatchingQuery->receive(), true); + $this->assertEquals('connected', $response['type']); + + sleep(6); + + // Client without query should receive event + $eventNoQuery = json_decode($clientNoQuery->receive(), true); + $this->assertEquals('event', $eventNoQuery['type']); + $this->assertEquals('test.event', $eventNoQuery['data']['events'][0]); + $this->assertEquals('WS:/v1/realtime:passed', $eventNoQuery['data']['payload']['response']); + + // Client with matching query should receive event + $eventMatching = json_decode($clientWithMatchingQuery->receive(), true); + $this->assertEquals('event', $eventMatching['type']); + $this->assertEquals('test.event', $eventMatching['data']['events'][0]); + $this->assertEquals('WS:/v1/realtime:passed', $eventMatching['data']['payload']['response']); + + // Client with non-matching query should NOT receive event + try { + $clientWithNonMatchingQuery->receive(); + $this->fail('Expected TimeoutException - client with non-matching query should not receive event'); + } catch (TimeoutException $e) { + $this->assertTrue(true); + } + + $clientNoQuery->close(); + $clientWithMatchingQuery->close(); + $clientWithNonMatchingQuery->close(); + } } From ecea1a580d5b49a47ab03c611e723eede1eee027 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 9 Feb 2026 12:02:01 +0530 Subject: [PATCH 49/96] updated channels --- .../RealtimeCustomClientQueryTest.php | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php index 468bd2592f..d3277f6778 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php @@ -2391,28 +2391,6 @@ class RealtimeCustomClientQueryTest extends Scope $this->assertNotEmpty($response['data']['subscriptions']); $clientWithQuery->close(); - - // Test: channels channel (reserved param) should not parse channels list as queries - $clientChannelsChannel = $this->getWebsocketWithCustomQuery( - [ - 'channels' => ['channels'] - ], - [ - 'origin' => 'http://localhost', - 'cookie' => 'a_session_' . $projectId . '=' . $session, - 'x-appwrite-project' => $projectId, - ] - ); - - $response = json_decode($clientChannelsChannel->receive(), true); - $this->assertEquals('connected', $response['type']); - $this->assertContains('channels', $response['data']['channels']); - // Should have default select(['*']) since channels param is reserved - $this->assertArrayHasKey('subscriptions', $response['data']); - $this->assertIsArray($response['data']['subscriptions']); - $this->assertNotEmpty($response['data']['subscriptions']); - - $clientChannelsChannel->close(); } public function testTestsChannelWithQueries() From 4b3c4323eeb30bad83f70478b48ee33764915064 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 9 Feb 2026 13:07:11 +0530 Subject: [PATCH 50/96] Enhance reserved parameter handling in Realtime adapter and update related tests --- app/realtime.php | 4 +-- src/Appwrite/Messaging/Adapter/Realtime.php | 27 ++++++++++++++----- .../RealtimeCustomClientQueryTest.php | 13 +++++---- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/app/realtime.php b/app/realtime.php index 6b698c356f..0c5d041dc9 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -690,11 +690,11 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, $code = 500; } - $message = $th->getMessage(); // sanitize 0 && 5xx errors - if (($code === 0 || $code >= 500) && !Http::isDevelopment()) { + $realtimeViolation = $th instanceof AppwriteException && $th->getType() === AppwriteException::REALTIME_POLICY_VIOLATION; + if (($code === 0 || $code >= 500) && !$realtimeViolation && !Http::isDevelopment()) { $message = 'Error: Server Error'; } diff --git a/src/Appwrite/Messaging/Adapter/Realtime.php b/src/Appwrite/Messaging/Adapter/Realtime.php index 7ff19a1d63..8f6add2201 100644 --- a/src/Appwrite/Messaging/Adapter/Realtime.php +++ b/src/Appwrite/Messaging/Adapter/Realtime.php @@ -344,15 +344,28 @@ class Realtime extends MessagingAdapter { $subscriptions = []; - // Param names that must not be treated as subscription queries for same-named channels if string: - $reservedParamNames = ['project']; + /** + * Reserved channel params with expected type + * If matched the expected type then skip the query parsing like in project + */ + $reservedParamExpectedTypes = [ + 'project' => 'string', + ]; foreach ($channelNames as $channel) { $paramKey = \str_replace('.', '_', $channel); $params = $getQueryParam($paramKey); - if (\in_array($paramKey, $reservedParamNames, true)) { - if (\is_string($paramKey)) { + if (\array_key_exists($paramKey, $reservedParamExpectedTypes) && $params !== null) { + $expectedType = $reservedParamExpectedTypes[$paramKey]; + $isRoutingType = match ($expectedType) { + 'array' => \is_array($params), + 'string' => \is_string($params), + default => false, + }; + + // If the value matches the expected routing type, do NOT use it as queries + if ($isRoutingType) { $params = null; } } @@ -368,7 +381,7 @@ class Realtime extends MessagingAdapter continue; } - if (!is_array($params)) { + if (!\is_array($params)) { $params = [$params]; } @@ -377,12 +390,12 @@ class Realtime extends MessagingAdapter $subscriptions[$index] = ['channels' => [], 'queries' => []]; } - if (!in_array($channel, $subscriptions[$index]['channels'])) { + if (!\in_array($channel, $subscriptions[$index]['channels'], true)) { $subscriptions[$index]['channels'][] = $channel; } if (empty($subscriptions[$index]['queries'])) { - $raw = is_array($slot) ? $slot : [$slot]; + $raw = \is_array($slot) ? $slot : [$slot]; $subscriptions[$index]['queries'] = self::convertQueries($raw); } } diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php index d3277f6778..b1fbb14bbb 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php @@ -2270,7 +2270,8 @@ class RealtimeCustomClientQueryTest extends Scope $projectId = $this->getProject()['$id']; // Test OLD SDK behavior: project=projectId (string) in query param - // The reserved param logic should treat string project param as project ID, not as subscription queries + // For reserved \"project\" param, string is treated as routing-only (project ID), + // and is not used as queries for the project channel. We should fall back to select(*). $clientOldSdk = $this->getWebsocket(['project'], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_' . $projectId . '=' . $session, @@ -2315,7 +2316,8 @@ class RealtimeCustomClientQueryTest extends Scope $clientNewSdk->close(); - // Test edge case: project param is array but not a valid Query array (should still connect, use header) + // Test edge case: project param is array but not a valid Query array + // This should now fail with an invalid query error rather than silently falling back. $clientEdgeCase = $this->getWebsocketWithCustomQuery( [ 'channels' => ['project'], @@ -2329,11 +2331,8 @@ class RealtimeCustomClientQueryTest extends Scope ); $response = json_decode($clientEdgeCase->receive(), true); - // Should connect successfully using header for project ID - $this->assertEquals('connected', $response['type']); - $this->assertContains('project', $response['data']['channels']); - - $clientEdgeCase->close(); + $this->assertEquals('error', $response['type']); + $this->assertStringContainsString('Invalid query', $response['data']['message']); } public function testProjectChannelWithHeaderOnly() From 6afb5ccf10e07b6e2b7afcd673dfa9f476f3679a Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Mon, 9 Feb 2026 13:08:02 +0530 Subject: [PATCH 51/96] updated the comments --- src/Appwrite/Messaging/Adapter/Realtime.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Messaging/Adapter/Realtime.php b/src/Appwrite/Messaging/Adapter/Realtime.php index 8f6add2201..e61cfdc116 100644 --- a/src/Appwrite/Messaging/Adapter/Realtime.php +++ b/src/Appwrite/Messaging/Adapter/Realtime.php @@ -358,14 +358,14 @@ class Realtime extends MessagingAdapter if (\array_key_exists($paramKey, $reservedParamExpectedTypes) && $params !== null) { $expectedType = $reservedParamExpectedTypes[$paramKey]; - $isRoutingType = match ($expectedType) { + $isExpectedType = match ($expectedType) { 'array' => \is_array($params), 'string' => \is_string($params), default => false, }; - // If the value matches the expected routing type, do NOT use it as queries - if ($isRoutingType) { + // If the value matches the expected type dont use it the queries + if ($isExpectedType) { $params = null; } } From 36c87d109a4d9a7d5f79056a38fd938197c4fe7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 13:45:18 +0100 Subject: [PATCH 52/96] Fix rule oauth flow --- app/controllers/api/account.php | 20 ++++++++++++++++++-- src/Appwrite/Network/Validator/Origin.php | 21 +++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index bc84ae7ef6..8d819d429d 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -64,7 +64,6 @@ use Utopia\Http; use Utopia\Locale\Locale; use Utopia\Storage\Validator\FileName; use Utopia\System\System; -use Utopia\Validator; use Utopia\Validator\ArrayList; use Utopia\Validator\Assoc; use Utopia\Validator\Boolean; @@ -1469,13 +1468,14 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') ->inject('devKey') ->inject('user') ->inject('dbForProject') + ->inject('dbForPlatform') ->inject('geodb') ->inject('queueForEvents') ->inject('store') ->inject('proofForPassword') ->inject('proofForToken') ->inject('authorization') - ->action(function (string $provider, string $code, string $state, string $error, string $error_description, Request $request, Response $response, Document $project, Validator $redirectValidator, Document $devKey, User $user, Database $dbForProject, Reader $geodb, Event $queueForEvents, Store $store, ProofsPassword $proofForPassword, ProofsToken $proofForToken, Authorization $authorization) use ($oauthDefaultSuccess) { + ->action(function (string $provider, string $code, string $state, string $error, string $error_description, Request $request, Response $response, Document $project, Redirect $redirectValidator, Document $devKey, User $user, Database $dbForProject, Database $dbForPlatform, Reader $geodb, Event $queueForEvents, Store $store, ProofsPassword $proofForPassword, ProofsToken $proofForToken, Authorization $authorization) use ($oauthDefaultSuccess) { $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $port = $request->getPort(); $callbackBase = $protocol . '://' . $request->getHostname(); @@ -1512,6 +1512,22 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') $state = $defaultState; } + // Allow redirect to rule URL if related to project + $rules = $authorization->skip(fn () => $dbForPlatform->find('rules', [ + Query::equal('domain', [ + parse_url($state['success'], PHP_URL_HOST), + parse_url($state['failure'], PHP_URL_HOST) + ]), + Query::equal('projectIntenralId', [$project->getSequence()]), + Query::limit(2) + ])); + + foreach ($rules as $rule) { + $allowedHostnames = $redirectValidator->getAllowedHostnames(); + $allowedHostnames[] = $rule['domain']; + $redirectValidator->setAllowedHostnames($allowedHostnames); + } + if ($devKey->isEmpty() && !$redirectValidator->isValid($state['success'])) { throw new Exception(Exception::PROJECT_INVALID_SUCCESS_URL); } diff --git a/src/Appwrite/Network/Validator/Origin.php b/src/Appwrite/Network/Validator/Origin.php index 02d5d8e83d..2f76aa2f86 100644 --- a/src/Appwrite/Network/Validator/Origin.php +++ b/src/Appwrite/Network/Validator/Origin.php @@ -22,6 +22,27 @@ class Origin extends Validator { } + public function setAllowedHostnames(array $allowedHostnames): self + { + $this->allowedHostnames = $allowedHostnames; + return $this; + } + + public function setAllowedSchemes(array $allowedSchemes): self + { + $this->allowedSchemes = $allowedSchemes; + return $this; + } + + public function getAllowedHostnames(): array + { + return $this->allowedHostnames; + } + + public function getAllowedSchemes(): array + { + return $this->allowedSchemes; + } /** * Check if Origin is valid. From 074ffad82624fffabec966075fce86e6cbb96287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 13:46:15 +0100 Subject: [PATCH 53/96] Improve origin unit tests --- tests/unit/Network/Validators/OriginTest.php | 56 ++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tests/unit/Network/Validators/OriginTest.php b/tests/unit/Network/Validators/OriginTest.php index a4c235f755..aa3ab65e5a 100644 --- a/tests/unit/Network/Validators/OriginTest.php +++ b/tests/unit/Network/Validators/OriginTest.php @@ -74,4 +74,60 @@ class OriginTest extends TestCase $this->assertEquals(false, $validator->isValid('random-scheme://localhost')); $this->assertEquals('Invalid Scheme. The scheme used (random-scheme) in the Origin (random-scheme://localhost) is not supported. If you are using a custom scheme, please change it to `appwrite-callback-`', $validator->getDescription()); } + + public function testGetAllowedHostnames(): void + { + $validator = new Origin( + allowedHostnames: ['appwrite.io', 'localhost'], + allowedSchemes: ['exp'] + ); + + $this->assertEquals(['appwrite.io', 'localhost'], $validator->getAllowedHostnames()); + } + + public function testGetAllowedSchemes(): void + { + $validator = new Origin( + allowedHostnames: ['appwrite.io'], + allowedSchemes: ['exp', 'appwrite-callback-123'] + ); + + $this->assertEquals(['exp', 'appwrite-callback-123'], $validator->getAllowedSchemes()); + } + + public function testSetAllowedHostnames(): void + { + $validator = new Origin( + allowedHostnames: ['appwrite.io'], + allowedSchemes: ['exp'] + ); + + $this->assertEquals(true, $validator->isValid('https://appwrite.io')); + $this->assertEquals(false, $validator->isValid('https://example.com')); + + $result = $validator->setAllowedHostnames(['example.com']); + + $this->assertSame($validator, $result); + $this->assertEquals(['example.com'], $validator->getAllowedHostnames()); + $this->assertEquals(true, $validator->isValid('https://example.com')); + $this->assertEquals(false, $validator->isValid('https://appwrite.io')); + } + + public function testSetAllowedSchemes(): void + { + $validator = new Origin( + allowedHostnames: ['appwrite.io'], + allowedSchemes: ['exp'] + ); + + $this->assertEquals(true, $validator->isValid('exp://')); + $this->assertEquals(false, $validator->isValid('appwrite-callback-456://')); + + $result = $validator->setAllowedSchemes(['appwrite-callback-456']); + + $this->assertSame($validator, $result); + $this->assertEquals(['appwrite-callback-456'], $validator->getAllowedSchemes()); + $this->assertEquals(true, $validator->isValid('appwrite-callback-456://')); + $this->assertEquals(false, $validator->isValid('exp://')); + } } From 525b929e54b668227b94b00d60574ca820ef9bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 13:57:19 +0100 Subject: [PATCH 54/96] Fix implementation, add tests --- app/controllers/api/account.php | 2 +- .../Projects/ProjectsConsoleClientTest.php | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 8d819d429d..afb45dbfb9 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1518,7 +1518,7 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') parse_url($state['success'], PHP_URL_HOST), parse_url($state['failure'], PHP_URL_HOST) ]), - Query::equal('projectIntenralId', [$project->getSequence()]), + Query::equal('projectInternalId', [$project->getSequence()]), Query::limit(2) ])); diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index e2e5621662..abdcbcee24 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -5190,6 +5190,25 @@ class ProjectsConsoleClientTest extends Scope 'failure' => 'https://domain-without-rule.com' ], followRedirects: false); $this->assertEquals(400, $response['headers']['status-code']); + + // Also ensure final step blocks unknown redirect URL + $response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider . '/redirect', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'referer' => 'https://' . $domain, + 'origin' => '', + 'referer' => 'https://mockserver.com', + ], [ + 'code' => 'any-code', + 'state' => \json_encode([ + 'success' => 'https://domain-without-rule.com', + 'failure' => 'https://domain-without-rule.com' + ]), + 'error' => '', + 'errorDescription' => '', + ], followRedirects: false); + $this->assertEquals(400, $response['headers']['status-code']); + $this->assertStringContainsString('project_invalid_success_url', $response['body']); // Ensure rule's domain can be redirect URL $response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider, [ @@ -5202,6 +5221,25 @@ class ProjectsConsoleClientTest extends Scope 'failure' => 'https://' . $domain ], followRedirects: false); $this->assertEquals(301, $response['headers']['status-code']); + + // Also ensure final step allows redirect URL + $response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider . '/redirect', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'referer' => 'https://' . $domain, + 'origin' => '', + 'referer' => 'https://mockserver.com', + ], [ + 'code' => 'any-code', + 'state' => \json_encode([ + 'success' => 'https://' . $domain, + 'failure' => 'https://' . $domain + ]), + 'error' => '', + 'errorDescription' => '', + ], followRedirects: false); + $this->assertEquals(301, $response['headers']['status-code']); + $this->assertStringContainsString('https://' . $domain, $response['headers']['location']); // Ensure unknown domain cannot be redirect URL $response = $this->client->call(Client::METHOD_POST, '/account/sessions/magic-url', [ From 615aff07143feb09903e350f6c37b02ec146fe3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 14:34:05 +0100 Subject: [PATCH 55/96] Allow custom ID for API keys --- app/controllers/api/projects.php | 6 ++- tests/e2e/Scopes/ProjectCustom.php | 2 + .../Projects/ProjectsConsoleClientTest.php | 44 ++++++++++++++++++- 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index d61340cfff..23ec2f51c4 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -14,6 +14,7 @@ use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Template\Template; +use Appwrite\Utopia\Database\Validator\CustomId; use Appwrite\Utopia\Response; use PHPMailer\PHPMailer\PHPMailer; use Utopia\Config\Config; @@ -1094,12 +1095,13 @@ Http::post('/v1/projects/:projectId/keys') ] )) ->param('projectId', '', new UID(), 'Project unique ID.') + ->param('keyId', '', new CustomId(), 'Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', null, new Text(128), 'Key name. Max length: 128 chars.') ->param('scopes', null, new Nullable(new ArrayList(new WhiteList(array_keys(Config::getParam('projectScopes')), true), APP_LIMIT_ARRAY_PARAMS_SIZE)), 'Key scopes list. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' scopes are allowed.') ->param('expire', null, new Nullable(new DatetimeValidator()), 'Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.', true) ->inject('response') ->inject('dbForPlatform') - ->action(function (string $projectId, string $name, array $scopes, ?string $expire, Response $response, Database $dbForPlatform) { + ->action(function (string $projectId, string $keyId, string $name, array $scopes, ?string $expire, Response $response, Database $dbForPlatform) { $project = $dbForPlatform->getDocument('projects', $projectId); @@ -1108,7 +1110,7 @@ Http::post('/v1/projects/:projectId/keys') } $key = new Document([ - '$id' => ID::unique(), + '$id' => $keyId, '$permissions' => [ Permission::read(Role::any()), Permission::update(Role::any()), diff --git a/tests/e2e/Scopes/ProjectCustom.php b/tests/e2e/Scopes/ProjectCustom.php index 52c53016d6..1859d551a4 100644 --- a/tests/e2e/Scopes/ProjectCustom.php +++ b/tests/e2e/Scopes/ProjectCustom.php @@ -60,6 +60,7 @@ trait ProjectCustom 'cookie' => 'a_session_console=' . $this->getRoot()['session'], 'x-appwrite-project' => 'console', ], [ + 'keyId' => ID::unique(), 'name' => 'Demo Project Key', 'scopes' => [ 'users.read', @@ -194,6 +195,7 @@ trait ProjectCustom 'cookie' => 'a_session_console=' . $this->getRoot()['session'], 'x-appwrite-project' => 'console', ], [ + 'keyId' => ID::unique(), 'name' => 'Demo Project Key', 'scopes' => $scopes, ]); diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index e2e5621662..d12ad35d9c 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -2774,6 +2774,7 @@ class ProjectsConsoleClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'cookie' => 'a_session_console=' . $this->getRoot()['session'], ]), [ + 'keyId' => ID::unique(), 'name' => 'Key Test', 'scopes' => ['functions.read', 'teams.write'], ]); @@ -3123,6 +3124,7 @@ class ProjectsConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ + 'keyId' => ID::unique(), 'name' => 'Key Test', 'scopes' => ['teams.read', 'teams.write'], ]); @@ -3137,6 +3139,36 @@ class ProjectsConsoleClientTest extends Scope $this->assertEmpty($response['body']['sdks']); $this->assertArrayHasKey('accessedAt', $response['body']); $this->assertEmpty($response['body']['accessedAt']); + + /** + * Test for SUCCESS without key ID + */ + $response = $this->client->call(Client::METHOD_POST, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'name' => 'Key Custom', + 'scopes' => ['teams.read', 'teams.write'], + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['$id']); + + /** + * Test for SUCCESS with custom ID + */ + $customKeyId = 'key-with-custom-id'; + $response = $this->client->call(Client::METHOD_POST, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'keyId' => $customKeyId, + 'name' => 'Key Custom', + 'scopes' => ['teams.read', 'teams.write'], + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertEquals($customKeyId, $response['body']['$id']); $data = array_merge($data, [ 'keyId' => $response['body']['$id'], @@ -3150,6 +3182,7 @@ class ProjectsConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ + 'keyId' => ID::unique(), 'name' => 'Key Test', 'scopes' => ['unknown'], ]); @@ -3174,7 +3207,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(1, $response['body']['total']); + $this->assertEquals(3, $response['body']['total']); /** * Test for FAILURE @@ -3200,7 +3233,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); $this->assertEquals($keyId, $response['body']['$id']); - $this->assertEquals('Key Test', $response['body']['name']); + $this->assertEquals('Key Custom', $response['body']['name']); $this->assertContains('teams.read', $response['body']['scopes']); $this->assertContains('teams.write', $response['body']['scopes']); $this->assertCount(2, $response['body']['scopes']); @@ -3240,6 +3273,7 @@ class ProjectsConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ + 'keyId' => ID::unique(), 'name' => 'Key Test', 'scopes' => ['users.write'], 'expire' => DateTime::addSeconds(new \DateTime(), 3600), @@ -3260,6 +3294,7 @@ class ProjectsConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ + 'keyId' => ID::unique(), 'name' => 'Key Test', 'scopes' => ['health.read'], 'expire' => null, @@ -3282,6 +3317,7 @@ class ProjectsConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ + 'keyId' => ID::unique(), 'name' => 'Key Test', 'scopes' => ['health.read'], 'expire' => DateTime::addSeconds(new \DateTime(), -3600), @@ -3323,6 +3359,7 @@ class ProjectsConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ + 'keyId' => ID::unique(), 'name' => 'Key Test', 'scopes' => ['teams.read'], 'expire' => DateTime::addSeconds(new \DateTime(), 3600), @@ -3355,6 +3392,7 @@ class ProjectsConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ + 'keyId' => ID::unique(), 'name' => 'Key Test', 'scopes' => ['health.read'], 'expire' => DateTime::addSeconds(new \DateTime(), 3600), @@ -4364,6 +4402,7 @@ class ProjectsConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ + 'keyId' => ID::unique(), 'name' => 'Key Test', 'scopes' => ['users.read', 'users.write'], ]); @@ -4384,6 +4423,7 @@ class ProjectsConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ + 'keyId' => ID::unique(), 'name' => 'Key Test', 'scopes' => ['users.read', 'users.write'], ]); From 9b762dde40baf629937ab792bd1e0ff6179e53ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 14:34:36 +0100 Subject: [PATCH 56/96] formatting fix --- tests/e2e/Services/Projects/ProjectsConsoleClientTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index d12ad35d9c..25a29f9844 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -3139,7 +3139,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEmpty($response['body']['sdks']); $this->assertArrayHasKey('accessedAt', $response['body']); $this->assertEmpty($response['body']['accessedAt']); - + /** * Test for SUCCESS without key ID */ From 40ab50ec9de23fd28c48c9bdf1784fab83f84445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 14:34:52 +0100 Subject: [PATCH 57/96] formatting fix --- tests/e2e/Services/Projects/ProjectsConsoleClientTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index abdcbcee24..c406632a2d 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -5190,7 +5190,7 @@ class ProjectsConsoleClientTest extends Scope 'failure' => 'https://domain-without-rule.com' ], followRedirects: false); $this->assertEquals(400, $response['headers']['status-code']); - + // Also ensure final step blocks unknown redirect URL $response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider . '/redirect', [ 'content-type' => 'application/json', @@ -5221,7 +5221,7 @@ class ProjectsConsoleClientTest extends Scope 'failure' => 'https://' . $domain ], followRedirects: false); $this->assertEquals(301, $response['headers']['status-code']); - + // Also ensure final step allows redirect URL $response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider . '/redirect', [ 'content-type' => 'application/json', @@ -5232,8 +5232,8 @@ class ProjectsConsoleClientTest extends Scope ], [ 'code' => 'any-code', 'state' => \json_encode([ - 'success' => 'https://' . $domain, - 'failure' => 'https://' . $domain + 'success' => 'https://' . $domain, + 'failure' => 'https://' . $domain ]), 'error' => '', 'errorDescription' => '', From 96e85c0bab0c0d9719913cf90a750e572e338370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 14:35:47 +0100 Subject: [PATCH 58/96] AI pr review --- tests/e2e/Services/Projects/ProjectsConsoleClientTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index c406632a2d..74d1aa9580 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -5195,7 +5195,6 @@ class ProjectsConsoleClientTest extends Scope $response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider . '/redirect', [ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, - 'referer' => 'https://' . $domain, 'origin' => '', 'referer' => 'https://mockserver.com', ], [ @@ -5226,7 +5225,6 @@ class ProjectsConsoleClientTest extends Scope $response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider . '/redirect', [ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, - 'referer' => 'https://' . $domain, 'origin' => '', 'referer' => 'https://mockserver.com', ], [ From 6df5556473c333c0e89e833adb026058b850bd2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 14:58:36 +0100 Subject: [PATCH 59/96] Implement queries param to list api keys --- app/controllers/api/projects.php | 48 ++++++- .../Database/Validator/Queries/Keys.php | 18 +++ .../Projects/ProjectsConsoleClientTest.php | 136 ++++++++++++++++++ 3 files changed, 195 insertions(+), 7 deletions(-) create mode 100644 src/Appwrite/Utopia/Database/Validator/Queries/Keys.php diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index d61340cfff..4ccb0be2ad 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -29,6 +29,8 @@ use Utopia\Domains\Validator\PublicDomain; use Utopia\Http; use Utopia\Locale\Locale; use Utopia\System\System; +use Utopia\Database\Exception\Query as QueryException; +use Utopia\Database\Validator\Query\Cursor; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; use Utopia\Validator\Hostname; @@ -1152,10 +1154,12 @@ Http::get('/v1/projects/:projectId/keys') ] )) ->param('projectId', '', new UID(), 'Project unique ID.') + ->param('queries', [], new \Appwrite\Utopia\Database\Validator\Queries\Keys(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', \Appwrite\Utopia\Database\Validator\Queries\Keys::ALLOWED_ATTRIBUTES), true) + ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) ->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true) ->inject('response') ->inject('dbForPlatform') - ->action(function (string $projectId, bool $includeTotal, Response $response, Database $dbForPlatform) { + ->action(function (string $projectId, array $queries, string $search, bool $includeTotal, Response $response, Database $dbForPlatform) { $project = $dbForPlatform->getDocument('projects', $projectId); @@ -1163,15 +1167,45 @@ Http::get('/v1/projects/:projectId/keys') throw new Exception(Exception::PROJECT_NOT_FOUND); } - $keys = $dbForPlatform->find('keys', [ - Query::equal('resourceType', ['projects']), - Query::equal('resourceInternalId', [$project->getSequence()]), - Query::limit(5000), - ]); + try { + $queries = Query::parseQueries($queries); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + + if (!empty($search)) { + $queries[] = Query::search('search', $search); + } + + $queries[] = Query::equal('resourceType', ['projects']); + $queries[] = Query::equal('resourceInternalId', [$project->getSequence()]); + + $cursor = Query::getCursorQueries($queries, false); + $cursor = \reset($cursor); + + if ($cursor !== false) { + $validator = new Cursor(); + if (!$validator->isValid($cursor)) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $validator->getDescription()); + } + + $keyId = $cursor->getValue(); + $cursorDocument = $dbForPlatform->getDocument('keys', $keyId); + + if ($cursorDocument->isEmpty()) { + throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "Key '{$keyId}' for the 'cursor' value not found."); + } + + $cursor->setValue($cursorDocument); + } + + $filterQueries = Query::groupByType($queries)['filters']; + + $keys = $dbForPlatform->find('keys', $queries); $response->dynamic(new Document([ 'keys' => $keys, - 'total' => $includeTotal ? count($keys) : 0, + 'total' => $includeTotal ? $dbForPlatform->count('keys', $filterQueries, APP_LIMIT_COUNT) : 0, ]), Response::MODEL_KEY_LIST); }); diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Keys.php b/src/Appwrite/Utopia/Database/Validator/Queries/Keys.php new file mode 100644 index 0000000000..4bae12765c --- /dev/null +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Keys.php @@ -0,0 +1,18 @@ +client->call(Client::METHOD_POST, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'name' => 'Key Test 2', + 'scopes' => ['users.read'], + 'expire' => $expireDate, + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $key2Id = $response['body']['$id']; + + /** List all keys (no queries) */ $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), []); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(2, $response['body']['total']); + $this->assertCount(2, $response['body']['keys']); + + /** List keys with limit */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::limit(1)->toString(), + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertCount(1, $response['body']['keys']); + $this->assertEquals(2, $response['body']['total']); + + /** List keys with offset */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::offset(1)->toString(), + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertCount(1, $response['body']['keys']); + $this->assertEquals(2, $response['body']['total']); + + /** List keys with cursor after */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::cursorAfter(new Document(['$id' => $data['keyId']]))->toString(), + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertCount(1, $response['body']['keys']); + $this->assertEquals($key2Id, $response['body']['keys'][0]['$id']); + + /** List keys filtering by expire (lessThan now — should match none) */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::lessThan('expire', (new \DateTime())->format('Y-m-d H:i:s'))->toString(), + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(0, $response['body']['total']); + + /** List keys filtering by expire (greaterThan now — should match the key with expiry) */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::greaterThan('expire', (new \DateTime())->format('Y-m-d H:i:s'))->toString(), + ] + ]); $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(1, $response['body']['total']); + $this->assertCount(1, $response['body']['keys']); + $this->assertEquals('Key Test 2', $response['body']['keys'][0]['name']); + + /** List keys with orderDesc */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::orderDesc('')->toString(), + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertCount(2, $response['body']['keys']); + $this->assertEquals('Key Test 2', $response['body']['keys'][0]['name']); + $this->assertEquals('Key Test', $response['body']['keys'][1]['name']); + + /** List keys with total disabled */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'total' => false, + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertCount(2, $response['body']['keys']); + $this->assertEquals(0, $response['body']['total']); /** * Test for FAILURE */ + /** Test invalid query attribute */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::equal('secret', ['test'])->toString(), + ] + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + /** Test invalid cursor */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::cursorAfter(new Document(['$id' => 'invalid']))->toString(), + ] + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + return $data; } From 7bf5f2d36074989d30c0f999f1cd0572fe014b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 15:55:35 +0100 Subject: [PATCH 60/96] Fix bug 5xx error --- .env | 2 +- app/controllers/api/account.php | 30 +++++++++++++++++------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.env b/.env index 7ac8fc25ef..c190e29c0b 100644 --- a/.env +++ b/.env @@ -18,7 +18,7 @@ _APP_EMAIL_SECURITY=security@appwrite.io _APP_EMAIL_CERTIFICATES=certificates@appwrite.io _APP_SYSTEM_RESPONSE_FORMAT= _APP_CUSTOM_DOMAIN_DENY_LIST= -_APP_OPTIONS_ABUSE=disabled +_APP_OPTIONS_ABUSE=enabled _APP_OPTIONS_ROUTER_PROTECTION=disabled _APP_OPTIONS_FORCE_HTTPS=disabled _APP_OPTIONS_ROUTER_FORCE_HTTPS=disabled diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index afb45dbfb9..1e2bb5aee0 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -64,6 +64,7 @@ use Utopia\Http; use Utopia\Locale\Locale; use Utopia\Storage\Validator\FileName; use Utopia\System\System; +use Utopia\Validator; use Utopia\Validator\ArrayList; use Utopia\Validator\Assoc; use Utopia\Validator\Boolean; @@ -1475,7 +1476,7 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') ->inject('proofForPassword') ->inject('proofForToken') ->inject('authorization') - ->action(function (string $provider, string $code, string $state, string $error, string $error_description, Request $request, Response $response, Document $project, Redirect $redirectValidator, Document $devKey, User $user, Database $dbForProject, Database $dbForPlatform, Reader $geodb, Event $queueForEvents, Store $store, ProofsPassword $proofForPassword, ProofsToken $proofForToken, Authorization $authorization) use ($oauthDefaultSuccess) { + ->action(function (string $provider, string $code, string $state, string $error, string $error_description, Request $request, Response $response, Document $project, Validator $redirectValidator, Document $devKey, User $user, Database $dbForProject, Database $dbForPlatform, Reader $geodb, Event $queueForEvents, Store $store, ProofsPassword $proofForPassword, ProofsToken $proofForToken, Authorization $authorization) use ($oauthDefaultSuccess) { $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $port = $request->getPort(); $callbackBase = $protocol . '://' . $request->getHostname(); @@ -1513,19 +1514,22 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') } // Allow redirect to rule URL if related to project - $rules = $authorization->skip(fn () => $dbForPlatform->find('rules', [ - Query::equal('domain', [ - parse_url($state['success'], PHP_URL_HOST), - parse_url($state['failure'], PHP_URL_HOST) - ]), - Query::equal('projectInternalId', [$project->getSequence()]), - Query::limit(2) - ])); + //Check if $redirectValidator is instance of Redirect class + if ($redirectValidator instanceof Redirect) { + $rules = $authorization->skip(fn () => $dbForPlatform->find('rules', [ + Query::equal('domain', [ + parse_url($state['success'], PHP_URL_HOST), + parse_url($state['failure'], PHP_URL_HOST) + ]), + Query::equal('projectInternalId', [$project->getSequence()]), + Query::limit(2) + ])); - foreach ($rules as $rule) { - $allowedHostnames = $redirectValidator->getAllowedHostnames(); - $allowedHostnames[] = $rule['domain']; - $redirectValidator->setAllowedHostnames($allowedHostnames); + foreach ($rules as $rule) { + $allowedHostnames = $redirectValidator->getAllowedHostnames(); + $allowedHostnames[] = $rule['domain']; + $redirectValidator->setAllowedHostnames($allowedHostnames); + } } if ($devKey->isEmpty() && !$redirectValidator->isValid($state['success'])) { From 3dc69ba62abb6acc4b2b58722071173bc037fd75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 15:55:49 +0100 Subject: [PATCH 61/96] Revert unwanted push --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index c190e29c0b..7ac8fc25ef 100644 --- a/.env +++ b/.env @@ -18,7 +18,7 @@ _APP_EMAIL_SECURITY=security@appwrite.io _APP_EMAIL_CERTIFICATES=certificates@appwrite.io _APP_SYSTEM_RESPONSE_FORMAT= _APP_CUSTOM_DOMAIN_DENY_LIST= -_APP_OPTIONS_ABUSE=enabled +_APP_OPTIONS_ABUSE=disabled _APP_OPTIONS_ROUTER_PROTECTION=disabled _APP_OPTIONS_FORCE_HTTPS=disabled _APP_OPTIONS_ROUTER_FORCE_HTTPS=disabled From e666dc9504e70313cceb06d78762e24556d22c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 16:42:14 +0100 Subject: [PATCH 62/96] AI review fixes --- app/controllers/api/projects.php | 4 +++- .../Projects/ProjectsConsoleClientTest.php | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 23ec2f51c4..4fa40bcbc1 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -1095,13 +1095,15 @@ Http::post('/v1/projects/:projectId/keys') ] )) ->param('projectId', '', new UID(), 'Project unique ID.') - ->param('keyId', '', new CustomId(), 'Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + // TODO: When migrating to Platform API, mark keyId required for consistency + ->param('keyId', 'unique()', new CustomId(), 'Key ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.', true) ->param('name', null, new Text(128), 'Key name. Max length: 128 chars.') ->param('scopes', null, new Nullable(new ArrayList(new WhiteList(array_keys(Config::getParam('projectScopes')), true), APP_LIMIT_ARRAY_PARAMS_SIZE)), 'Key scopes list. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' scopes are allowed.') ->param('expire', null, new Nullable(new DatetimeValidator()), 'Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.', true) ->inject('response') ->inject('dbForPlatform') ->action(function (string $projectId, string $keyId, string $name, array $scopes, ?string $expire, Response $response, Database $dbForPlatform) { + $keyId = $keyId == 'unique()' ? ID::unique() : $keyId; $project = $dbForPlatform->getDocument('projects', $projectId); diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 25a29f9844..de67438b91 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -3167,8 +3167,20 @@ class ProjectsConsoleClientTest extends Scope 'scopes' => ['teams.read', 'teams.write'], ]); + /** + * Test for SUCCESS with magic string ID + */ + $response = $this->client->call(Client::METHOD_POST, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'keyId' => 'unique()', + 'name' => 'Key Custom', + 'scopes' => ['teams.read', 'teams.write'], + ]); + $this->assertEquals(201, $response['headers']['status-code']); - $this->assertEquals($customKeyId, $response['body']['$id']); + $this->assertNotEmpty($response['body']['$id']); $data = array_merge($data, [ 'keyId' => $response['body']['$id'], From c0f5fa90cb6eb977355720d0c07c7337502a507b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 16:53:18 +0100 Subject: [PATCH 63/96] Fix AI review --- tests/e2e/Services/Projects/ProjectsConsoleClientTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index de67438b91..2fa6c67461 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -3167,6 +3167,9 @@ class ProjectsConsoleClientTest extends Scope 'scopes' => ['teams.read', 'teams.write'], ]); + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertSame($customKeyId, $response['body']['$id']); + /** * Test for SUCCESS with magic string ID */ @@ -3181,6 +3184,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(201, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); + $this->assertNotSame('unique()', $response['body']['$id']); $data = array_merge($data, [ 'keyId' => $response['body']['$id'], @@ -3219,7 +3223,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(3, $response['body']['total']); + $this->assertEquals(4, $response['body']['total']); /** * Test for FAILURE From 29915ddd3b9b4fb258d0425bca60ac03ec7e0c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 16:58:44 +0100 Subject: [PATCH 64/96] Manual fixes of agent code --- app/controllers/api/projects.php | 14 +-- .../Projects/ProjectsConsoleClientTest.php | 103 ++++++++++++++++++ 2 files changed, 108 insertions(+), 9 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 4ccb0be2ad..ad842f4ec9 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -14,23 +14,24 @@ use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Template\Template; +use Appwrite\Utopia\Database\Validator\Queries\Keys; use Appwrite\Utopia\Response; use PHPMailer\PHPMailer\PHPMailer; use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Query; use Utopia\Database\Validator\Datetime as DatetimeValidator; +use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; use Utopia\Domains\Validator\PublicDomain; use Utopia\Http; use Utopia\Locale\Locale; use Utopia\System\System; -use Utopia\Database\Exception\Query as QueryException; -use Utopia\Database\Validator\Query\Cursor; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; use Utopia\Validator\Hostname; @@ -1154,12 +1155,11 @@ Http::get('/v1/projects/:projectId/keys') ] )) ->param('projectId', '', new UID(), 'Project unique ID.') - ->param('queries', [], new \Appwrite\Utopia\Database\Validator\Queries\Keys(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', \Appwrite\Utopia\Database\Validator\Queries\Keys::ALLOWED_ATTRIBUTES), true) - ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) + ->param('queries', [], new Keys(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Keys::ALLOWED_ATTRIBUTES), true) ->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true) ->inject('response') ->inject('dbForPlatform') - ->action(function (string $projectId, array $queries, string $search, bool $includeTotal, Response $response, Database $dbForPlatform) { + ->action(function (string $projectId, array $queries, bool $includeTotal, Response $response, Database $dbForPlatform) { $project = $dbForPlatform->getDocument('projects', $projectId); @@ -1173,10 +1173,6 @@ Http::get('/v1/projects/:projectId/keys') throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } - if (!empty($search)) { - $queries[] = Query::search('search', $search); - } - $queries[] = Query::equal('resourceType', ['projects']); $queries[] = Query::equal('resourceInternalId', [$project->getSequence()]); diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index c80b706c43..d2f24a6795 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -3261,6 +3261,109 @@ class ProjectsConsoleClientTest extends Scope $this->assertCount(1, $response['body']['keys']); $this->assertEquals('Key Test 2', $response['body']['keys'][0]['name']); + /** List keys filtering by name (equal — exact match) */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::equal('name', ['Key Test'])->toString(), + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(1, $response['body']['total']); + $this->assertCount(1, $response['body']['keys']); + $this->assertEquals('Key Test', $response['body']['keys'][0]['name']); + + /** List keys filtering by name (equal — multiple values) */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::equal('name', ['Key Test', 'Key Test 2'])->toString(), + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(2, $response['body']['total']); + $this->assertCount(2, $response['body']['keys']); + + /** List keys filtering by name (equal — no match) */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::equal('name', ['Non Existent Key'])->toString(), + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(0, $response['body']['total']); + $this->assertCount(0, $response['body']['keys']); + + /** List keys filtering by scopes (contains — match key with teams.read) */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::contains('scopes', ['teams.read'])->toString(), + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(1, $response['body']['total']); + $this->assertCount(1, $response['body']['keys']); + $this->assertEquals('Key Test', $response['body']['keys'][0]['name']); + + /** List keys filtering by scopes (contains — match key with users.read) */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::contains('scopes', ['users.read'])->toString(), + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(1, $response['body']['total']); + $this->assertCount(1, $response['body']['keys']); + $this->assertEquals('Key Test 2', $response['body']['keys'][0]['name']); + + /** List keys filtering by scopes (contains — no match) */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::contains('scopes', ['databases.read'])->toString(), + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(0, $response['body']['total']); + $this->assertCount(0, $response['body']['keys']); + + /** List keys filtering by name and scopes combined */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::equal('name', ['Key Test'])->toString(), + Query::contains('scopes', ['teams.read'])->toString(), + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(1, $response['body']['total']); + $this->assertCount(1, $response['body']['keys']); + $this->assertEquals('Key Test', $response['body']['keys'][0]['name']); + /** List keys with orderDesc */ $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ 'content-type' => 'application/json', From a263afeff107dcda768c0703ff8a163e756bed6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 17:10:00 +0100 Subject: [PATCH 65/96] AI quality fixes --- app/controllers/api/account.php | 2 +- tests/e2e/Services/Projects/ProjectsConsoleClientTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 1e2bb5aee0..17515fe949 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1527,7 +1527,7 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') foreach ($rules as $rule) { $allowedHostnames = $redirectValidator->getAllowedHostnames(); - $allowedHostnames[] = $rule['domain']; + $allowedHostnames[] = $rule->getAttribute('domain', ''); $redirectValidator->setAllowedHostnames($allowedHostnames); } } diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 74d1aa9580..5280509967 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -5204,7 +5204,7 @@ class ProjectsConsoleClientTest extends Scope 'failure' => 'https://domain-without-rule.com' ]), 'error' => '', - 'errorDescription' => '', + 'error_description' => '', ], followRedirects: false); $this->assertEquals(400, $response['headers']['status-code']); $this->assertStringContainsString('project_invalid_success_url', $response['body']); @@ -5234,7 +5234,7 @@ class ProjectsConsoleClientTest extends Scope 'failure' => 'https://' . $domain ]), 'error' => '', - 'errorDescription' => '', + 'error_deescription' => '', ], followRedirects: false); $this->assertEquals(301, $response['headers']['status-code']); $this->assertStringContainsString('https://' . $domain, $response['headers']['location']); From dafa97879c8dd644fb58a628c917910e56a92ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 17:12:30 +0100 Subject: [PATCH 66/96] AI review fixes --- app/controllers/api/projects.php | 5 ++++- tests/e2e/Services/Projects/ProjectsConsoleClientTest.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index ad842f4ec9..8451ff2ebd 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -1186,7 +1186,10 @@ Http::get('/v1/projects/:projectId/keys') } $keyId = $cursor->getValue(); - $cursorDocument = $dbForPlatform->getDocument('keys', $keyId); + $cursorDocument = $dbForPlatform->getDocument('keys', $keyId, [ + Query::equal('resourceType', ['projects']), + Query::equal('resourceInternalId', [$project->getSequence()]), + ]); if ($cursorDocument->isEmpty()) { throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "Key '{$keyId}' for the 'cursor' value not found."); diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index d2f24a6795..fe4c8b2762 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -3370,7 +3370,7 @@ class ProjectsConsoleClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ 'queries' => [ - Query::orderDesc('')->toString(), + Query::orderDesc('$createdAt')->toString(), ] ]); From a87263a571293502a0893e82c906c40b962340e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 9 Feb 2026 20:07:33 +0100 Subject: [PATCH 67/96] Fix failing test --- app/controllers/api/projects.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 8451ff2ebd..ad842f4ec9 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -1186,10 +1186,7 @@ Http::get('/v1/projects/:projectId/keys') } $keyId = $cursor->getValue(); - $cursorDocument = $dbForPlatform->getDocument('keys', $keyId, [ - Query::equal('resourceType', ['projects']), - Query::equal('resourceInternalId', [$project->getSequence()]), - ]); + $cursorDocument = $dbForPlatform->getDocument('keys', $keyId); if ($cursorDocument->isEmpty()) { throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "Key '{$keyId}' for the 'cursor' value not found."); From b4329183853a4cc43e3911cc42263be07408e8d2 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Mon, 9 Feb 2026 19:24:57 +0000 Subject: [PATCH 68/96] feat: worker executions --- Dockerfile | 1 + app/controllers/general.php | 35 +++-- app/init/resources.php | 4 + app/worker.php | 5 + bin/worker-executions | 3 + docker-compose.yml | 31 +++++ src/Appwrite/Event/Event.php | 3 + src/Appwrite/Event/Execution.php | 56 ++++++++ src/Appwrite/Event/Func.php | 2 - src/Appwrite/Platform/Services/Workers.php | 2 + src/Appwrite/Platform/Workers/Executions.php | 52 +++++++ src/Appwrite/Platform/Workers/Functions.php | 130 +++++++----------- .../Functions/FunctionsCustomServerTest.php | 5 +- tests/resources/docker/docker-compose.yml | 21 +++ tests/unit/Docker/ComposeTest.php | 2 +- 15 files changed, 247 insertions(+), 105 deletions(-) create mode 100755 bin/worker-executions create mode 100644 src/Appwrite/Event/Execution.php create mode 100644 src/Appwrite/Platform/Workers/Executions.php diff --git a/Dockerfile b/Dockerfile index e848b6f0b5..6faaf9ed2b 100755 --- a/Dockerfile +++ b/Dockerfile @@ -81,6 +81,7 @@ RUN chmod +x /usr/local/bin/doctor && \ chmod +x /usr/local/bin/worker-certificates && \ chmod +x /usr/local/bin/worker-databases && \ chmod +x /usr/local/bin/worker-deletes && \ + chmod +x /usr/local/bin/worker-executions && \ chmod +x /usr/local/bin/worker-functions && \ chmod +x /usr/local/bin/worker-mails && \ chmod +x /usr/local/bin/worker-messaging && \ diff --git a/app/controllers/general.php b/app/controllers/general.php index d894135886..10e9537680 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -8,7 +8,7 @@ use Appwrite\Auth\Key; use Appwrite\Event\Certificate; use Appwrite\Event\Delete as DeleteEvent; use Appwrite\Event\Event; -use Appwrite\Event\Func; +use Appwrite\Event\Execution; use Appwrite\Event\StatsUsage; use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Network\Cors; @@ -60,7 +60,7 @@ Config::setParam('domainVerification', false); Config::setParam('cookieDomain', 'localhost'); Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE); -function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Authorization $authorization, ?Key $apiKey, DeleteEvent $queueForDeletes, int $executionsRetentionCount) +function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Event $queueForEvents, StatsUsage $queueForStatsUsage, Execution $queueForExecutions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Authorization $authorization, ?Key $apiKey, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { $host = $request->getHostname() ?? ''; if (!empty($previewHostname)) { @@ -696,14 +696,11 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S throw $th; } } finally { - if ($type === 'function') { - $queueForFunctions - ->setType(Func::TYPE_ASYNC_WRITE) + if ($type === 'function' || $type === 'site') { + $queueForExecutions ->setExecution($execution) ->setProject($project) ->trigger(); - } elseif ($type === 'site') { // TODO: Move it to logs worker later - $dbForProject->createDocument('executions', $execution); } } @@ -877,7 +874,7 @@ Http::init() ->inject('geodb') ->inject('queueForStatsUsage') ->inject('queueForEvents') - ->inject('queueForFunctions') + ->inject('queueForExecutions') ->inject('executor') ->inject('platform') ->inject('isResourceBlocked') @@ -888,7 +885,7 @@ Http::init() ->inject('authorization') ->inject('queueForDeletes') ->inject('executionsRetentionCount') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, StatsUsage $queueForStatsUsage, Event $queueForEvents, Func $queueForFunctions, Executor $executor, array $platform, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Document $project, Database $dbForPlatform, callable $getProjectDB, Locale $locale, array $localeCodes, Reader $geodb, StatsUsage $queueForStatsUsage, Event $queueForEvents, Execution $queueForExecutions, Executor $executor, array $platform, callable $isResourceBlocked, string $previewHostname, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { /* * Appwrite Router */ @@ -896,7 +893,7 @@ Http::init() $platformHostnames = $platform['hostnames'] ?? []; // Only run Router when external domain if (!\in_array($hostname, $platformHostnames) || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForExecutions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { $utopia->getRoute()?->label('router', true); } } @@ -1175,7 +1172,7 @@ Http::options() ->inject('getProjectDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') - ->inject('queueForFunctions') + ->inject('queueForExecutions') ->inject('executor') ->inject('geodb') ->inject('isResourceBlocked') @@ -1188,14 +1185,14 @@ Http::options() ->inject('authorization') ->inject('queueForDeletes') ->inject('executionsRetentionCount') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Execution $queueForExecutions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, Document $project, Document $devKey, ?Key $apiKey, Cors $cors, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { /* * Appwrite Router */ $platformHostnames = $platform['hostnames'] ?? []; // Only run Router when external domain if (!in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForExecutions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { $utopia->getRoute()?->label('router', true); } } @@ -1571,7 +1568,7 @@ Http::get('/robots.txt') ->inject('getProjectDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') - ->inject('queueForFunctions') + ->inject('queueForExecutions') ->inject('executor') ->inject('geodb') ->inject('isResourceBlocked') @@ -1581,13 +1578,13 @@ Http::get('/robots.txt') ->inject('authorization') ->inject('queueForDeletes') ->inject('executionsRetentionCount') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Execution $queueForExecutions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { $platformHostnames = $platform['hostnames'] ?? []; if (in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/robots.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForExecutions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { $utopia->getRoute()?->label('router', true); } } @@ -1606,7 +1603,7 @@ Http::get('/humans.txt') ->inject('getProjectDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') - ->inject('queueForFunctions') + ->inject('queueForExecutions') ->inject('executor') ->inject('geodb') ->inject('isResourceBlocked') @@ -1616,13 +1613,13 @@ Http::get('/humans.txt') ->inject('authorization') ->inject('queueForDeletes') ->inject('executionsRetentionCount') - ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Func $queueForFunctions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { + ->action(function (Http $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Log $log, Database $dbForPlatform, callable $getProjectDB, Event $queueForEvents, StatsUsage $queueForStatsUsage, Execution $queueForExecutions, Executor $executor, Reader $geodb, callable $isResourceBlocked, array $platform, string $previewHostname, ?Key $apiKey, Authorization $authorization, DeleteEvent $queueForDeletes, int $executionsRetentionCount) { $platformHostnames = $platform['hostnames'] ?? []; if (in_array($request->getHostname(), $platformHostnames) || !empty($previewHostname)) { $template = new View(__DIR__ . '/../views/general/humans.phtml'); $response->text($template->render(false)); } else { - if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForFunctions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { + if (router($utopia, $dbForPlatform, $getProjectDB, $swooleRequest, $request, $response, $log, $queueForEvents, $queueForStatsUsage, $queueForExecutions, $executor, $geodb, $isResourceBlocked, $platform, $previewHostname, $authorization, $apiKey, $queueForDeletes, $executionsRetentionCount)) { $utopia->getRoute()?->label('router', true); } } diff --git a/app/init/resources.php b/app/init/resources.php index 8f78df1573..a031292ca7 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -10,6 +10,7 @@ use Appwrite\Event\Certificate; use Appwrite\Event\Database as EventDatabase; use Appwrite\Event\Delete; use Appwrite\Event\Event; +use Appwrite\Event\Execution; use Appwrite\Event\Func; use Appwrite\Event\Mail; use Appwrite\Event\Messaging; @@ -159,6 +160,9 @@ Http::setResource('queueForAudits', function (Publisher $publisher) { Http::setResource('queueForFunctions', function (Publisher $publisher) { return new Func($publisher); }, ['publisher']); +Http::setResource('queueForExecutions', function (Publisher $publisher) { + return new Execution($publisher); +}, ['publisher']); Http::setResource('eventProcessor', function () { return new EventProcessor(); }, []); diff --git a/app/worker.php b/app/worker.php index d0094222a7..49635b0381 100644 --- a/app/worker.php +++ b/app/worker.php @@ -9,6 +9,7 @@ use Appwrite\Event\Certificate; use Appwrite\Event\Database as EventDatabase; use Appwrite\Event\Delete; use Appwrite\Event\Event; +use Appwrite\Event\Execution; use Appwrite\Event\Func; use Appwrite\Event\Mail; use Appwrite\Event\Messaging; @@ -358,6 +359,10 @@ Server::setResource('queueForFunctions', function (Publisher $publisher) { return new Func($publisher); }, ['publisher']); +Server::setResource('queueForExecutions', function (Publisher $publisher) { + return new Execution($publisher); +}, ['publisher']); + Server::setResource('queueForRealtime', function () { return new Realtime(); }, []); diff --git a/bin/worker-executions b/bin/worker-executions new file mode 100755 index 0000000000..6789fb8da8 --- /dev/null +++ b/bin/worker-executions @@ -0,0 +1,3 @@ +#!/bin/sh + +exec php /usr/src/code/app/worker.php executions "$@" diff --git a/docker-compose.yml b/docker-compose.yml index 37305055e5..a1f5ca77c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -641,6 +641,37 @@ services: - _APP_LOGGING_CONFIG - _APP_DATABASE_SHARED_TABLES + appwrite-worker-executions: + entrypoint: worker-executions + <<: *x-logging + container_name: appwrite-worker-executions + image: appwrite-dev + networks: + - appwrite + volumes: + - ./app:/usr/src/code/app + - ./src:/usr/src/code/src + depends_on: + redis: + condition: service_started + mariadb: + condition: service_started + environment: + - _APP_ENV + - _APP_WORKER_PER_CORE + - _APP_POOL_ADAPTER + - _APP_REDIS_HOST + - _APP_REDIS_PORT + - _APP_REDIS_USER + - _APP_REDIS_PASS + - _APP_DB_HOST + - _APP_DB_PORT + - _APP_DB_SCHEMA + - _APP_DB_USER + - _APP_DB_PASS + - _APP_LOGGING_CONFIG + - _APP_DATABASE_SHARED_TABLES + appwrite-worker-functions: entrypoint: worker-functions <<: *x-logging diff --git a/src/Appwrite/Event/Event.php b/src/Appwrite/Event/Event.php index 6db001398f..6f00d0cd0e 100644 --- a/src/Appwrite/Event/Event.php +++ b/src/Appwrite/Event/Event.php @@ -46,6 +46,9 @@ class Event public const MESSAGING_QUEUE_NAME = 'v1-messaging'; public const MESSAGING_CLASS_NAME = 'MessagingV1'; + public const EXECUTIONS_QUEUE_NAME = 'v1-executions'; + public const EXECUTIONS_CLASS_NAME = 'ExecutionsV1'; + public const MIGRATIONS_QUEUE_NAME = 'v1-migrations'; public const MIGRATIONS_CLASS_NAME = 'MigrationsV1'; diff --git a/src/Appwrite/Event/Execution.php b/src/Appwrite/Event/Execution.php new file mode 100644 index 0000000000..398025565c --- /dev/null +++ b/src/Appwrite/Event/Execution.php @@ -0,0 +1,56 @@ +setQueue(Event::EXECUTIONS_QUEUE_NAME) + ->setClass(Event::EXECUTIONS_CLASS_NAME); + } + + /** + * Sets execution document for the execution event. + * + * @param Document $execution + * @return self + */ + public function setExecution(Document $execution): self + { + $this->execution = $execution; + + return $this; + } + + /** + * Returns set execution document for the execution event. + * + * @return null|Document + */ + public function getExecution(): ?Document + { + return $this->execution; + } + + /** + * Prepare payload for the execution event. + * + * @return array + */ + protected function preparePayload(): array + { + return [ + 'project' => $this->project, + 'execution' => $this->execution, + ]; + } +} diff --git a/src/Appwrite/Event/Func.php b/src/Appwrite/Event/Func.php index 2f7f8e3c5c..7790437e1c 100644 --- a/src/Appwrite/Event/Func.php +++ b/src/Appwrite/Event/Func.php @@ -9,8 +9,6 @@ use Utopia\System\System; class Func extends Event { - public const TYPE_ASYNC_WRITE = 'async_write'; - protected string $jwt = ''; protected string $type = ''; protected string $body = ''; diff --git a/src/Appwrite/Platform/Services/Workers.php b/src/Appwrite/Platform/Services/Workers.php index f2cbeb390a..fa77725f7a 100644 --- a/src/Appwrite/Platform/Services/Workers.php +++ b/src/Appwrite/Platform/Services/Workers.php @@ -5,6 +5,7 @@ namespace Appwrite\Platform\Services; use Appwrite\Platform\Workers\Audits; use Appwrite\Platform\Workers\Certificates; use Appwrite\Platform\Workers\Deletes; +use Appwrite\Platform\Workers\Executions; use Appwrite\Platform\Workers\Functions; use Appwrite\Platform\Workers\Mails; use Appwrite\Platform\Workers\Messaging; @@ -23,6 +24,7 @@ class Workers extends Service ->addAction(Audits::getName(), new Audits()) ->addAction(Certificates::getName(), new Certificates()) ->addAction(Deletes::getName(), new Deletes()) + ->addAction(Executions::getName(), new Executions()) ->addAction(Functions::getName(), new Functions()) ->addAction(Mails::getName(), new Mails()) ->addAction(Messaging::getName(), new Messaging()) diff --git a/src/Appwrite/Platform/Workers/Executions.php b/src/Appwrite/Platform/Workers/Executions.php new file mode 100644 index 0000000000..300a84162c --- /dev/null +++ b/src/Appwrite/Platform/Workers/Executions.php @@ -0,0 +1,52 @@ +desc('Executions worker') + ->groups(['executions']) + ->inject('message') + ->inject('dbForProject') + ->callback($this->action(...)); + } + + public function action( + Message $message, + Database $dbForProject, + ): void { + $payload = $message->getPayload() ?? []; + + if (empty($payload)) { + throw new Exception('Missing payload'); + } + + $execution = new Document($payload['execution'] ?? []); + + if ($execution->isEmpty()) { + throw new Exception('Missing execution'); + } + + if (System::getEnv('_APP_REGION') !== 'nyc') { // TODO: Remove region check + $dbForProject->upsertDocument('executions', $execution); + } + } +} diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index 98e846aa4d..b5577c5668 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -4,6 +4,7 @@ namespace Appwrite\Platform\Workers; use Ahc\Jwt\JWT; use Appwrite\Event\Event; +use Appwrite\Event\Execution as ExecutionEvent; use Appwrite\Event\Func; use Appwrite\Event\Realtime; use Appwrite\Event\StatsUsage; @@ -16,8 +17,6 @@ use Utopia\CLI\Console; use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; -use Utopia\Database\Exception\Conflict; -use Utopia\Database\Exception\Structure; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; @@ -50,6 +49,7 @@ class Functions extends Action ->inject('queueForRealtime') ->inject('queueForEvents') ->inject('queueForStatsUsage') + ->inject('queueForExecutions') ->inject('log') ->inject('executor') ->inject('isResourceBlocked') @@ -65,6 +65,7 @@ class Functions extends Action Realtime $queueForRealtime, Event $queueForEvents, StatsUsage $queueForStatsUsage, + ExecutionEvent $queueForExecutions, Log $log, Executor $executor, callable $isResourceBlocked @@ -77,15 +78,6 @@ class Functions extends Action $type = $payload['type'] ?? ''; - // Short-term solution to offhand write operation from API container - if ($type === Func::TYPE_ASYNC_WRITE) { - $execution = new Document($payload['execution'] ?? []); - if (System::getEnv('_APP_REGION') !== 'nyc') { // TODO: Remove region check - $dbForProject->createDocument('executions', $execution); - } - return; - } - $events = $payload['events'] ?? []; $data = $payload['body'] ?? ''; $eventData = $payload['payload'] ?? ''; @@ -166,6 +158,7 @@ class Functions extends Action queueForRealtime: $queueForRealtime, queueForStatsUsage: $queueForStatsUsage, queueForEvents: $queueForEvents, + queueForExecutions: $queueForExecutions, project: $project, function: $function, executor: $executor, @@ -210,6 +203,7 @@ class Functions extends Action queueForRealtime: $queueForRealtime, queueForStatsUsage: $queueForStatsUsage, queueForEvents: $queueForEvents, + queueForExecutions: $queueForExecutions, project: $project, function: $function, executor: $executor, @@ -236,6 +230,7 @@ class Functions extends Action queueForRealtime: $queueForRealtime, queueForStatsUsage: $queueForStatsUsage, queueForEvents: $queueForEvents, + queueForExecutions: $queueForExecutions, project: $project, function: $function, executor: $executor, @@ -268,7 +263,8 @@ class Functions extends Action */ private function fail( string $message, - Database $dbForProject, + Document $project, + ExecutionEvent $queueForExecutions, Document $function, string $trigger, string $path, @@ -311,13 +307,10 @@ class Functions extends Action 'duration' => 0.0, ]); - if (System::getEnv('_APP_REGION') !== 'nyc') { // TODO: Remove region check - $execution = $dbForProject->createDocument('executions', $execution); - - if ($execution->isEmpty()) { - throw new Exception('Failed to create execution'); - } - } + $queueForExecutions + ->setExecution($execution) + ->setProject($project) + ->trigger(); } /** @@ -341,9 +334,6 @@ class Functions extends Action * @param string|null $eventData * @param string|null $executionId * @return void - * @throws Structure - * @throws \Utopia\Database\Exception - * @throws Conflict */ private function execute( Log $log, @@ -353,6 +343,7 @@ class Functions extends Action Realtime $queueForRealtime, StatsUsage $queueForStatsUsage, Event $queueForEvents, + ExecutionEvent $queueForExecutions, Document $project, Document $function, Executor $executor, @@ -380,19 +371,19 @@ class Functions extends Action if ($deployment->getAttribute('resourceId') !== $functionId) { $errorMessage = 'The execution could not be completed because a corresponding deployment was not found. A function deployment needs to be created before it can be executed. Please create a deployment for your function and try again.'; - $this->fail($errorMessage, $dbForProject, $function, $trigger, $path, $method, $user, $jwt, $event); + $this->fail($errorMessage, $project, $queueForExecutions, $function, $trigger, $path, $method, $user, $jwt, $event); return; } if ($deployment->isEmpty()) { $errorMessage = 'The execution could not be completed because a corresponding deployment was not found. A function deployment needs to be created before it can be executed. Please create a deployment for your function and try again.'; - $this->fail($errorMessage, $dbForProject, $function, $trigger, $path, $method, $user, $jwt, $event); + $this->fail($errorMessage, $project, $queueForExecutions, $function, $trigger, $path, $method, $user, $jwt, $event); return; } if ($deployment->getAttribute('status') !== 'ready') { $errorMessage = 'The execution could not be completed because the build is not ready. Please wait for the build to complete and try again.'; - $this->fail($errorMessage, $dbForProject, $function, $trigger, $path, $method, $user, $jwt, $event); + $this->fail($errorMessage, $project, $queueForExecutions, $function, $trigger, $path, $method, $user, $jwt, $event); return; } @@ -423,60 +414,38 @@ class Functions extends Action $headers['x-appwrite-continent-code'] = ''; $headers['x-appwrite-continent-eu'] = 'false'; - /** Create execution or update execution status */ - $execution = $dbForProject->getDocument('executions', $executionId ?? ''); - if ($execution->isEmpty()) { + /** Create or update execution to processing status */ + if (empty($executionId)) { $executionId = ID::unique(); - $headers['x-appwrite-execution-id'] = $executionId; - $headersFiltered = []; - foreach ($headers as $key => $value) { - if (\in_array(\strtolower($key), FUNCTION_ALLOWLIST_HEADERS_REQUEST)) { - $headersFiltered[] = [ 'name' => $key, 'value' => $value ]; - } - } + } + $headers['x-appwrite-execution-id'] = $executionId; - $execution = new Document([ - '$id' => $executionId, - '$permissions' => $user->isEmpty() ? [] : [Permission::read(Role::user($user->getId()))], - 'resourceInternalId' => $function->getSequence(), - 'resourceId' => $function->getId(), - 'resourceType' => 'functions', - 'deploymentInternalId' => $deployment->getSequence(), - 'deploymentId' => $deployment->getId(), - 'trigger' => $trigger, - 'status' => 'processing', - 'responseStatusCode' => 0, - 'responseHeaders' => [], - 'requestPath' => $path, - 'requestMethod' => $method, - 'requestHeaders' => $headersFiltered, - 'errors' => '', - 'logs' => '', - 'duration' => 0.0, - ]); - - if (System::getEnv('_APP_REGION') !== 'nyc') { // TODO: Remove region check - $execution = $dbForProject->createDocument('executions', $execution); - - // TODO: @Meldiron Trigger executions.create event here - - if ($execution->isEmpty()) { - throw new Exception('Failed to create or read execution'); - } + $headersFiltered = []; + foreach ($headers as $key => $value) { + if (\in_array(\strtolower($key), FUNCTION_ALLOWLIST_HEADERS_REQUEST)) { + $headersFiltered[] = [ 'name' => $key, 'value' => $value ]; } } - if ($execution->getAttribute('status') !== 'processing') { - $execution->setAttribute('status', 'processing'); - - if (System::getEnv('_APP_REGION') !== 'nyc') { // TODO: Remove region check - try { - $execution = $dbForProject->updateDocument('executions', $executionId, $execution); - } catch (\Throwable $e) { - $log->addExtra('updateError', $e->getMessage()); - } - } - } + $execution = new Document([ + '$id' => $executionId, + '$permissions' => $user->isEmpty() ? [] : [Permission::read(Role::user($user->getId()))], + 'resourceInternalId' => $function->getSequence(), + 'resourceId' => $function->getId(), + 'resourceType' => 'functions', + 'deploymentInternalId' => $deployment->getSequence(), + 'deploymentId' => $deployment->getId(), + 'trigger' => $trigger, + 'status' => 'processing', + 'responseStatusCode' => 0, + 'responseHeaders' => [], + 'requestPath' => $path, + 'requestMethod' => $method, + 'requestHeaders' => $headersFiltered, + 'errors' => '', + 'logs' => '', + 'duration' => 0.0, + ]); $durationStart = \microtime(true); @@ -618,14 +587,11 @@ class Functions extends Action $error = $th->getMessage(); $errorCode = $th->getCode(); } finally { - /** Update execution status */ - if (System::getEnv('_APP_REGION') !== 'nyc') { // TODO: Remove region check - try { - $execution = $dbForProject->updateDocument('executions', $executionId, $execution); - } catch (\Throwable $e) { - $log->addExtra('updateError', $e->getMessage()); - } - } + /** Persist final execution status */ + $queueForExecutions + ->setExecution($execution) + ->setProject($project) + ->trigger(); /** Trigger usage queue */ $queueForStatsUsage diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 35bdf90347..f7261adfc9 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -1751,7 +1751,10 @@ class FunctionsCustomServerTest extends Scope $this->assertEventually(function () use ($functionId, $userId) { $executions = $this->listExecutions($functionId); - $lastExecution = $executions['body']['executions'][0]; + $this->assertEquals(200, $executions['headers']['status-code']); + $executionsList = $executions['body']['executions'] ?? []; + $this->assertNotEmpty($executionsList); + $lastExecution = $executionsList[0]; $this->assertEquals('completed', $lastExecution['status']); $this->assertEquals(204, $lastExecution['responseStatusCode']); diff --git a/tests/resources/docker/docker-compose.yml b/tests/resources/docker/docker-compose.yml index c648b2f4c3..8530df0db6 100644 --- a/tests/resources/docker/docker-compose.yml +++ b/tests/resources/docker/docker-compose.yml @@ -212,6 +212,27 @@ services: - _APP_DB_USER - _APP_DB_PASS + appwrite-worker-executions: + entrypoint: worker-executions + container_name: appwrite-worker-executions + build: + context: . + restart: unless-stopped + networks: + - appwrite + depends_on: + - redis + - mariadb + environment: + - _APP_ENV + - _APP_REDIS_HOST + - _APP_REDIS_PORT + - _APP_DB_HOST + - _APP_DB_PORT + - _APP_DB_SCHEMA + - _APP_DB_USER + - _APP_DB_PASS + appwrite-worker-functions: entrypoint: worker-functions container_name: appwrite-worker-functions diff --git a/tests/unit/Docker/ComposeTest.php b/tests/unit/Docker/ComposeTest.php index 74779230ac..e63d877baf 100644 --- a/tests/unit/Docker/ComposeTest.php +++ b/tests/unit/Docker/ComposeTest.php @@ -23,7 +23,7 @@ class ComposeTest extends TestCase public function testServices(): void { - $this->assertCount(15, $this->object->getServices()); + $this->assertCount(16, $this->object->getServices()); $this->assertEquals('appwrite', $this->object->getService('appwrite')->getContainerName()); $this->assertEquals('', $this->object->getService('appwrite')->getImageVersion()); $this->assertEquals('3.6', $this->object->getService('traefik')->getImageVersion()); From c551fda8d89adfceb8b9f50ccd3749a9ce9ac32b Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 10 Feb 2026 10:33:14 +0530 Subject: [PATCH 69/96] Fix CLI setResource() static calls and named parameter mismatch CLI::setResource() is no longer static in the updated utopia-php/cli library. Moved platform/CLI initialization before resource setup and converted all static CLI::setResource() calls to use Dependency-based instance method via a helper closure. Also renamed $queue to $queueForStatsResources in StatsResources task to match the injected resource name, fixing PHP 8 named parameter resolution. --- app/cli.php | 89 +++++++++++-------- .../Platform/Tasks/StatsResources.php | 10 +-- 2 files changed, 55 insertions(+), 44 deletions(-) diff --git a/app/cli.php b/app/cli.php index b683af961d..f4ed318b43 100644 --- a/app/cli.php +++ b/app/cli.php @@ -16,13 +16,13 @@ use Swoole\Timer; use Utopia\Cache\Adapter\Pool as CachePool; use Utopia\Cache\Adapter\Sharding; use Utopia\Cache\Cache; -use Utopia\CLI\CLI; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Adapter\Pool as DatabasePool; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; +use Utopia\DI\Dependency; use Utopia\DSN\DSN; use Utopia\Logger\Log; use Utopia\Platform\Service; @@ -45,9 +45,32 @@ Config::setParam('runtimes', (new Runtimes('v5'))->getAll(supported: false)); require_once __DIR__ . '/controllers/general.php'; global $register; -CLI::setResource('register', fn () => $register); -CLI::setResource('cache', function ($pools) { +$platform = new Appwrite(); +$args = $platform->getEnv('argv'); + +if (!isset($args[0])) { + Console::error('Missing task name'); + Console::exit(1); +} + +\array_shift($args); +$taskName = $args[0]; +$platform->init(Service::TYPE_TASK); +$cli = $platform->getCli(); + +$setResource = function (string $name, callable $callback, array $injections = []) use ($cli) { + $dependency = new Dependency(); + $dependency->setName($name)->setCallback($callback); + foreach ($injections as $injection) { + $dependency->inject($injection); + } + $cli->setResource($dependency); +}; + +$setResource('register', fn () => $register, []); + +$setResource('cache', function ($pools) { $list = Config::getParam('pools-cache', []); $adapters = []; @@ -58,17 +81,17 @@ CLI::setResource('cache', function ($pools) { return new Cache(new Sharding($adapters)); }, ['pools']); -CLI::setResource('pools', function (Registry $register) { +$setResource('pools', function (Registry $register) { return $register->get('pools'); }, ['register']); -CLI::setResource('authorization', function () { +$setResource('authorization', function () { $authorization = new Authorization(); $authorization->disable(); return $authorization; }, []); -CLI::setResource('dbForPlatform', function ($pools, $cache, $authorization) { +$setResource('dbForPlatform', function ($pools, $cache, $authorization) { $sleep = 3; $maxAttempts = 5; $attempts = 0; @@ -111,16 +134,17 @@ CLI::setResource('dbForPlatform', function ($pools, $cache, $authorization) { return $dbForPlatform; }, ['pools', 'cache', 'authorization']); -CLI::setResource('console', function () { +$setResource('console', function () { return new Document(Config::getParam('console')); }, []); -CLI::setResource( +$setResource( 'isResourceBlocked', - fn () => fn (Document $project, string $resourceType, ?string $resourceId) => false + fn () => fn (Document $project, string $resourceType, ?string $resourceId) => false, + [] ); -CLI::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform, $cache, $authorization) { +$setResource('getProjectDB', function (Group $pools, Database $dbForPlatform, $cache, $authorization) { $databases = []; // TODO: @Meldiron This should probably be responsibility of utopia-php/pools return function (Document $project) use ($pools, $dbForPlatform, $cache, $authorization, &$databases) { @@ -182,7 +206,7 @@ CLI::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform }; }, ['pools', 'dbForPlatform', 'cache', 'authorization']); -CLI::setResource('getLogsDB', function (Group $pools, Cache $cache, Authorization $authorization) { +$setResource('getLogsDB', function (Group $pools, Cache $cache, Authorization $authorization) { $database = null; return function (?Document $project = null) use ($pools, $cache, $database, $authorization) { @@ -210,40 +234,40 @@ CLI::setResource('getLogsDB', function (Group $pools, Cache $cache, Authorizatio return $database; }; }, ['pools', 'cache', 'authorization']); -CLI::setResource('publisher', function (Group $pools) { +$setResource('publisher', function (Group $pools) { return new BrokerPool(publisher: $pools->get('publisher')); }, ['pools']); -CLI::setResource('publisherDatabases', function (BrokerPool $publisher) { +$setResource('publisherDatabases', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); -CLI::setResource('publisherFunctions', function (BrokerPool $publisher) { +$setResource('publisherFunctions', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); -CLI::setResource('publisherMigrations', function (BrokerPool $publisher) { +$setResource('publisherMigrations', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); -CLI::setResource('publisherStatsUsage', function (BrokerPool $publisher) { +$setResource('publisherStatsUsage', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); -CLI::setResource('publisherMessaging', function (BrokerPool $publisher) { +$setResource('publisherMessaging', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); -CLI::setResource('queueForStatsUsage', function (Publisher $publisher) { +$setResource('queueForStatsUsage', function (Publisher $publisher) { return new StatsUsage($publisher); }, ['publisher']); -CLI::setResource('queueForStatsResources', function (Publisher $publisher) { +$setResource('queueForStatsResources', function (Publisher $publisher) { return new StatsResources($publisher); }, ['publisher']); -CLI::setResource('queueForFunctions', function (Publisher $publisher) { +$setResource('queueForFunctions', function (Publisher $publisher) { return new Func($publisher); }, ['publisher']); -CLI::setResource('queueForDeletes', function (Publisher $publisher) { +$setResource('queueForDeletes', function (Publisher $publisher) { return new Delete($publisher); }, ['publisher']); -CLI::setResource('queueForCertificates', function (Publisher $publisher) { +$setResource('queueForCertificates', function (Publisher $publisher) { return new Certificate($publisher); }, ['publisher']); -CLI::setResource('logError', function (Registry $register) { +$setResource('logError', function (Registry $register) { return function (Throwable $error, string $namespace, string $action) use ($register) { Console::error('[Error] Timestamp: ' . date('c', time())); Console::error('[Error] Type: ' . get_class($error)); @@ -295,22 +319,9 @@ CLI::setResource('logError', function (Registry $register) { }; }, ['register']); -CLI::setResource('executor', fn () => new Executor()); +$setResource('executor', fn () => new Executor(), []); -CLI::setResource('telemetry', fn () => new NoTelemetry()); - -$platform = new Appwrite(); -$args = $platform->getEnv('argv'); - -if (!isset($args[0])) { - Console::error('Missing task name'); - Console::exit(1); -} - -\array_shift($args); -$taskName = $args[0]; -$platform->init(Service::TYPE_TASK); -$cli = $platform->getCli(); +$setResource('telemetry', fn () => new NoTelemetry(), []); $cli ->error() diff --git a/src/Appwrite/Platform/Tasks/StatsResources.php b/src/Appwrite/Platform/Tasks/StatsResources.php index 6d04d2109a..6c0e8da48b 100644 --- a/src/Appwrite/Platform/Tasks/StatsResources.php +++ b/src/Appwrite/Platform/Tasks/StatsResources.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Tasks; use Appwrite\Event\StatsResources as EventStatsResources; use Appwrite\Platform\Action; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Query; @@ -47,7 +47,7 @@ class StatsResources extends Action ->callback($this->action(...)); } - public function action(Database $dbForPlatform, callable $logError, EventStatsResources $queue): void + public function action(Database $dbForPlatform, callable $logError, EventStatsResources $queueForStatsResources): void { $this->logError = $logError; $this->dbForPlatform = $dbForPlatform; @@ -60,7 +60,7 @@ class StatsResources extends Action $interval = (int) System::getEnv('_APP_STATS_RESOURCES_INTERVAL', '3600'); - Console::loop(function () use ($queue, $dbForPlatform) { + Console::loop(function () use ($queueForStatsResources, $dbForPlatform) { $last24Hours = (new \DateTime())->sub(\DateInterval::createFromDateString('24 hours')); /** @@ -69,8 +69,8 @@ class StatsResources extends Action $this->foreachDocument($this->dbForPlatform, 'projects', [ Query::greaterThanEqual('accessedAt', DateTime::format($last24Hours)), Query::equal('region', [System::getEnv('_APP_REGION', 'default')]) - ], function ($project) use ($queue) { - $queue + ], function ($project) use ($queueForStatsResources) { + $queueForStatsResources ->setProject($project) ->trigger(); Console::success('project: ' . $project->getId() . '(' . $project->getSequence() . ')' . ' queued'); From 2d05d608f4124ab5461a3cbea01c8d428da8f8ce Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 10 Feb 2026 10:34:24 +0530 Subject: [PATCH 70/96] Upgrade utopia-php dependencies and fix namespace changes - Upgrade utopia-php/cli from 0.15 to 0.22 - Upgrade utopia-php/analytics from 0.10 to 0.15 - Upgrade utopia-php/orchestration from 0.9 to 0.19 - Use dev branches for utopia-php/framework and utopia-php/platform - Remove utopia-php/swoole dependency (merged into framework) - Migrate Utopia\CLI\Console to Utopia\Console across all files - Migrate Utopia\Http to Utopia\Http\Http namespace - Migrate Utopia\Swoole\Files to Utopia\Http\Files (now instance-based) - Convert static CLI::setResource() calls to instance-based Dependency API - Fix StatsResources task named parameter mismatch --- app/controllers/api/account.php | 2 +- app/controllers/api/graphql.php | 2 +- app/controllers/api/locale.php | 2 +- app/controllers/api/messaging.php | 2 +- app/controllers/api/migrations.php | 2 +- app/controllers/api/project.php | 2 +- app/controllers/api/projects.php | 2 +- app/controllers/api/teams.php | 2 +- app/controllers/api/users.php | 2 +- app/controllers/api/vcs.php | 4 +- app/controllers/general.php | 4 +- app/controllers/mock.php | 2 +- app/controllers/shared/api.php | 2 +- app/controllers/shared/api/auth.php | 2 +- app/controllers/web/home.php | 2 +- app/http.php | 17 +- app/init/registers.php | 4 +- app/init/resources.php | 4 +- app/realtime.php | 4 +- app/worker.php | 2 +- composer.json | 11 +- composer.lock | 185 ++++++++---------- src/Appwrite/Certificates/LetsEncrypt.php | 4 +- src/Appwrite/GraphQL/Resolvers.php | 4 +- src/Appwrite/GraphQL/Schema.php | 4 +- src/Appwrite/GraphQL/Types/Mapper.php | 4 +- src/Appwrite/Migration/Migration.php | 2 +- src/Appwrite/Migration/Version/V15.php | 2 +- src/Appwrite/Migration/Version/V16.php | 2 +- src/Appwrite/Migration/Version/V17.php | 2 +- src/Appwrite/Migration/Version/V18.php | 2 +- src/Appwrite/Migration/Version/V19.php | 2 +- src/Appwrite/Migration/Version/V20.php | 2 +- src/Appwrite/Migration/Version/V21.php | 2 +- src/Appwrite/Migration/Version/V22.php | 2 +- src/Appwrite/Migration/Version/V23.php | 2 +- src/Appwrite/Platform/Action.php | 2 +- .../Platform/Modules/Compute/Base.php | 2 +- .../Collections/Attributes/Action.php | 2 +- .../Collections/Attributes/Boolean/Create.php | 2 +- .../Collections/Attributes/Boolean/Update.php | 2 +- .../Attributes/Datetime/Create.php | 2 +- .../Attributes/Datetime/Update.php | 2 +- .../Collections/Attributes/Delete.php | 2 +- .../Collections/Attributes/Email/Create.php | 2 +- .../Collections/Attributes/Email/Update.php | 2 +- .../Collections/Attributes/Enum/Create.php | 2 +- .../Collections/Attributes/Enum/Update.php | 2 +- .../Collections/Attributes/Float/Create.php | 2 +- .../Collections/Attributes/Float/Update.php | 2 +- .../Databases/Collections/Attributes/Get.php | 2 +- .../Collections/Attributes/IP/Create.php | 2 +- .../Collections/Attributes/IP/Update.php | 2 +- .../Collections/Attributes/Integer/Create.php | 2 +- .../Collections/Attributes/Integer/Update.php | 2 +- .../Collections/Attributes/Line/Create.php | 2 +- .../Collections/Attributes/Line/Update.php | 2 +- .../Attributes/Longtext/Create.php | 2 +- .../Attributes/Longtext/Update.php | 2 +- .../Attributes/Mediumtext/Create.php | 2 +- .../Attributes/Mediumtext/Update.php | 2 +- .../Collections/Attributes/Point/Create.php | 2 +- .../Collections/Attributes/Point/Update.php | 2 +- .../Collections/Attributes/Polygon/Create.php | 2 +- .../Collections/Attributes/Polygon/Update.php | 2 +- .../Attributes/Relationship/Create.php | 2 +- .../Attributes/Relationship/Update.php | 2 +- .../Collections/Attributes/String/Create.php | 4 +- .../Collections/Attributes/String/Update.php | 2 +- .../Collections/Attributes/Text/Create.php | 2 +- .../Collections/Attributes/Text/Update.php | 2 +- .../Collections/Attributes/URL/Create.php | 2 +- .../Collections/Attributes/URL/Update.php | 2 +- .../Collections/Attributes/Varchar/Create.php | 2 +- .../Collections/Attributes/Varchar/Update.php | 2 +- .../Collections/Attributes/XList.php | 2 +- .../Http/Databases/Collections/Create.php | 2 +- .../Http/Databases/Collections/Delete.php | 2 +- .../Documents/Attribute/Decrement.php | 2 +- .../Documents/Attribute/Increment.php | 2 +- .../Collections/Documents/Bulk/Delete.php | 2 +- .../Collections/Documents/Bulk/Update.php | 2 +- .../Collections/Documents/Bulk/Upsert.php | 2 +- .../Collections/Documents/Create.php | 2 +- .../Collections/Documents/Delete.php | 2 +- .../Databases/Collections/Documents/Get.php | 2 +- .../Collections/Documents/Logs/XList.php | 2 +- .../Collections/Documents/Update.php | 2 +- .../Collections/Documents/Upsert.php | 2 +- .../Databases/Collections/Documents/XList.php | 2 +- .../Http/Databases/Collections/Get.php | 2 +- .../Databases/Collections/Indexes/Create.php | 2 +- .../Databases/Collections/Indexes/Delete.php | 2 +- .../Databases/Collections/Indexes/Get.php | 2 +- .../Databases/Collections/Indexes/XList.php | 2 +- .../Http/Databases/Collections/Logs/XList.php | 2 +- .../Http/Databases/Collections/Update.php | 2 +- .../Http/Databases/Collections/Usage/Get.php | 2 +- .../Http/Databases/Collections/XList.php | 2 +- .../Databases/Http/Databases/Create.php | 2 +- .../Databases/Http/Databases/Delete.php | 2 +- .../Modules/Databases/Http/Databases/Get.php | 2 +- .../Databases/Http/Databases/Logs/XList.php | 2 +- .../Http/Databases/Transactions/Create.php | 2 +- .../Http/Databases/Transactions/Delete.php | 2 +- .../Http/Databases/Transactions/Get.php | 2 +- .../Transactions/Operations/Create.php | 2 +- .../Http/Databases/Transactions/Update.php | 2 +- .../Http/Databases/Transactions/XList.php | 2 +- .../Databases/Http/Databases/Update.php | 2 +- .../Databases/Http/Databases/Usage/Get.php | 2 +- .../Databases/Http/Databases/Usage/XList.php | 2 +- .../Databases/Http/Databases/XList.php | 2 +- .../Modules/Databases/Http/Init/Timeout.php | 2 +- .../Databases/Http/TablesDB/Create.php | 2 +- .../Databases/Http/TablesDB/Delete.php | 2 +- .../Modules/Databases/Http/TablesDB/Get.php | 2 +- .../Databases/Http/TablesDB/Logs/XList.php | 2 +- .../Tables/Columns/Boolean/Create.php | 2 +- .../Tables/Columns/Boolean/Update.php | 2 +- .../Tables/Columns/Datetime/Create.php | 2 +- .../Tables/Columns/Datetime/Update.php | 2 +- .../Http/TablesDB/Tables/Columns/Delete.php | 2 +- .../TablesDB/Tables/Columns/Email/Create.php | 2 +- .../TablesDB/Tables/Columns/Email/Update.php | 2 +- .../TablesDB/Tables/Columns/Enum/Create.php | 2 +- .../TablesDB/Tables/Columns/Enum/Update.php | 2 +- .../TablesDB/Tables/Columns/Float/Create.php | 2 +- .../TablesDB/Tables/Columns/Float/Update.php | 2 +- .../Http/TablesDB/Tables/Columns/Get.php | 2 +- .../TablesDB/Tables/Columns/IP/Create.php | 2 +- .../TablesDB/Tables/Columns/IP/Update.php | 2 +- .../Tables/Columns/Integer/Create.php | 2 +- .../Tables/Columns/Integer/Update.php | 2 +- .../TablesDB/Tables/Columns/Line/Create.php | 2 +- .../TablesDB/Tables/Columns/Line/Update.php | 2 +- .../Tables/Columns/Longtext/Create.php | 2 +- .../Tables/Columns/Longtext/Update.php | 2 +- .../Tables/Columns/Mediumtext/Create.php | 2 +- .../Tables/Columns/Mediumtext/Update.php | 2 +- .../TablesDB/Tables/Columns/Point/Create.php | 2 +- .../TablesDB/Tables/Columns/Point/Update.php | 2 +- .../Tables/Columns/Polygon/Create.php | 2 +- .../Tables/Columns/Polygon/Update.php | 2 +- .../Tables/Columns/Relationship/Create.php | 2 +- .../Tables/Columns/Relationship/Update.php | 2 +- .../TablesDB/Tables/Columns/String/Create.php | 2 +- .../TablesDB/Tables/Columns/String/Update.php | 2 +- .../TablesDB/Tables/Columns/Text/Create.php | 2 +- .../TablesDB/Tables/Columns/Text/Update.php | 2 +- .../TablesDB/Tables/Columns/URL/Create.php | 2 +- .../TablesDB/Tables/Columns/URL/Update.php | 2 +- .../Tables/Columns/Varchar/Create.php | 2 +- .../Tables/Columns/Varchar/Update.php | 2 +- .../Http/TablesDB/Tables/Columns/XList.php | 2 +- .../Databases/Http/TablesDB/Tables/Create.php | 2 +- .../Databases/Http/TablesDB/Tables/Delete.php | 2 +- .../Databases/Http/TablesDB/Tables/Get.php | 2 +- .../Http/TablesDB/Tables/Indexes/Create.php | 2 +- .../Http/TablesDB/Tables/Indexes/Delete.php | 2 +- .../Http/TablesDB/Tables/Indexes/Get.php | 2 +- .../Http/TablesDB/Tables/Indexes/XList.php | 2 +- .../Http/TablesDB/Tables/Logs/XList.php | 2 +- .../Http/TablesDB/Tables/Rows/Bulk/Delete.php | 2 +- .../Http/TablesDB/Tables/Rows/Bulk/Update.php | 2 +- .../Http/TablesDB/Tables/Rows/Bulk/Upsert.php | 2 +- .../TablesDB/Tables/Rows/Column/Decrement.php | 2 +- .../TablesDB/Tables/Rows/Column/Increment.php | 2 +- .../Http/TablesDB/Tables/Rows/Create.php | 2 +- .../Http/TablesDB/Tables/Rows/Delete.php | 2 +- .../Http/TablesDB/Tables/Rows/Get.php | 2 +- .../Http/TablesDB/Tables/Rows/Logs/XList.php | 2 +- .../Http/TablesDB/Tables/Rows/Update.php | 2 +- .../Http/TablesDB/Tables/Rows/Upsert.php | 2 +- .../Http/TablesDB/Tables/Rows/XList.php | 2 +- .../Databases/Http/TablesDB/Tables/Update.php | 2 +- .../Http/TablesDB/Tables/Usage/Get.php | 2 +- .../Databases/Http/TablesDB/Tables/XList.php | 2 +- .../Http/TablesDB/Transactions/Create.php | 2 +- .../Http/TablesDB/Transactions/Delete.php | 2 +- .../Http/TablesDB/Transactions/Get.php | 2 +- .../Transactions/Operations/Create.php | 2 +- .../Http/TablesDB/Transactions/Update.php | 2 +- .../Http/TablesDB/Transactions/XList.php | 2 +- .../Databases/Http/TablesDB/Update.php | 2 +- .../Databases/Http/TablesDB/Usage/Get.php | 2 +- .../Databases/Http/TablesDB/Usage/XList.php | 2 +- .../Modules/Databases/Http/TablesDB/XList.php | 2 +- .../Modules/Databases/Workers/Databases.php | 2 +- .../Functions/Http/Deployments/Create.php | 2 +- .../Http/Deployments/Download/Get.php | 2 +- .../Http/Deployments/Template/Create.php | 2 +- .../Functions/Http/Deployments/Vcs/Create.php | 2 +- .../Functions/Http/Executions/Create.php | 4 +- .../Functions/Http/Functions/Create.php | 2 +- .../Functions/Http/Functions/Update.php | 2 +- .../Modules/Functions/Workers/Builds.php | 2 +- .../Modules/Functions/Workers/Screenshots.php | 2 +- .../Modules/Sites/Http/Deployments/Create.php | 2 +- .../Sites/Http/Deployments/Download/Get.php | 2 +- .../Http/Deployments/Duplicate/Create.php | 2 +- .../Http/Deployments/Template/Create.php | 2 +- .../Sites/Http/Deployments/Vcs/Create.php | 2 +- .../Modules/Sites/Http/Sites/Update.php | 2 +- .../Storage/Http/Buckets/Files/Create.php | 2 +- .../Http/Buckets/Files/Download/Get.php | 2 +- .../Http/Buckets/Files/Preview/Get.php | 4 +- .../Storage/Http/Buckets/Files/Push/Get.php | 2 +- .../Storage/Http/Buckets/Files/View/Get.php | 2 +- src/Appwrite/Platform/Tasks/Doctor.php | 4 +- src/Appwrite/Platform/Tasks/Install.php | 2 +- src/Appwrite/Platform/Tasks/Interval.php | 2 +- src/Appwrite/Platform/Tasks/Maintenance.php | 2 +- src/Appwrite/Platform/Tasks/Migrate.php | 4 +- src/Appwrite/Platform/Tasks/QueueRetry.php | 2 +- src/Appwrite/Platform/Tasks/SDKs.php | 2 +- src/Appwrite/Platform/Tasks/SSL.php | 2 +- src/Appwrite/Platform/Tasks/ScheduleBase.php | 2 +- .../Platform/Tasks/ScheduleFunctions.php | 2 +- src/Appwrite/Platform/Tasks/Screenshot.php | 2 +- src/Appwrite/Platform/Tasks/Specs.php | 8 +- src/Appwrite/Platform/Tasks/Upgrade.php | 2 +- src/Appwrite/Platform/Tasks/Vars.php | 2 +- src/Appwrite/Platform/Tasks/Version.php | 2 +- src/Appwrite/Platform/Workers/Audits.php | 2 +- .../Platform/Workers/Certificates.php | 2 +- src/Appwrite/Platform/Workers/Deletes.php | 2 +- src/Appwrite/Platform/Workers/Functions.php | 2 +- src/Appwrite/Platform/Workers/Migrations.php | 2 +- .../Platform/Workers/StatsResources.php | 2 +- src/Appwrite/Platform/Workers/StatsUsage.php | 2 +- src/Appwrite/SDK/Specification/Format.php | 4 +- .../SDK/Specification/Format/Swagger2.php | 2 +- src/Appwrite/Utopia/Request.php | 4 +- src/Appwrite/Utopia/Request/Filter.php | 1 - src/Appwrite/Utopia/Response.php | 5 +- .../e2e/Services/Functions/FunctionsBase.php | 2 +- .../Functions/FunctionsCustomServerTest.php | 2 +- tests/e2e/Services/GraphQL/Base.php | 2 +- tests/e2e/Services/Proxy/ProxyBase.php | 2 +- tests/e2e/Services/Sites/SitesBase.php | 2 +- .../Services/Sites/SitesCustomServerTest.php | 2 +- .../Services/Teams/TeamsCustomClientTest.php | 2 +- .../Webhooks/WebhooksCustomServerTest.php | 2 +- tests/unit/Utopia/RequestTest.php | 2 +- 245 files changed, 351 insertions(+), 386 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index bc84ae7ef6..2d9de7fe77 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -60,7 +60,7 @@ use Utopia\Database\Validator\Query\Limit; use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\UID; use Utopia\Emails\Email; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Locale\Locale; use Utopia\Storage\Validator\FileName; use Utopia\System\System; diff --git a/app/controllers/api/graphql.php b/app/controllers/api/graphql.php index 7c516ae4e0..2d0a840bd6 100644 --- a/app/controllers/api/graphql.php +++ b/app/controllers/api/graphql.php @@ -20,7 +20,7 @@ use GraphQL\Validator\Rules\QueryDepth; use Swoole\Coroutine\WaitGroup; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\System\System; use Utopia\Validator\JSON; use Utopia\Validator\Text; diff --git a/app/controllers/api/locale.php b/app/controllers/api/locale.php index a368854cde..d6b4bb814d 100644 --- a/app/controllers/api/locale.php +++ b/app/controllers/api/locale.php @@ -8,7 +8,7 @@ use Appwrite\Utopia\Response; use MaxMind\Db\Reader; use Utopia\Config\Config; use Utopia\Database\Document; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Locale\Locale; Http::get('/v1/locale') diff --git a/app/controllers/api/messaging.php b/app/controllers/api/messaging.php index 6a22ce3873..4e5c4ef3ec 100644 --- a/app/controllers/api/messaging.php +++ b/app/controllers/api/messaging.php @@ -43,7 +43,7 @@ use Utopia\Database\Validator\Query\Limit; use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\Roles; use Utopia\Database\Validator\UID; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Locale\Locale; use Utopia\System\System; use Utopia\Validator\ArrayList; diff --git a/app/controllers/api/migrations.php b/app/controllers/api/migrations.php index 12d8e3254d..9d5e013cdc 100644 --- a/app/controllers/api/migrations.php +++ b/app/controllers/api/migrations.php @@ -21,7 +21,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Queries\Documents; use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Migration\Resource; use Utopia\Migration\Sources\Appwrite; use Utopia\Migration\Sources\CSV; diff --git a/app/controllers/api/project.php b/app/controllers/api/project.php index 182098927c..73c6344974 100644 --- a/app/controllers/api/project.php +++ b/app/controllers/api/project.php @@ -16,7 +16,7 @@ use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Datetime as DateTimeValidator; use Utopia\Database\Validator\UID; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index d61340cfff..b09e9e50c3 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -26,7 +26,7 @@ use Utopia\Database\Query; use Utopia\Database\Validator\Datetime as DatetimeValidator; use Utopia\Database\Validator\UID; use Utopia\Domains\Validator\PublicDomain; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Locale\Locale; use Utopia\System\System; use Utopia\Validator\ArrayList; diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index adb692e61e..bf708a06f8 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -51,7 +51,7 @@ use Utopia\Database\Validator\Query\Limit; use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\UID; use Utopia\Emails\Email; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Locale\Locale; use Utopia\System\System; use Utopia\Validator\ArrayList; diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 67755bf41b..f16a74ceaf 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -60,7 +60,7 @@ use Utopia\Database\Validator\Query\Limit; use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\UID; use Utopia\Emails\Email; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Locale\Locale; use Utopia\System\System; use Utopia\Validator\ArrayList; diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index bff12b00d2..9f814afbd3 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -8,7 +8,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; use Appwrite\Vcs\Comment; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Duplicate; @@ -17,7 +17,7 @@ use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\System\System; use Utopia\Validator\Text; use Utopia\VCS\Adapter\Git\GitHub; diff --git a/app/controllers/general.php b/app/controllers/general.php index d894135886..b77ec0c8c4 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -34,8 +34,8 @@ use Appwrite\Utopia\View; use Executor\Executor; use MaxMind\Db\Reader; use Swoole\Http\Request as SwooleRequest; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; @@ -45,7 +45,7 @@ use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Domains\Domain; use Utopia\DSN\DSN; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Locale\Locale; use Utopia\Logger\Adapter\Sentry; use Utopia\Logger\Log; diff --git a/app/controllers/mock.php b/app/controllers/mock.php index e58a601786..fbe3eb9b20 100644 --- a/app/controllers/mock.php +++ b/app/controllers/mock.php @@ -12,7 +12,7 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\UID; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Locale\Locale; use Utopia\System\System; use Utopia\Validator\Text; diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 2df2c80918..f25f9717ed 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -30,7 +30,7 @@ use Utopia\Database\Document; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization\Input; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\System\System; use Utopia\Telemetry\Adapter as Telemetry; use Utopia\Validator\WhiteList; diff --git a/app/controllers/shared/api/auth.php b/app/controllers/shared/api/auth.php index 7eba5a7021..6e1f9f389f 100644 --- a/app/controllers/shared/api/auth.php +++ b/app/controllers/shared/api/auth.php @@ -8,7 +8,7 @@ use Utopia\Config\Config; use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\System\System; Http::init() diff --git a/app/controllers/web/home.php b/app/controllers/web/home.php index 3ceb5b2c8a..d23c9840a6 100644 --- a/app/controllers/web/home.php +++ b/app/controllers/web/home.php @@ -2,7 +2,7 @@ use Appwrite\Utopia\Response; use Utopia\Config\Config; -use Utopia\Http; +use Utopia\Http\Http; Http::get('/versions') ->desc('Get Version') diff --git a/app/http.php b/app/http.php index ae3f6c5341..7ba3e490da 100644 --- a/app/http.php +++ b/app/http.php @@ -14,9 +14,9 @@ use Swoole\Timer; use Utopia\Audit\Adapter\Database as AdapterDatabase; use Utopia\Audit\Adapter\SQL as AuditAdapterSQL; use Utopia\Audit\Audit; -use Utopia\CLI\Console; use Utopia\Compression\Compression; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Adapter\Pool as DatabasePool; use Utopia\Database\Database; use Utopia\Database\DateTime; @@ -26,14 +26,15 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Query; -use Utopia\Http; +use Utopia\Http\Files; +use Utopia\Http\Http; use Utopia\Logger\Log; use Utopia\Logger\Log\User; use Utopia\Pools\Group; -use Utopia\Swoole\Files; use Utopia\System\System; -Files::load(__DIR__.'/../public'); +$files = new Files(); +$files->load(__DIR__.'/../public'); const DOMAIN_SYNC_TIMER = 30; // 30 seconds @@ -440,21 +441,21 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg }); }); -$http->on(Constant::EVENT_REQUEST, function (SwooleRequest $swooleRequest, SwooleResponse $swooleResponse) use ($register) { +$http->on(Constant::EVENT_REQUEST, function (SwooleRequest $swooleRequest, SwooleResponse $swooleResponse) use ($register, $files) { Http::setResource('swooleRequest', fn () => $swooleRequest); Http::setResource('swooleResponse', fn () => $swooleResponse); $request = new Request($swooleRequest); $response = new Response($swooleResponse); - if (Files::isFileLoaded($request->getURI())) { + if ($files->isFileLoaded($request->getURI())) { $time = (60 * 60 * 24 * 365 * 2); // 45 days cache $response - ->setContentType(Files::getFileMimeType($request->getURI())) + ->setContentType($files->getFileMimeType($request->getURI())) ->addHeader('Cache-Control', 'public, max-age=' . $time) ->addHeader('Expires', \date('D, d M Y H:i:s', \time() + $time) . ' GMT') // 45 days cache - ->send(Files::getFileContents($request->getURI())); + ->send($files->getFileContents($request->getURI())); return; } diff --git a/app/init/registers.php b/app/init/registers.php index 2db7f487ca..4a73c9fbfa 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -9,15 +9,15 @@ use MaxMind\Db\Reader; use PHPMailer\PHPMailer\PHPMailer; use Swoole\Database\PDOProxy; use Utopia\Cache\Adapter\Redis as RedisCache; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Adapter\MariaDB; use Utopia\Database\Adapter\MySQL; use Utopia\Database\Adapter\SQL; use Utopia\Database\PDO; use Utopia\Domains\Validator\PublicDomain; use Utopia\DSN\DSN; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Logger\Adapter\AppSignal; use Utopia\Logger\Adapter\LogOwl; use Utopia\Logger\Adapter\Raygun; diff --git a/app/init/resources.php b/app/init/resources.php index 8f78df1573..bbefc4a9f3 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -42,8 +42,8 @@ use Utopia\Auth\Store; use Utopia\Cache\Adapter\Pool as CachePool; use Utopia\Cache\Adapter\Sharding; use Utopia\Cache\Cache; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Adapter\Pool as DatabasePool; use Utopia\Database\Database; use Utopia\Database\DateTime as DatabaseDateTime; @@ -51,7 +51,7 @@ use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\DSN\DSN; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Locale\Locale; use Utopia\Logger\Log; use Utopia\Pools\Group; diff --git a/app/realtime.php b/app/realtime.php index 97e7465683..b77d783833 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -22,8 +22,8 @@ use Utopia\Auth\Store; use Utopia\Cache\Adapter\Pool as CachePool; use Utopia\Cache\Adapter\Sharding; use Utopia\Cache\Cache; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Adapter\Pool as DatabasePool; use Utopia\Database\Database; use Utopia\Database\DateTime; @@ -33,7 +33,7 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Role; use Utopia\Database\Query; use Utopia\DSN\DSN; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Logger\Log; use Utopia\Pools\Group; use Utopia\Registry\Registry; diff --git a/app/worker.php b/app/worker.php index d0094222a7..a9c7a94016 100644 --- a/app/worker.php +++ b/app/worker.php @@ -27,8 +27,8 @@ use Utopia\Audit\Audit as UtopiaAudit; use Utopia\Cache\Adapter\Pool as CachePool; use Utopia\Cache\Adapter\Sharding; use Utopia\Cache\Cache; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Adapter\Pool as DatabasePool; use Utopia\Database\Database; use Utopia\Database\DateTime; diff --git a/composer.json b/composer.json index 356723ec8d..4367f155a6 100644 --- a/composer.json +++ b/composer.json @@ -46,11 +46,11 @@ "appwrite/php-runtimes": "0.19.*", "appwrite/php-clamav": "2.0.*", "utopia-php/abuse": "1.2.*", - "utopia-php/analytics": "0.10.*", + "utopia-php/analytics": "0.15.*", "utopia-php/audit": "2.2.*", "utopia-php/auth": "0.5.*", "utopia-php/cache": "1.0.*", - "utopia-php/cli": "0.15.*", + "utopia-php/cli": "0.22.*", "utopia-php/config": "1.*", "utopia-php/database": "5.*", "utopia-php/detector": "0.2.*", @@ -58,21 +58,20 @@ "utopia-php/emails": "0.6.*", "utopia-php/dns": "1.5.*", "utopia-php/dsn": "0.2.1", - "utopia-php/framework": "0.33.*", + "utopia-php/framework": "dev-backport-0.34-adapters as 0.33.38", "utopia-php/fetch": "0.5.*", "utopia-php/image": "0.8.*", "utopia-php/locale": "0.8.*", "utopia-php/logger": "0.6.*", "utopia-php/messaging": "0.20.*", "utopia-php/migration": "1.5.*", - "utopia-php/orchestration": "0.9.*", - "utopia-php/platform": "0.7.*", + "utopia-php/orchestration": "0.19.*", + "utopia-php/platform": "dev-bump-cli-and-framework as 0.7.15", "utopia-php/pools": "1.*", "utopia-php/preloader": "0.2.*", "utopia-php/queue": "0.15.*", "utopia-php/registry": "0.5.*", "utopia-php/storage": "0.18.*", - "utopia-php/swoole": "1.*", "utopia-php/system": "0.10.*", "utopia-php/telemetry": "0.2.*", "utopia-php/vcs": "1.*", diff --git a/composer.lock b/composer.lock index ce40ffa7a9..bdc50402fb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "917f9050c673379c91e46814c7c07f64", + "content-hash": "45a20998a33d8e3d3c05dbf99e42d942", "packages": [ { "name": "adhocore/jwt", @@ -3403,25 +3403,25 @@ }, { "name": "utopia-php/analytics", - "version": "0.10.2", + "version": "0.15.2", "source": { "type": "git", "url": "https://github.com/utopia-php/analytics.git", - "reference": "14c805114736f44c26d6d24b176a2f8b93d86a1f" + "reference": "ce5be7042ad518b83e401dcd785d20c4cc872c67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/analytics/zipball/14c805114736f44c26d6d24b176a2f8b93d86a1f", - "reference": "14c805114736f44c26d6d24b176a2f8b93d86a1f", + "url": "https://api.github.com/repos/utopia-php/analytics/zipball/ce5be7042ad518b83e401dcd785d20c4cc872c67", + "reference": "ce5be7042ad518b83e401dcd785d20c4cc872c67", "shasum": "" }, "require": { - "php": ">=8.0", - "utopia-php/cli": "^0.15.0" + "php": ">=8.0" }, "require-dev": { "laravel/pint": "dev-main", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.3", + "utopia-php/system": "0.10.*" }, "type": "library", "autoload": { @@ -3443,9 +3443,9 @@ ], "support": { "issues": "https://github.com/utopia-php/analytics/issues", - "source": "https://github.com/utopia-php/analytics/tree/0.10.2" + "source": "https://github.com/utopia-php/analytics/tree/0.15.2" }, - "time": "2023-03-22T12:01:09+00:00" + "time": "2026-02-09T12:46:39+00:00" }, { "name": "utopia-php/audit", @@ -3605,27 +3605,29 @@ }, { "name": "utopia-php/cli", - "version": "0.15.4", + "version": "0.22.0", "source": { "type": "git", "url": "https://github.com/utopia-php/cli.git", - "reference": "cc873548dcab4329f2d56ca35f2edf3ae9d70f51" + "reference": "a7ac387ee626fd27075a87e836fb72c5be38add4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/cli/zipball/cc873548dcab4329f2d56ca35f2edf3ae9d70f51", - "reference": "cc873548dcab4329f2d56ca35f2edf3ae9d70f51", + "url": "https://api.github.com/repos/utopia-php/cli/zipball/a7ac387ee626fd27075a87e836fb72c5be38add4", + "reference": "a7ac387ee626fd27075a87e836fb72c5be38add4", "shasum": "" }, "require": { "php": ">=7.4", - "utopia-php/framework": "0.*.*" + "utopia-php/servers": "0.2.*" }, "require-dev": { "laravel/pint": "1.2.*", + "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^9.3", "squizlabs/php_codesniffer": "^3.6", - "vimeo/psalm": "4.0.1" + "swoole/ide-helper": "4.8.8", + "utopia-php/console": "0.0.*" }, "type": "library", "autoload": { @@ -3648,9 +3650,9 @@ ], "support": { "issues": "https://github.com/utopia-php/cli/issues", - "source": "https://github.com/utopia-php/cli/tree/0.15.4" + "source": "https://github.com/utopia-php/cli/tree/0.22.0" }, - "time": "2026-02-06T09:49:09+00:00" + "time": "2025-10-21T10:42:45+00:00" }, { "name": "utopia-php/compression", @@ -4112,21 +4114,20 @@ }, { "name": "utopia-php/emails", - "version": "0.6.6", + "version": "0.6.8", "source": { "type": "git", "url": "https://github.com/utopia-php/emails.git", - "reference": "354f7fe591e1fba7736afada558cb3b02ec03fea" + "reference": "25dfcd46ed47b862d2a7e7c98d92a3a4680b6f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/emails/zipball/354f7fe591e1fba7736afada558cb3b02ec03fea", - "reference": "354f7fe591e1fba7736afada558cb3b02ec03fea", + "url": "https://api.github.com/repos/utopia-php/emails/zipball/25dfcd46ed47b862d2a7e7c98d92a3a4680b6f1b", + "reference": "25dfcd46ed47b862d2a7e7c98d92a3a4680b6f1b", "shasum": "" }, "require": { "php": ">=8.0", - "utopia-php/cli": "^0.15", "utopia-php/domains": "^1.0", "utopia-php/fetch": "^0.5", "utopia-php/validators": "0.*" @@ -4134,7 +4135,9 @@ "require-dev": { "laravel/pint": "1.25.*", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.3", + "utopia-php/cli": "^0.22", + "utopia-php/console": "0.*" }, "type": "library", "autoload": { @@ -4166,9 +4169,9 @@ ], "support": { "issues": "https://github.com/utopia-php/emails/issues", - "source": "https://github.com/utopia-php/emails/tree/0.6.6" + "source": "https://github.com/utopia-php/emails/tree/0.6.8" }, - "time": "2026-02-02T10:41:22+00:00" + "time": "2026-02-09T12:31:56+00:00" }, { "name": "utopia-php/fetch", @@ -4211,16 +4214,16 @@ }, { "name": "utopia-php/framework", - "version": "0.33.38", + "version": "dev-backport-0.34-adapters", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "decfa49d60d99e922de364c49169b396fafd5ab8" + "reference": "95ea85612d4db7cc30164aa54abb3befc4ba3ab8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/decfa49d60d99e922de364c49169b396fafd5ab8", - "reference": "decfa49d60d99e922de364c49169b396fafd5ab8", + "url": "https://api.github.com/repos/utopia-php/http/zipball/95ea85612d4db7cc30164aa54abb3befc4ba3ab8", + "reference": "95ea85612d4db7cc30164aa54abb3befc4ba3ab8", "shasum": "" }, "require": { @@ -4253,9 +4256,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.38" + "source": "https://github.com/utopia-php/http/tree/backport-0.34-adapters" }, - "time": "2026-02-04T04:59:25+00:00" + "time": "2026-02-09T12:47:49+00:00" }, { "name": "utopia-php/image", @@ -4577,26 +4580,26 @@ }, { "name": "utopia-php/orchestration", - "version": "0.9.1", + "version": "0.19.0", "source": { "type": "git", "url": "https://github.com/utopia-php/orchestration.git", - "reference": "55f43513b3f940a3f4f9c2cde7682d0c2581beb0" + "reference": "e8d8d045a8c4997bf4c9f830e9161423f005143a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/orchestration/zipball/55f43513b3f940a3f4f9c2cde7682d0c2581beb0", - "reference": "55f43513b3f940a3f4f9c2cde7682d0c2581beb0", + "url": "https://api.github.com/repos/utopia-php/orchestration/zipball/e8d8d045a8c4997bf4c9f830e9161423f005143a", + "reference": "e8d8d045a8c4997bf4c9f830e9161423f005143a", "shasum": "" }, "require": { "php": ">=8.0", - "utopia-php/cli": "0.15.*" + "utopia-php/console": "0.0.*" }, "require-dev": { "laravel/pint": "^1.2", - "phpunit/phpunit": "^9.3", - "vimeo/psalm": "4.0.1" + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.3" }, "type": "library", "autoload": { @@ -4621,30 +4624,30 @@ ], "support": { "issues": "https://github.com/utopia-php/orchestration/issues", - "source": "https://github.com/utopia-php/orchestration/tree/0.9.1" + "source": "https://github.com/utopia-php/orchestration/tree/0.19.0" }, - "time": "2023-03-17T15:05:06+00:00" + "time": "2025-10-21T08:54:03+00:00" }, { "name": "utopia-php/platform", - "version": "0.7.15", + "version": "dev-bump-cli-and-framework", "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "1b94e9b7c3f86d8955178ed05696bb7c8f49839a" + "reference": "45f9ecefeae3c755453e96cafd31b5d3da66b2e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/1b94e9b7c3f86d8955178ed05696bb7c8f49839a", - "reference": "1b94e9b7c3f86d8955178ed05696bb7c8f49839a", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/45f9ecefeae3c755453e96cafd31b5d3da66b2e2", + "reference": "45f9ecefeae3c755453e96cafd31b5d3da66b2e2", "shasum": "" }, "require": { "ext-json": "*", "ext-redis": "*", "php": ">=8.0", - "utopia-php/cli": "0.15.*", - "utopia-php/framework": "0.33.*", + "utopia-php/cli": "0.22.*", + "utopia-php/framework": "dev-backport-0.34-adapters as 0.33.38", "utopia-php/queue": "0.15.*" }, "require-dev": { @@ -4655,6 +4658,7 @@ "type": "library", "autoload": { "psr-4": { + "Utopia\\": "src", "Utopia\\Platform\\": "src/Platform" } }, @@ -4672,9 +4676,9 @@ ], "support": { "issues": "https://github.com/utopia-php/platform/issues", - "source": "https://github.com/utopia-php/platform/tree/0.7.15" + "source": "https://github.com/utopia-php/platform/tree/bump-cli-and-framework" }, - "time": "2026-02-04T05:28:13+00:00" + "time": "2026-02-09T12:52:20+00:00" }, { "name": "utopia-php/pools", @@ -4903,16 +4907,16 @@ }, { "name": "utopia-php/servers", - "version": "0.2.4", + "version": "0.2.5", "source": { "type": "git", "url": "https://github.com/utopia-php/servers.git", - "reference": "8675d32f4315e91cdb7757a829356030029ed4f5" + "reference": "4770e879a90685af4ba14e7e5d95d0a17c7fdf03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/servers/zipball/8675d32f4315e91cdb7757a829356030029ed4f5", - "reference": "8675d32f4315e91cdb7757a829356030029ed4f5", + "url": "https://api.github.com/repos/utopia-php/servers/zipball/4770e879a90685af4ba14e7e5d95d0a17c7fdf03", + "reference": "4770e879a90685af4ba14e7e5d95d0a17c7fdf03", "shasum": "" }, "require": { @@ -4951,9 +4955,9 @@ ], "support": { "issues": "https://github.com/utopia-php/servers/issues", - "source": "https://github.com/utopia-php/servers/tree/0.2.4" + "source": "https://github.com/utopia-php/servers/tree/0.2.5" }, - "time": "2026-02-04T07:15:26+00:00" + "time": "2026-02-10T04:21:53+00:00" }, { "name": "utopia-php/span", @@ -5056,57 +5060,6 @@ }, "time": "2025-12-17T13:55:20+00:00" }, - { - "name": "utopia-php/swoole", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/utopia-php/swoole.git", - "reference": "8c89f38ff163de6c6f8a4898e467ca38c1f03133" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/utopia-php/swoole/zipball/8c89f38ff163de6c6f8a4898e467ca38c1f03133", - "reference": "8c89f38ff163de6c6f8a4898e467ca38c1f03133", - "shasum": "" - }, - "require": { - "ext-swoole": "6.*", - "php": ">=8.1", - "utopia-php/framework": "0.33.*" - }, - "require-dev": { - "laravel/pint": "1.2.*", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.3", - "swoole/ide-helper": "6.0.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\Swoole\\": "src/Swoole" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "An extension for Utopia Framework to work with PHP Swoole as a PHP FPM alternative", - "keywords": [ - "framework", - "http", - "php", - "server", - "swoole", - "upf", - "utopia" - ], - "support": { - "issues": "https://github.com/utopia-php/swoole/issues", - "source": "https://github.com/utopia-php/swoole/tree/1.0.2" - }, - "time": "2026-02-04T05:12:48+00:00" - }, { "name": "utopia-php/system", "version": "0.10.0", @@ -8992,9 +8945,25 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/framework", + "version": "dev-backport-0.34-adapters", + "alias": "0.33.38", + "alias_normalized": "0.33.38.0" + }, + { + "package": "utopia-php/platform", + "version": "dev-bump-cli-and-framework", + "alias": "0.7.15", + "alias_normalized": "0.7.15.0" + } + ], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": { + "utopia-php/framework": 20, + "utopia-php/platform": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/src/Appwrite/Certificates/LetsEncrypt.php b/src/Appwrite/Certificates/LetsEncrypt.php index 1116336399..001d04941e 100644 --- a/src/Appwrite/Certificates/LetsEncrypt.php +++ b/src/Appwrite/Certificates/LetsEncrypt.php @@ -4,9 +4,9 @@ namespace Appwrite\Certificates; use Appwrite\Certificates\Exception\CertificateStatus as CertificateStatusException; use Exception; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\DateTime; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Logger\Log; class LetsEncrypt implements Adapter diff --git a/src/Appwrite/GraphQL/Resolvers.php b/src/Appwrite/GraphQL/Resolvers.php index 4de9661499..4621eb3689 100644 --- a/src/Appwrite/GraphQL/Resolvers.php +++ b/src/Appwrite/GraphQL/Resolvers.php @@ -7,8 +7,8 @@ use Appwrite\Promises\Swoole; use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; use Utopia\Exception; -use Utopia\Http; -use Utopia\Route; +use Utopia\Http\Http; +use Utopia\Http\Route; use Utopia\System\System; class Resolvers diff --git a/src/Appwrite/GraphQL/Schema.php b/src/Appwrite/GraphQL/Schema.php index d6bf54f744..fa93d48a40 100644 --- a/src/Appwrite/GraphQL/Schema.php +++ b/src/Appwrite/GraphQL/Schema.php @@ -7,8 +7,8 @@ use GraphQL\Type\Definition\ObjectType; use GraphQL\Type\Definition\Type; use GraphQL\Type\Schema as GQLSchema; use Utopia\Exception; -use Utopia\Http; -use Utopia\Route; +use Utopia\Http\Http; +use Utopia\Http\Route; class Schema { diff --git a/src/Appwrite/GraphQL/Types/Mapper.php b/src/Appwrite/GraphQL/Types/Mapper.php index 467a5a9c0e..fbe7a2f43d 100644 --- a/src/Appwrite/GraphQL/Types/Mapper.php +++ b/src/Appwrite/GraphQL/Types/Mapper.php @@ -9,8 +9,8 @@ use Exception; use GraphQL\Type\Definition\ObjectType; use GraphQL\Type\Definition\Type; use GraphQL\Type\Definition\UnionType; -use Utopia\Http; -use Utopia\Route; +use Utopia\Http\Http; +use Utopia\Http\Route; use Utopia\Validator; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 749c64d08c..519f05de2c 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -3,8 +3,8 @@ namespace Appwrite\Migration; use Exception; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Conflict; diff --git a/src/Appwrite/Migration/Version/V15.php b/src/Appwrite/Migration/Version/V15.php index 15331e9a37..66037660c0 100644 --- a/src/Appwrite/Migration/Version/V15.php +++ b/src/Appwrite/Migration/Version/V15.php @@ -4,8 +4,8 @@ namespace Appwrite\Migration\Version; use Appwrite\Migration\Migration; use Appwrite\OpenSSL\OpenSSL; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Helpers\ID; diff --git a/src/Appwrite/Migration/Version/V16.php b/src/Appwrite/Migration/Version/V16.php index 061ace31d7..efb731e176 100644 --- a/src/Appwrite/Migration/Version/V16.php +++ b/src/Appwrite/Migration/Version/V16.php @@ -3,8 +3,8 @@ namespace Appwrite\Migration\Version; use Appwrite\Migration\Migration; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; diff --git a/src/Appwrite/Migration/Version/V17.php b/src/Appwrite/Migration/Version/V17.php index 79e2a8377d..3297206ccd 100644 --- a/src/Appwrite/Migration/Version/V17.php +++ b/src/Appwrite/Migration/Version/V17.php @@ -4,7 +4,7 @@ namespace Appwrite\Migration\Version; use Appwrite\Migration\Migration; use Utopia\Auth\Proofs\Password; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; diff --git a/src/Appwrite/Migration/Version/V18.php b/src/Appwrite/Migration/Version/V18.php index aa2ad35cca..2acbc5ec04 100644 --- a/src/Appwrite/Migration/Version/V18.php +++ b/src/Appwrite/Migration/Version/V18.php @@ -3,7 +3,7 @@ namespace Appwrite\Migration\Version; use Appwrite\Migration\Migration; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Helpers\Permission; diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index f5cf84c95e..2526d03009 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -3,8 +3,8 @@ namespace Appwrite\Migration\Version; use Appwrite\Migration\Migration; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; diff --git a/src/Appwrite/Migration/Version/V20.php b/src/Appwrite/Migration/Version/V20.php index 10e2706d0e..3c13815949 100644 --- a/src/Appwrite/Migration/Version/V20.php +++ b/src/Appwrite/Migration/Version/V20.php @@ -6,7 +6,7 @@ use Appwrite\Migration\Migration; use Exception; use PDOException; use Throwable; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; diff --git a/src/Appwrite/Migration/Version/V21.php b/src/Appwrite/Migration/Version/V21.php index 891d2a92fe..0c9d824874 100644 --- a/src/Appwrite/Migration/Version/V21.php +++ b/src/Appwrite/Migration/Version/V21.php @@ -5,7 +5,7 @@ namespace Appwrite\Migration\Version; use Appwrite\Migration\Migration; use Exception; use Throwable; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; diff --git a/src/Appwrite/Migration/Version/V22.php b/src/Appwrite/Migration/Version/V22.php index ba9c9dc126..6202a4f3d5 100644 --- a/src/Appwrite/Migration/Version/V22.php +++ b/src/Appwrite/Migration/Version/V22.php @@ -5,7 +5,7 @@ namespace Appwrite\Migration\Version; use Appwrite\Migration\Migration; use Exception; use Throwable; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Conflict; diff --git a/src/Appwrite/Migration/Version/V23.php b/src/Appwrite/Migration/Version/V23.php index 64a45fc9b2..acf20ba71c 100644 --- a/src/Appwrite/Migration/Version/V23.php +++ b/src/Appwrite/Migration/Version/V23.php @@ -5,8 +5,8 @@ namespace Appwrite\Migration\Version; use Appwrite\Migration\Migration; use Exception; use Throwable; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Conflict; diff --git a/src/Appwrite/Platform/Action.php b/src/Appwrite/Platform/Action.php index b9f8a8186a..01ac92a45c 100644 --- a/src/Appwrite/Platform/Action.php +++ b/src/Appwrite/Platform/Action.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform; use Swoole\Coroutine as Co; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index db0cfe7daf..07ca67c5cb 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -15,7 +15,7 @@ use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; -use Utopia\Swoole\Request; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\System\System; use Utopia\VCS\Adapter\Git\GitHub; use Utopia\VCS\Exception\RepositoryNotFound; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php index 3709fb2814..a06fd23ea9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php @@ -19,8 +19,8 @@ use Utopia\Database\Exception\Truncate as TruncateException; use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Structure; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Platform\Action as UtopiaAction; -use Utopia\Swoole\Response as SwooleResponse; use Utopia\Validator\Range; abstract class Action extends UtopiaAction diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Create.php index 442461fdd3..337f81b6d0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Create.php @@ -15,7 +15,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Update.php index 92324aae70..f8a62e7d13 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Boolean/Update.php @@ -14,7 +14,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Create.php index bd3108a871..f0201eb9e5 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Create.php @@ -16,7 +16,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Datetime as DatetimeValidator; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Update.php index 2518875424..b504a83747 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Datetime/Update.php @@ -15,7 +15,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Datetime as DatetimeValidator; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php index 37ae2a7bfe..f0b08ecd7c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php @@ -16,7 +16,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\IndexDependency as IndexDependencyValidator; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Delete extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Create.php index a36e264e50..f690497719 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Create.php @@ -16,7 +16,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Update.php index 609a337625..996091d0fb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Email/Update.php @@ -15,7 +15,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Create.php index 3c47d1fdfe..502d8b1e3b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Create.php @@ -16,7 +16,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Update.php index 5bea5230c0..42e6ffe8e7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Enum/Update.php @@ -14,7 +14,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Create.php index 0dc11bd76c..8806a749fc 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Create.php @@ -16,7 +16,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\FloatValidator; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Update.php index 20b5c0767d..4ea463419f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Float/Update.php @@ -14,7 +14,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\FloatValidator; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Get.php index 436b22c6c9..04dd0f0a1d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Get.php @@ -12,7 +12,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Get extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Create.php index 2adf3977f4..48e33a4bbb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Create.php @@ -15,7 +15,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\IP; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Update.php index eccf18b005..ae58b06c9f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/IP/Update.php @@ -14,7 +14,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\IP; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Create.php index 0989bb2904..d795bee2f4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Create.php @@ -16,7 +16,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Integer; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Update.php index 57797d3e03..af3c90fb14 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Integer/Update.php @@ -14,7 +14,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Integer; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php index fc846957b0..75d83822d0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Create.php @@ -16,7 +16,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php index 8fff545921..ec24e399c3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Line/Update.php @@ -15,7 +15,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Create.php index d43014f001..7ec249de28 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Create.php @@ -14,7 +14,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Update.php index fee62a4e00..26e3f0ef8f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Longtext/Update.php @@ -13,7 +13,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Create.php index d3405670c1..918379d2a0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Create.php @@ -14,7 +14,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Update.php index a9792f29f7..45feb7aa9a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Mediumtext/Update.php @@ -13,7 +13,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php index a89c21581d..9e9cb8f64c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Create.php @@ -16,7 +16,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php index 9561fe6b96..3cd05de283 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Point/Update.php @@ -15,7 +15,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php index 54da3ac604..cfe15b4197 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Create.php @@ -16,7 +16,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php index b82a3d4be0..da6fcbfec6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Polygon/Update.php @@ -15,7 +15,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php index 615e64dfd7..4e34c1abfd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php @@ -16,7 +16,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\WhiteList; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Update.php index d180131a44..2eb28e2e7b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Update.php @@ -14,7 +14,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Nullable; use Utopia\Validator\WhiteList; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Create.php index 1d513e4471..7626f6f9f1 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Create.php @@ -16,8 +16,8 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Http; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; +use Utopia\Http\Http; use Utopia\Validator; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Update.php index 37547f3da8..43cbee5be6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/String/Update.php @@ -14,7 +14,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Create.php index ce89f9e70d..bc9b853d0f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Create.php @@ -14,7 +14,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Update.php index e0a82d196d..ec9b2979f7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Text/Update.php @@ -13,7 +13,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Create.php index ed1a23acf5..0e72d4adda 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Create.php @@ -15,7 +15,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\URL; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Update.php index 08f7a26fd9..428c3ec158 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/URL/Update.php @@ -14,7 +14,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\URL; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Create.php index 543d54aef1..c35ad518ab 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Create.php @@ -15,7 +15,7 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Update.php index e8388e11b2..0ce20abd2d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Varchar/Update.php @@ -13,7 +13,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php index 61c5b295cf..b5fa62b577 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php @@ -17,7 +17,7 @@ use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; class XList extends Action diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index 31125ae417..c7b69ea684 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -25,7 +25,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Index as IndexValidator; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; use Utopia\Validator\JSON; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php index fd2c419954..84022c4491 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php @@ -14,7 +14,7 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Delete extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php index 16b7bd1b25..8fd9b7ae6f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php @@ -24,7 +24,7 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Nullable; use Utopia\Validator\Numeric; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php index 7adae7633b..057af54e77 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php @@ -24,7 +24,7 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Nullable; use Utopia\Validator\Numeric; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php index a3d3535065..7a26a84fd6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php @@ -21,7 +21,7 @@ use Utopia\Database\Exception\Restricted as RestrictedException; use Utopia\Database\Helpers\ID; use Utopia\Database\Query; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php index fdc49b1901..5221ec36a3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php @@ -23,7 +23,7 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Query; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\JSON; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php index 00e4663171..1a584591ae 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php @@ -21,7 +21,7 @@ use Utopia\Database\Exception\Relationship as RelationshipException; use Utopia\Database\Exception\Structure as StructureException; use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\JSON; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php index 624d3c48ff..7134f7bae6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php @@ -28,7 +28,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization\Input; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\JSON; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php index 7acf8e386e..0be22d00a5 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php @@ -20,7 +20,7 @@ use Utopia\Database\Exception\Restricted as RestrictedException; use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Nullable; class Delete extends Action diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php index cb8b0dd42e..eaca51d88a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php @@ -17,7 +17,7 @@ use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php index 2f5579f0ca..97b018c460 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php @@ -22,8 +22,8 @@ use Utopia\Database\Validator\Queries; use Utopia\Database\Validator\Query\Limit; use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Locale\Locale; -use Utopia\Swoole\Response as SwooleResponse; class XList extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php index ff3ab6e23c..9b52f875a0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php @@ -25,7 +25,7 @@ use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\JSON; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php index d0536b65ef..cf71daa897 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php @@ -26,7 +26,7 @@ use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\JSON; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php index 295b78a114..ec73292be2 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php @@ -20,7 +20,7 @@ use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Get.php index 5d6e3ee5ef..141da5d625 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Get.php @@ -12,7 +12,7 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Get extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php index 7995c19af7..3560506cfc 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php @@ -20,7 +20,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Index as IndexValidator; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Integer; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php index d9f9f66504..57dd878456 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php @@ -15,7 +15,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Delete extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Get.php index 661f259910..6c5846b1bd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Get.php @@ -13,7 +13,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Get extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/XList.php index b9705515eb..c1b338b2b4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/XList.php @@ -18,7 +18,7 @@ use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; class XList extends Action diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php index 0b6e47a798..64225f1687 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php @@ -22,8 +22,8 @@ use Utopia\Database\Validator\Queries; use Utopia\Database\Validator\Query\Limit; use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Locale\Locale; -use Utopia\Swoole\Response as SwooleResponse; class XList extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php index ebf7b75a17..db3df09b7f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php @@ -15,7 +15,7 @@ use Utopia\Database\Helpers\Permission; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Usage/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Usage/Get.php index 0552a31509..a75094f119 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Usage/Get.php @@ -16,7 +16,7 @@ use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\WhiteList; class Get extends Action diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/XList.php index baabe6b358..83acc9f143 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/XList.php @@ -18,7 +18,7 @@ use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php index 790bea2e1a..6d991c5eb8 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php @@ -19,7 +19,7 @@ use Utopia\Database\Exception\Index as IndexException; use Utopia\Database\Exception\Limit as LimitException; use Utopia\Database\Exception\Structure as StructureException; use Utopia\Database\Helpers\ID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php index 440f86cfd8..10f579f2e1 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php @@ -13,8 +13,8 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Platform\Action; -use Utopia\Swoole\Response as SwooleResponse; class Delete extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Get.php index 93cea53420..e2c653c649 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Get.php @@ -11,8 +11,8 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Platform\Action; -use Utopia\Swoole\Response as SwooleResponse; class Get extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php index 319f07db1c..3c0d81b10a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php @@ -21,9 +21,9 @@ use Utopia\Database\Validator\Queries; use Utopia\Database\Validator\Query\Limit; use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Locale\Locale; use Utopia\Platform\Action; -use Utopia\Swoole\Response as SwooleResponse; class XList extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Create.php index 4ca20f8414..f2b351fa6a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Create.php @@ -13,7 +13,7 @@ use Utopia\Database\Document; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Validator\Authorization; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Range; class Create extends Action diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Delete.php index e52c598eea..0d0ea98e3e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Delete.php @@ -11,7 +11,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Delete extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Get.php index bc51b598ac..265da6a172 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Get.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Get extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Operations/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Operations/Create.php index f09ed2bc27..da36a5d4d8 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Operations/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Operations/Create.php @@ -20,7 +20,7 @@ use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization\Input; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; class Create extends Action diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php index eca92da313..6ead7e4055 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php @@ -26,7 +26,7 @@ use Utopia\Database\Exception\Transaction as TransactionException; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; class Update extends Action diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/XList.php index 4b1b45eab0..b10972ad64 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/XList.php @@ -13,7 +13,7 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Query; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class XList extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php index 3a073079e0..af129bd614 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php @@ -12,8 +12,8 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Platform\Action; -use Utopia\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/Get.php index a1aa7a70b8..d2515574b2 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/Get.php @@ -15,8 +15,8 @@ use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Platform\Action; -use Utopia\Swoole\Response as SwooleResponse; use Utopia\Validator\WhiteList; class Get extends Action diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/XList.php index 757f845c68..db5ad21358 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/XList.php @@ -13,8 +13,8 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Platform\Action; -use Utopia\Swoole\Response as SwooleResponse; use Utopia\Validator\WhiteList; class XList extends Action diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/XList.php index f9589c4469..8627fa49c5 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/XList.php @@ -16,8 +16,8 @@ use Utopia\Database\Exception\Order as OrderException; use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Query; use Utopia\Database\Validator\Query\Cursor; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Platform\Action; -use Utopia\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php b/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php index 72c7d0521d..87f6e3ee8d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Modules\Databases\Http\Init; use Appwrite\Utopia\Request; use Utopia\Database\Database; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Platform\Action; /** diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Create.php index d842210c92..ea30ee80d5 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Create.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Validator\CustomId; use Appwrite\Utopia\Response as UtopiaResponse; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Delete.php index dc26072178..2e8bd4a68a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Delete.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Delete extends DatabaseDelete { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Get.php index 6364f2dc0a..2767d5d790 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Get.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Get extends DatabaseGet { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php index 88745555d9..d4f46ac990 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php @@ -20,9 +20,9 @@ use Utopia\Database\Validator\Queries; use Utopia\Database\Validator\Query\Limit; use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Locale\Locale; use Utopia\Platform\Action; -use Utopia\Swoole\Response as SwooleResponse; class XList extends Action { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Create.php index eede1b221b..56aea51302 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Create.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Update.php index cd8d392cfc..2aa3f4576f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Boolean/Update.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Create.php index 79722efee1..b66ad46c39 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Create.php @@ -11,7 +11,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Datetime as DatetimeValidator; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php index c39681a743..4df532bb46 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php @@ -12,7 +12,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Datetime as DatetimeValidator; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Delete.php index da63b0cef7..6a4fdb3eae 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Delete.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Delete extends AttributesDelete { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Create.php index 51e7f295a1..273b3fe634 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Create.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Update.php index daca13d587..0477ebf708 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Email/Update.php @@ -11,7 +11,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Create.php index 4d5881c81e..2e19183241 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Create.php @@ -10,7 +10,7 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Update.php index 122671adc5..9f9ca15104 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Enum/Update.php @@ -11,7 +11,7 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Create.php index cd898fa0bf..42dbc5a8e5 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Create.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\FloatValidator; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Update.php index ee9c5f6cb1..c0d458d21e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Float/Update.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\FloatValidator; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Get.php index 39dafbd1a6..7aa09a9cec 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Get.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Get extends AttributesGet { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Create.php index 80c764b4c5..5d6c0de006 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Create.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\IP; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Update.php index 54ed029c71..304abb3ab9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/IP/Update.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\IP; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Create.php index f590e8bdbb..52c6d22621 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Create.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Integer; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Update.php index 83b6f1bfc6..fc186a2388 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Integer/Update.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Integer; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php index 227fece7de..8c45a8ff8a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Create.php @@ -11,7 +11,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php index b0e433da5f..6d4b166524 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Line/Update.php @@ -12,7 +12,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Create.php index 81a72f8d9e..fa06fb3ab3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Create.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Update.php index 92533dbe0a..fe93530cfb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Longtext/Update.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Create.php index 9893424713..6b5eba648e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Create.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Update.php index 15164343ca..733159d1d4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Mediumtext/Update.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php index 3fc5865905..837574c102 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Create.php @@ -11,7 +11,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php index 040b8171d7..5fb92495ed 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Point/Update.php @@ -12,7 +12,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php index 630340ba7b..17bdee7e8e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Create.php @@ -11,7 +11,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php index 43b4a4e6a4..c473bcadab 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Polygon/Update.php @@ -12,7 +12,7 @@ use Utopia\Database\Database; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\Spatial; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Create.php index 7f28a3cdb7..d7dac40de8 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Create.php @@ -10,7 +10,7 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\WhiteList; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Update.php index fd7fdab8de..ff95986e64 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Relationship/Update.php @@ -11,7 +11,7 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Nullable; use Utopia\Validator\WhiteList; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Create.php index 517288b297..1268a279bd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Create.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Update.php index 05894aaa94..8b3c7a5f49 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/String/Update.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Create.php index 704f74060e..4024537c2d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Create.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Update.php index ce6b7c64a1..599c93988d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Text/Update.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Create.php index b19d6e80a2..007b99d055 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Create.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\URL; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Update.php index dce11964e8..9f08145a04 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/URL/Update.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\URL; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Create.php index 89e00c0d6b..fada172d2a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Create.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Update.php index a1be057484..2b8eb9fbd7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Varchar/Update.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/XList.php index 13ebe14682..9750e87088 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/XList.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Validator\Queries\Columns; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; class XList extends AttributesXList diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php index bd08ad5617..7d6bacb81c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php @@ -11,7 +11,7 @@ use Appwrite\Utopia\Database\Validator\CustomId; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; use Utopia\Validator\JSON; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php index 925a7b2494..14a9bcbb5c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Delete extends CollectionDelete { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Get.php index ad83291815..970e5e78a7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Get.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Get extends CollectionGet { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php index 09720f4d71..2b81036a2c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php @@ -11,7 +11,7 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Integer; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Delete.php index 7fa8073d1e..ac53b86d3c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Delete.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Delete extends IndexDelete { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Get.php index 246d569825..944466af19 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Get.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Get extends IndexGet { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/XList.php index 1dc2d3ea43..42dc7422dd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/XList.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Validator\Queries\Indexes; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; class XList extends IndexXList diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Logs/XList.php index 79691436e4..0f03783095 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Logs/XList.php @@ -11,7 +11,7 @@ use Utopia\Database\Validator\Queries; use Utopia\Database\Validator\Query\Limit; use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class XList extends CollectionLogXList { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php index 45e5b84774..1d1767dbff 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php index 3062186624..025604e9f9 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\JSON; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php index 3f837917c8..edc6d7018a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\JSON; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php index a660b008e1..62ac111543 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Nullable; use Utopia\Validator\Numeric; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Increment.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Increment.php index c2b69429ce..f966b2e106 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Increment.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Increment.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Key; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Nullable; use Utopia\Validator\Numeric; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php index 0f28a561ed..45a713eada 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php @@ -13,7 +13,7 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\JSON; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php index 1763491c19..320d4626b0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Nullable; class Delete extends DocumentDelete diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Get.php index bb24e93de0..ef05336aef 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Get.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Logs/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Logs/XList.php index 86bfcfec85..12bbeaf741 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Logs/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Logs/XList.php @@ -11,7 +11,7 @@ use Utopia\Database\Validator\Queries; use Utopia\Database\Validator\Query\Limit; use Utopia\Database\Validator\Query\Offset; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class XList extends DocumentLogXList { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Update.php index 0879055a78..656548e176 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Update.php @@ -11,7 +11,7 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\JSON; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php index 99e0487c93..bf281b623f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php @@ -11,7 +11,7 @@ use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Database; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\JSON; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/XList.php index 230d391110..35163b536c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/XList.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php index 32376eaea1..df411d7443 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Usage/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Usage/Get.php index b8be7edd56..17a3f41957 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Usage/Get.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\WhiteList; class Get extends CollectionUsageGet diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/XList.php index 5532203d0a..c20c368190 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/XList.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Validator\Queries\Tables; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Create.php index e7e5f0132f..6876cf6a8f 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Create.php @@ -8,7 +8,7 @@ use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Range; class Create extends TransactionsCreate diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Delete.php index 4838ea94db..143f609363 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Delete.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Delete extends TransactionsDelete { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Get.php index 5182972513..2732b5b274 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Get.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class Get extends TransactionsGet { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Operations/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Operations/Create.php index 1228c83e30..4ad9c13b05 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Operations/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Operations/Create.php @@ -10,7 +10,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Validator\Operation; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\ArrayList; class Create extends OperationsCreate diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Update.php index 807e96800e..78c7d9985c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/Update.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; class Update extends TransactionsUpdate diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/XList.php index 4f073d5714..f06ef13af8 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Transactions/XList.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Validator\Queries\Transactions; use Appwrite\Utopia\Response as UtopiaResponse; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; class XList extends TransactionsList { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php index 81cb9c781c..14a49c8166 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Update.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Usage/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Usage/Get.php index 87be8a9eab..fe91ee0bfd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Usage/Get.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; use Utopia\Database\Validator\UID; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\WhiteList; class Get extends DatabaseUsageGet diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Usage/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Usage/XList.php index 2cde337f5f..a479693206 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Usage/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Usage/XList.php @@ -8,7 +8,7 @@ use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response as UtopiaResponse; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\WhiteList; class XList extends DatabaseUsageXList diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/XList.php index 4299e7c862..80a9bd3686 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/XList.php @@ -9,7 +9,7 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Validator\Queries\Databases; use Appwrite\Utopia\Response as UtopiaResponse; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; use Utopia\Validator\Boolean; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php b/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php index c7cf7c8695..af2d4c9079 100644 --- a/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php +++ b/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Modules\Databases\Workers; use Appwrite\Event\Realtime; use Exception; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception as DatabaseException; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php index 97c669b9fb..41d4370fe8 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php @@ -19,6 +19,7 @@ use Utopia\Database\Helpers\Role; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; @@ -26,7 +27,6 @@ use Utopia\Storage\Validator\File; use Utopia\Storage\Validator\FileExt; use Utopia\Storage\Validator\FileSize; use Utopia\Storage\Validator\Upload; -use Utopia\Swoole\Request; use Utopia\System\System; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index 5487affae9..8c48045d7c 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -11,10 +11,10 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; -use Utopia\Swoole\Request; use Utopia\Validator\WhiteList; class Get extends Action diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php index d4bf7446fb..666d20bd7f 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php @@ -17,9 +17,9 @@ use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -use Utopia\Swoole\Request; use Utopia\Validator\Boolean; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php index 25dce63b38..8b2596f908 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php @@ -13,9 +13,9 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -use Utopia\Swoole\Request; use Utopia\Validator\Boolean; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index 9265d72b48..0c497df6ea 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -21,8 +21,8 @@ use Executor\Executor; use MaxMind\Db\Reader; use Utopia\Auth\Proofs\Token; use Utopia\Auth\Store; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; @@ -33,9 +33,9 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization\Input; use Utopia\Database\Validator\Datetime as DatetimeValidator; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -use Utopia\Swoole\Request; use Utopia\System\System; use Utopia\Validator\AnyOf; use Utopia\Validator\Assoc; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php index 73a6e5bb18..82528debec 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -29,9 +29,9 @@ use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Roles; +use Utopia\Http\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -use Utopia\Request; use Utopia\System\System; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index 3df257726a..d72e365fbd 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -23,9 +23,9 @@ use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Roles; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -use Utopia\Swoole\Request; use Utopia\System\System; use Utopia\Validator\ArrayList; use Utopia\Validator\Boolean; diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 1c70a1b4ef..aaa5baf3cf 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -15,8 +15,8 @@ use Exception; use Executor\Executor; use Swoole\Coroutine as Co; use Utopia\Cache\Cache; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php b/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php index ca89532307..ff0fa812cf 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php @@ -7,8 +7,8 @@ use Appwrite\Event\Realtime; use Appwrite\Permission; use Appwrite\Role; use Exception; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Helpers\ID; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php index 6d6b599ed7..a4d0c5796c 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php @@ -19,6 +19,7 @@ use Utopia\Database\Helpers\Role; use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; @@ -26,7 +27,6 @@ use Utopia\Storage\Validator\File; use Utopia\Storage\Validator\FileExt; use Utopia\Storage\Validator\FileSize; use Utopia\Storage\Validator\Upload; -use Utopia\Swoole\Request; use Utopia\System\System; use Utopia\Validator\Boolean; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index 50f2ec952d..c7982d9834 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -11,10 +11,10 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; -use Utopia\Swoole\Request; use Utopia\Validator\WhiteList; class Get extends Action diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php index 1d60c6776c..23bbe65f94 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php @@ -14,10 +14,10 @@ use Utopia\Database\Document; use Utopia\Database\Helpers\ID; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Device; -use Utopia\Swoole\Request; use Utopia\System\System; class Create extends Action diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php index e36bed94bc..cb95f8840f 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php @@ -17,9 +17,9 @@ use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -use Utopia\Swoole\Request; use Utopia\System\System; use Utopia\Validator\Boolean; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php index ea883aca23..c22038dbf4 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php @@ -14,9 +14,9 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -use Utopia\Swoole\Request; use Utopia\Validator\Boolean; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 9cfa45b77b..a071ab8bbe 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -18,9 +18,9 @@ use Utopia\Database\Document; use Utopia\Database\Helpers\ID; use Utopia\Database\Query; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; -use Utopia\Swoole\Request; use Utopia\System\System; use Utopia\Validator\Boolean; use Utopia\Validator\Range; diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php index 4757461a98..0e39af653b 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php @@ -25,6 +25,7 @@ use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization\Input; use Utopia\Database\Validator\Permissions; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Compression\Algorithms\GZIP; @@ -36,7 +37,6 @@ use Utopia\Storage\Validator\File; use Utopia\Storage\Validator\FileExt; use Utopia\Storage\Validator\FileSize; use Utopia\Storage\Validator\Upload; -use Utopia\Swoole\Request; use Utopia\System\System; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index bbceff51ec..4a52c87238 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -16,13 +16,13 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization\Input; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Compression\Algorithms\GZIP; use Utopia\Storage\Compression\Algorithms\Zstd; use Utopia\Storage\Compression\Compression; use Utopia\Storage\Device; -use Utopia\Swoole\Request; use Utopia\System\System; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php index 7ab3e713bc..a53cbb3a52 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -11,14 +11,15 @@ use Appwrite\SDK\MethodType; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Database\Documents\User; use Appwrite\Utopia\Response; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization\Input; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Image\Image; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; @@ -26,7 +27,6 @@ use Utopia\Storage\Compression\Algorithms\GZIP; use Utopia\Storage\Compression\Algorithms\Zstd; use Utopia\Storage\Compression\Compression; use Utopia\Storage\Device; -use Utopia\Swoole\Request; use Utopia\System\System; use Utopia\Validator\HexColor; use Utopia\Validator\Range; diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php index 516343e23f..60846cb546 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php @@ -13,13 +13,13 @@ use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Compression\Algorithms\GZIP; use Utopia\Storage\Compression\Algorithms\Zstd; use Utopia\Storage\Compression\Compression; use Utopia\Storage\Device; -use Utopia\Swoole\Request; use Utopia\System\System; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index 3874fedacf..73e7e58421 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -17,13 +17,13 @@ use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\Authorization\Input; use Utopia\Database\Validator\UID; +use Utopia\Http\Adapter\Swoole\Request; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; use Utopia\Storage\Compression\Algorithms\GZIP; use Utopia\Storage\Compression\Algorithms\Zstd; use Utopia\Storage\Compression\Compression; use Utopia\Storage\Device; -use Utopia\Swoole\Request; use Utopia\System\System; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Tasks/Doctor.php b/src/Appwrite/Platform/Tasks/Doctor.php index 02eadd903b..8ac1e1121b 100644 --- a/src/Appwrite/Platform/Tasks/Doctor.php +++ b/src/Appwrite/Platform/Tasks/Doctor.php @@ -6,12 +6,12 @@ use Appwrite\ClamAV\Network; use Appwrite\PubSub\Adapter\Pool as PubSubPool; use PHPMailer\PHPMailer\PHPMailer; use Utopia\Cache\Adapter\Pool as CachePool; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Adapter\Pool as DatabasePool; use Utopia\Domains\Domain; use Utopia\DSN\DSN; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Logger\Logger; use Utopia\Platform\Action; use Utopia\Pools\Group; diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index e51ea3188a..5ab413c8f2 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -7,8 +7,8 @@ use Appwrite\Docker\Env; use Appwrite\Utopia\View; use Utopia\Auth\Proofs\Password; use Utopia\Auth\Proofs\Token; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Platform\Action; use Utopia\Validator\Boolean; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Tasks/Interval.php b/src/Appwrite/Platform/Tasks/Interval.php index 6a11881ad1..38fc611465 100644 --- a/src/Appwrite/Platform/Tasks/Interval.php +++ b/src/Appwrite/Platform/Tasks/Interval.php @@ -7,7 +7,7 @@ use DateTime; use Swoole\Coroutine\Channel; use Swoole\Process; use Swoole\Timer; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime as DatabaseDateTime; use Utopia\Database\Document; diff --git a/src/Appwrite/Platform/Tasks/Maintenance.php b/src/Appwrite/Platform/Tasks/Maintenance.php index c0914c6544..2dace58d1d 100644 --- a/src/Appwrite/Platform/Tasks/Maintenance.php +++ b/src/Appwrite/Platform/Tasks/Maintenance.php @@ -6,7 +6,7 @@ use Appwrite\Event\Certificate; use Appwrite\Event\Delete; use DateInterval; use DateTime; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime as DatabaseDateTime; use Utopia\Database\Document; diff --git a/src/Appwrite/Platform/Tasks/Migrate.php b/src/Appwrite/Platform/Tasks/Migrate.php index d88e805fa8..cec2f6ec27 100644 --- a/src/Appwrite/Platform/Tasks/Migrate.php +++ b/src/Appwrite/Platform/Tasks/Migrate.php @@ -4,12 +4,12 @@ namespace Appwrite\Platform\Tasks; use Appwrite\Migration\Migration; use Redis; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception; use Utopia\Database\Validator\Authorization; -use Utopia\Http; +use Utopia\Http\Http; use Utopia\Platform\Action; use Utopia\Registry\Registry; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Tasks/QueueRetry.php b/src/Appwrite/Platform/Tasks/QueueRetry.php index 442fa39823..cd92ad8307 100644 --- a/src/Appwrite/Platform/Tasks/QueueRetry.php +++ b/src/Appwrite/Platform/Tasks/QueueRetry.php @@ -2,7 +2,7 @@ namespace Appwrite\Platform\Tasks; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Platform\Action; use Utopia\Queue\Publisher; use Utopia\Queue\Queue; diff --git a/src/Appwrite/Platform/Tasks/SDKs.php b/src/Appwrite/Platform/Tasks/SDKs.php index 013fae1193..302723364d 100644 --- a/src/Appwrite/Platform/Tasks/SDKs.php +++ b/src/Appwrite/Platform/Tasks/SDKs.php @@ -23,8 +23,8 @@ use Appwrite\SDK\Language\Swift; use Appwrite\SDK\Language\Web; use Appwrite\SDK\SDK; use Appwrite\Spec\Swagger2; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Platform\Action; use Utopia\Validator\Nullable; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Tasks/SSL.php b/src/Appwrite/Platform/Tasks/SSL.php index 699a09972e..ef8283f168 100644 --- a/src/Appwrite/Platform/Tasks/SSL.php +++ b/src/Appwrite/Platform/Tasks/SSL.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Tasks; use Appwrite\Event\Certificate; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Helpers\ID; diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index 19ed3bc099..cfcdc2503e 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -3,7 +3,7 @@ namespace Appwrite\Platform\Tasks; use Swoole\Timer; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; diff --git a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php index 7fda2f75df..88725a190a 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Tasks; use Appwrite\Event\Func; use Cron\CronExpression; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; diff --git a/src/Appwrite/Platform/Tasks/Screenshot.php b/src/Appwrite/Platform/Tasks/Screenshot.php index 71adb285c7..59e0b11c89 100644 --- a/src/Appwrite/Platform/Tasks/Screenshot.php +++ b/src/Appwrite/Platform/Tasks/Screenshot.php @@ -8,8 +8,8 @@ namespace Appwrite\Platform\Tasks; use Appwrite\ID; use Tests\E2E\Client; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Platform\Action; use Utopia\System\System; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index 57051f24f4..02d83e6d48 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -14,14 +14,14 @@ use Swoole\Http\Request as SwooleRequest; use Swoole\Http\Response as SwooleResponse; use Utopia\Cache\Adapter\None; use Utopia\Cache\Cache; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Adapter\MySQL; use Utopia\Database\Database; -use Utopia\Http; +use Utopia\Http\Http; +use Utopia\Http\Request as UtopiaRequest; +use Utopia\Http\Response as UtopiaResponse; use Utopia\Platform\Action; -use Utopia\Request as UtopiaRequest; -use Utopia\Response as UtopiaResponse; use Utopia\System\System; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; diff --git a/src/Appwrite/Platform/Tasks/Upgrade.php b/src/Appwrite/Platform/Tasks/Upgrade.php index d6159d2718..cca3dc7f53 100644 --- a/src/Appwrite/Platform/Tasks/Upgrade.php +++ b/src/Appwrite/Platform/Tasks/Upgrade.php @@ -2,7 +2,7 @@ namespace Appwrite\Platform\Tasks; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Validator\Boolean; use Utopia\Validator\Text; diff --git a/src/Appwrite/Platform/Tasks/Vars.php b/src/Appwrite/Platform/Tasks/Vars.php index 542b5bdc9f..e42330487b 100644 --- a/src/Appwrite/Platform/Tasks/Vars.php +++ b/src/Appwrite/Platform/Tasks/Vars.php @@ -2,8 +2,8 @@ namespace Appwrite\Platform\Tasks; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Platform\Action; use Utopia\System\System; diff --git a/src/Appwrite/Platform/Tasks/Version.php b/src/Appwrite/Platform/Tasks/Version.php index 25e2d13c65..c344039b0b 100644 --- a/src/Appwrite/Platform/Tasks/Version.php +++ b/src/Appwrite/Platform/Tasks/Version.php @@ -2,7 +2,7 @@ namespace Appwrite\Platform\Tasks; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Platform\Action; use Utopia\System\System; diff --git a/src/Appwrite/Platform/Workers/Audits.php b/src/Appwrite/Platform/Workers/Audits.php index 91dbb7cb00..d7c57c7fed 100644 --- a/src/Appwrite/Platform/Workers/Audits.php +++ b/src/Appwrite/Platform/Workers/Audits.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Workers; use Exception; use Throwable; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Document; use Utopia\Database\Exception\Authorization; use Utopia\Database\Exception\Structure; diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index cbfa865e88..7de67a2b66 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -15,7 +15,7 @@ use Appwrite\Template\Template; use Appwrite\Utopia\Response\Model\Rule; use Exception; use Throwable; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; diff --git a/src/Appwrite/Platform/Workers/Deletes.php b/src/Appwrite/Platform/Workers/Deletes.php index 435ce56f83..a211ec12fd 100644 --- a/src/Appwrite/Platform/Workers/Deletes.php +++ b/src/Appwrite/Platform/Workers/Deletes.php @@ -13,8 +13,8 @@ use Utopia\Audit\Adapter\SQL; use Utopia\Audit\Audit; use Utopia\Cache\Adapter\Filesystem; use Utopia\Cache\Cache; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index 98e846aa4d..90f2e480c8 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -12,8 +12,8 @@ use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Utopia\Response\Model\Execution; use Exception; use Executor\Executor; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Conflict; diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index edda34cf5a..559fc14111 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -7,8 +7,8 @@ use Appwrite\Event\Mail; use Appwrite\Event\Realtime; use Appwrite\Extend\Exception; use Appwrite\Template\Template; -use Utopia\CLI\Console; use Utopia\Config\Config; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Exception\Authorization as AuthorizationException; diff --git a/src/Appwrite/Platform/Workers/StatsResources.php b/src/Appwrite/Platform/Workers/StatsResources.php index 1c3db8d9c9..e5b0ca024c 100644 --- a/src/Appwrite/Platform/Workers/StatsResources.php +++ b/src/Appwrite/Platform/Workers/StatsResources.php @@ -5,7 +5,7 @@ namespace Appwrite\Platform\Workers; use Appwrite\Platform\Action; use Exception; use Throwable; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Query; diff --git a/src/Appwrite/Platform/Workers/StatsUsage.php b/src/Appwrite/Platform/Workers/StatsUsage.php index 6b62da8f80..56298a0dcd 100644 --- a/src/Appwrite/Platform/Workers/StatsUsage.php +++ b/src/Appwrite/Platform/Workers/StatsUsage.php @@ -4,7 +4,7 @@ namespace Appwrite\Platform\Workers; use Exception; use Throwable; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; diff --git a/src/Appwrite/SDK/Specification/Format.php b/src/Appwrite/SDK/Specification/Format.php index 93a470a6a3..53b4f1b3fa 100644 --- a/src/Appwrite/SDK/Specification/Format.php +++ b/src/Appwrite/SDK/Specification/Format.php @@ -4,8 +4,8 @@ namespace Appwrite\SDK\Specification; use Appwrite\Utopia\Response\Model; use Utopia\Config\Config; -use Utopia\Http; -use Utopia\Route; +use Utopia\Http\Http; +use Utopia\Http\Route; abstract class Format { diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 0d66e4d725..d70bda9285 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -16,7 +16,7 @@ use Utopia\Database\Database; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Spatial; -use Utopia\Route; +use Utopia\Http\Route; use Utopia\Validator; use Utopia\Validator\ArrayList; use Utopia\Validator\Nullable; diff --git a/src/Appwrite/Utopia/Request.php b/src/Appwrite/Utopia/Request.php index c87279f126..a5b3d038bb 100644 --- a/src/Appwrite/Utopia/Request.php +++ b/src/Appwrite/Utopia/Request.php @@ -7,8 +7,8 @@ use Appwrite\Utopia\Database\Documents\User; use Appwrite\Utopia\Request\Filter; use Swoole\Http\Request as SwooleRequest; use Utopia\Database\Validator\Authorization; -use Utopia\Route; -use Utopia\Swoole\Request as UtopiaRequest; +use Utopia\Http\Adapter\Swoole\Request as UtopiaRequest; +use Utopia\Http\Route; use Utopia\System\System; class Request extends UtopiaRequest diff --git a/src/Appwrite/Utopia/Request/Filter.php b/src/Appwrite/Utopia/Request/Filter.php index 6d47d4d150..4bd9b394a0 100644 --- a/src/Appwrite/Utopia/Request/Filter.php +++ b/src/Appwrite/Utopia/Request/Filter.php @@ -3,7 +3,6 @@ namespace Appwrite\Utopia\Request; use Utopia\Database\Database; -use Utopia\Route; abstract class Filter { diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index 9892fd5f78..fd518e4a9a 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -11,7 +11,7 @@ use JsonException; use Swoole\Http\Response as SwooleHTTPResponse; use Utopia\Database\Document; use Utopia\Database\Validator\Authorization; -use Utopia\Swoole\Response as SwooleResponse; +use Utopia\Http\Adapter\Swoole\Response as SwooleResponse; /** * @method int getStatusCode() @@ -292,8 +292,6 @@ class Response extends SwooleResponse */ protected static array $models = []; - protected SwooleHTTPResponse $swoole; - /** * Response constructor. * @@ -301,7 +299,6 @@ class Response extends SwooleResponse */ public function __construct(SwooleHTTPResponse $response) { - $this->swoole = $response; parent::__construct($response); } diff --git a/tests/e2e/Services/Functions/FunctionsBase.php b/tests/e2e/Services/Functions/FunctionsBase.php index 4994561c9a..8461e0deb9 100644 --- a/tests/e2e/Services/Functions/FunctionsBase.php +++ b/tests/e2e/Services/Functions/FunctionsBase.php @@ -5,7 +5,7 @@ namespace Tests\E2E\Services\Functions; use Appwrite\Tests\Async; use CURLFile; use Tests\E2E\Client; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Helpers\ID; use Utopia\Database\Query; use Utopia\System\System; diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 35bdf90347..5c95e5bdcc 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -8,7 +8,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Document; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Role; diff --git a/tests/e2e/Services/GraphQL/Base.php b/tests/e2e/Services/GraphQL/Base.php index c88e41ce8b..3e2624f83c 100644 --- a/tests/e2e/Services/GraphQL/Base.php +++ b/tests/e2e/Services/GraphQL/Base.php @@ -3,7 +3,7 @@ namespace Tests\E2E\Services\GraphQL; use CURLFile; -use Utopia\CLI\Console; +use Utopia\Console; trait Base { diff --git a/tests/e2e/Services/Proxy/ProxyBase.php b/tests/e2e/Services/Proxy/ProxyBase.php index c6d63495a0..75d7208002 100644 --- a/tests/e2e/Services/Proxy/ProxyBase.php +++ b/tests/e2e/Services/Proxy/ProxyBase.php @@ -6,7 +6,7 @@ use Appwrite\ID; use Appwrite\Tests\Async; use CURLFile; use Tests\E2E\Client; -use Utopia\CLI\Console; +use Utopia\Console; trait ProxyBase { diff --git a/tests/e2e/Services/Sites/SitesBase.php b/tests/e2e/Services/Sites/SitesBase.php index e7af09d1d9..2506924b4a 100644 --- a/tests/e2e/Services/Sites/SitesBase.php +++ b/tests/e2e/Services/Sites/SitesBase.php @@ -6,7 +6,7 @@ use Appwrite\Tests\Async; use Appwrite\Tests\Async\Exceptions\Critical; use CURLFile; use Tests\E2E\Client; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Helpers\ID; use Utopia\Database\Query; use Utopia\System\System; diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index 27294a9c3b..ab0a6946d6 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -9,7 +9,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Document; use Utopia\Database\Helpers\ID; use Utopia\Database\Query; diff --git a/tests/e2e/Services/Teams/TeamsCustomClientTest.php b/tests/e2e/Services/Teams/TeamsCustomClientTest.php index e30dacac74..6dbead76db 100644 --- a/tests/e2e/Services/Teams/TeamsCustomClientTest.php +++ b/tests/e2e/Services/Teams/TeamsCustomClientTest.php @@ -6,7 +6,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; -use Utopia\CLI\Console; +use Utopia\Console; class TeamsCustomClientTest extends Scope { diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php index d1f1106247..de431edbc2 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php @@ -8,7 +8,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -use Utopia\CLI\Console; +use Utopia\Console; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; diff --git a/tests/unit/Utopia/RequestTest.php b/tests/unit/Utopia/RequestTest.php index 63655de21d..78a3717c38 100644 --- a/tests/unit/Utopia/RequestTest.php +++ b/tests/unit/Utopia/RequestTest.php @@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase; use Swoole\Http\Request as SwooleRequest; use Tests\Unit\Utopia\Request\Filters\First; use Tests\Unit\Utopia\Request\Filters\Second; -use Utopia\Route; +use Utopia\Http\Route; class RequestTest extends TestCase { From 63a6714e31045a510d3e2b97af6269f385d7343a Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 10 Feb 2026 10:56:13 +0530 Subject: [PATCH 71/96] fix import --- composer.lock | 16 ++++++++-------- src/Appwrite/Utopia/View.php | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index bdc50402fb..2c64784437 100644 --- a/composer.lock +++ b/composer.lock @@ -4218,12 +4218,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "95ea85612d4db7cc30164aa54abb3befc4ba3ab8" + "reference": "6f9e28ebe7cccbb6e25479068ee1db34475d49a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/95ea85612d4db7cc30164aa54abb3befc4ba3ab8", - "reference": "95ea85612d4db7cc30164aa54abb3befc4ba3ab8", + "url": "https://api.github.com/repos/utopia-php/http/zipball/6f9e28ebe7cccbb6e25479068ee1db34475d49a5", + "reference": "6f9e28ebe7cccbb6e25479068ee1db34475d49a5", "shasum": "" }, "require": { @@ -4258,7 +4258,7 @@ "issues": "https://github.com/utopia-php/http/issues", "source": "https://github.com/utopia-php/http/tree/backport-0.34-adapters" }, - "time": "2026-02-09T12:47:49+00:00" + "time": "2026-02-10T05:19:30+00:00" }, { "name": "utopia-php/image", @@ -4634,12 +4634,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "45f9ecefeae3c755453e96cafd31b5d3da66b2e2" + "reference": "2868328278789617335aff435d2ddca0b2fc3465" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/45f9ecefeae3c755453e96cafd31b5d3da66b2e2", - "reference": "45f9ecefeae3c755453e96cafd31b5d3da66b2e2", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/2868328278789617335aff435d2ddca0b2fc3465", + "reference": "2868328278789617335aff435d2ddca0b2fc3465", "shasum": "" }, "require": { @@ -4678,7 +4678,7 @@ "issues": "https://github.com/utopia-php/platform/issues", "source": "https://github.com/utopia-php/platform/tree/bump-cli-and-framework" }, - "time": "2026-02-09T12:52:20+00:00" + "time": "2026-02-10T04:48:33+00:00" }, { "name": "utopia-php/pools", diff --git a/src/Appwrite/Utopia/View.php b/src/Appwrite/Utopia/View.php index e4ed8164c9..c5f66ae9ee 100644 --- a/src/Appwrite/Utopia/View.php +++ b/src/Appwrite/Utopia/View.php @@ -2,7 +2,7 @@ namespace Appwrite\Utopia; -use Utopia\View as OldView; +use Utopia\Http\View as OldView; class View extends OldView { From a80209ddbd809f084a2c1f63df641b4712884323 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 10 Feb 2026 11:45:10 +0530 Subject: [PATCH 72/96] fix cookie parsing --- composer.lock | 8 ++++---- src/Executor/Executor.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 2c64784437..0cd8b94a33 100644 --- a/composer.lock +++ b/composer.lock @@ -4218,12 +4218,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "6f9e28ebe7cccbb6e25479068ee1db34475d49a5" + "reference": "64bf7bb5f1be8f4982c3bd66775b300d0d9f3ded" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/6f9e28ebe7cccbb6e25479068ee1db34475d49a5", - "reference": "6f9e28ebe7cccbb6e25479068ee1db34475d49a5", + "url": "https://api.github.com/repos/utopia-php/http/zipball/64bf7bb5f1be8f4982c3bd66775b300d0d9f3ded", + "reference": "64bf7bb5f1be8f4982c3bd66775b300d0d9f3ded", "shasum": "" }, "require": { @@ -4258,7 +4258,7 @@ "issues": "https://github.com/utopia-php/http/issues", "source": "https://github.com/utopia-php/http/tree/backport-0.34-adapters" }, - "time": "2026-02-10T05:19:30+00:00" + "time": "2026-02-10T06:12:40+00:00" }, { "name": "utopia-php/image", diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index c891fb82e0..a8fab8fead 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -69,7 +69,7 @@ class Executor string $entrypoint = '', string $destination = '', array $variables = [], - string $command = null, + ?string $command = null, string $outputDirectory = '', string $runtimeEntrypoint = '' ) { @@ -294,7 +294,7 @@ class Executor * @return array|string * @throws Exception */ - private function call(string $endpoint, string $method, string $path = '', array $headers = [], array $params = [], bool $decode = true, int $timeout = 15, callable $callback = null) + private function call(string $endpoint, string $method, string $path = '', array $headers = [], array $params = [], bool $decode = true, int $timeout = 15, ?callable $callback = null) { $headers = array_merge($this->headers, $headers); $ch = curl_init($endpoint . $path . (($method == self::METHOD_GET && !empty($params)) ? '?' . http_build_query($params) : '')); From 0fd93f40975ff209c5843a99983a5be286b69c7e Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 10 Feb 2026 12:17:49 +0530 Subject: [PATCH 73/96] chore try fix console execute --- composer.json | 7 +++++++ composer.lock | 41 ++++++++++++++++++++++++++++++----------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 4367f155a6..971aed1458 100644 --- a/composer.json +++ b/composer.json @@ -76,6 +76,7 @@ "utopia-php/telemetry": "0.2.*", "utopia-php/vcs": "1.*", "utopia-php/websocket": "0.3.*", + "utopia-php/console": "dev-feature/console-stderr-capture as 0.0.1", "matomo/device-detector": "6.4.*", "dragonmantank/cron-expression": "3.4.*", "phpmailer/phpmailer": "6.9.*", @@ -86,6 +87,12 @@ "league/csv": "9.24.*", "enshrined/svg-sanitize": "0.22.*" }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/ChiragAgg5k/console" + } + ], "require-dev": { "ext-fileinfo": "*", "appwrite/sdk-generator": "*", diff --git a/composer.lock b/composer.lock index 0cd8b94a33..aaeb954520 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "45a20998a33d8e3d3c05dbf99e42d942", + "content-hash": "614777f35993c3bbe04bf71871c93029", "packages": [ { "name": "adhocore/jwt", @@ -3749,20 +3749,20 @@ }, { "name": "utopia-php/console", - "version": "0.0.1", + "version": "dev-feature/console-stderr-capture", "source": { "type": "git", - "url": "https://github.com/utopia-php/console.git", - "reference": "f77104e4a888fa9cb3e08f32955ec09479ab7a92" + "url": "https://github.com/ChiragAgg5k/console.git", + "reference": "b55d01a0398ec51777a113a85208e901c6dad612" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/console/zipball/f77104e4a888fa9cb3e08f32955ec09479ab7a92", - "reference": "f77104e4a888fa9cb3e08f32955ec09479ab7a92", + "url": "https://api.github.com/repos/ChiragAgg5k/console/zipball/b55d01a0398ec51777a113a85208e901c6dad612", + "reference": "b55d01a0398ec51777a113a85208e901c6dad612", "shasum": "" }, "require": { - "php": ">=7.4" + "php": ">=8.0" }, "require-dev": { "laravel/pint": "1.2.*", @@ -3777,7 +3777,20 @@ "Utopia\\": "src/" } }, - "notification-url": "https://packagist.org/downloads/", + "scripts": { + "test": [ + "vendor/bin/phpunit --configuration phpunit.xml < tests/input.txt" + ], + "check": [ + "vendor/bin/phpstan analyse -c phpstan.neon" + ], + "lint": [ + "vendor/bin/pint --test" + ], + "format": [ + "vendor/bin/pint" + ] + }, "license": [ "MIT" ], @@ -3790,10 +3803,9 @@ "utopia" ], "support": { - "issues": "https://github.com/utopia-php/console/issues", - "source": "https://github.com/utopia-php/console/tree/0.0.1" + "source": "https://github.com/ChiragAgg5k/console/tree/feature/console-stderr-capture" }, - "time": "2025-10-20T14:41:36+00:00" + "time": "2026-02-10T06:42:23+00:00" }, { "name": "utopia-php/database", @@ -8946,6 +8958,12 @@ } ], "aliases": [ + { + "package": "utopia-php/console", + "version": "dev-feature/console-stderr-capture", + "alias": "0.0.1", + "alias_normalized": "0.0.1.0" + }, { "package": "utopia-php/framework", "version": "dev-backport-0.34-adapters", @@ -8961,6 +8979,7 @@ ], "minimum-stability": "stable", "stability-flags": { + "utopia-php/console": 20, "utopia-php/framework": 20, "utopia-php/platform": 20 }, From 73b19b9028419e7061068bde072db2a18da60124 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 10 Feb 2026 12:19:41 +0530 Subject: [PATCH 74/96] ordering --- app/cli.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/cli.php b/app/cli.php index f4ed318b43..14ebea6e1c 100644 --- a/app/cli.php +++ b/app/cli.php @@ -49,12 +49,12 @@ global $register; $platform = new Appwrite(); $args = $platform->getEnv('argv'); +\array_shift($args); if (!isset($args[0])) { Console::error('Missing task name'); Console::exit(1); } -\array_shift($args); $taskName = $args[0]; $platform->init(Service::TYPE_TASK); $cli = $platform->getCli(); From 99d8eefdcf7388d2460ac3c8e908182e0e2d6341 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 10 Feb 2026 12:41:59 +0530 Subject: [PATCH 75/96] fix class issue --- app/controllers/general.php | 2 +- src/Appwrite/GraphQL/Resolvers.php | 2 +- src/Appwrite/GraphQL/Schema.php | 2 +- .../Modules/Databases/Http/Databases/Transactions/Update.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index b77ec0c8c4..cdf8586537 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1255,7 +1255,7 @@ Http::error() } switch ($class) { - case Utopia\Exception::class: + case Utopia\Http\Exception::class: $error = new AppwriteException(AppwriteException::GENERAL_UNKNOWN, $message, $code, $error); switch ($code) { case 400: diff --git a/src/Appwrite/GraphQL/Resolvers.php b/src/Appwrite/GraphQL/Resolvers.php index 4621eb3689..484cafb0ab 100644 --- a/src/Appwrite/GraphQL/Resolvers.php +++ b/src/Appwrite/GraphQL/Resolvers.php @@ -6,7 +6,7 @@ use Appwrite\GraphQL\Exception as GQLException; use Appwrite\Promises\Swoole; use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; -use Utopia\Exception; +use Utopia\Http\Exception; use Utopia\Http\Http; use Utopia\Http\Route; use Utopia\System\System; diff --git a/src/Appwrite/GraphQL/Schema.php b/src/Appwrite/GraphQL/Schema.php index fa93d48a40..57115ff027 100644 --- a/src/Appwrite/GraphQL/Schema.php +++ b/src/Appwrite/GraphQL/Schema.php @@ -6,7 +6,7 @@ use Appwrite\GraphQL\Types\Mapper; use GraphQL\Type\Definition\ObjectType; use GraphQL\Type\Definition\Type; use GraphQL\Type\Schema as GQLSchema; -use Utopia\Exception; +use Utopia\Http\Exception; use Utopia\Http\Http; use Utopia\Http\Route; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php index 6ead7e4055..c685eb9f40 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php @@ -104,7 +104,7 @@ class Update extends Action * @throws \Utopia\Database\Exception * @throws Authorization * @throws Structure - * @throws \Utopia\Exception + * @throws \Utopia\Http\Exception */ public function action(string $transactionId, bool $commit, bool $rollback, UtopiaResponse $response, Database $dbForProject, Document $user, TransactionState $transactionState, Delete $queueForDeletes, Event $queueForEvents, StatsUsage $queueForStatsUsage, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, Authorization $authorization, EventProcessor $eventProcessor): void { From 0621a32aa685b6bf9bdd02619022513cb8f3fd73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 10 Feb 2026 11:43:22 +0100 Subject: [PATCH 76/96] Fix tests; speed up tests; fix 5xx error --- app/config/errors.php | 5 ++ app/controllers/api/projects.php | 9 +- src/Appwrite/Extend/Exception.php | 1 + .../Projects/ProjectsConsoleClientTest.php | 90 +++++++++---------- 4 files changed, 58 insertions(+), 47 deletions(-) diff --git a/app/config/errors.php b/app/config/errors.php index 62affd8101..16fad57de1 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -1139,6 +1139,11 @@ return [ 'description' => 'Key with the requested ID could not be found.', 'code' => 404, ], + Exception::KEY_ALREADY_EXISTS => [ + 'name' => Exception::KEY_ALREADY_EXISTS, + 'description' => 'Key with the same ID already exists. Try again with a different ID.', + 'code' => 409, + ], Exception::PLATFORM_NOT_FOUND => [ 'name' => Exception::PLATFORM_NOT_FOUND, 'description' => 'Platform with the requested ID could not be found.', diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 95997fd7dc..33dda5d9b9 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -14,13 +14,14 @@ use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Template\Template; -use Appwrite\Utopia\Database\Validator\Queries\Keys; use Appwrite\Utopia\Database\Validator\CustomId; +use Appwrite\Utopia\Database\Validator\Queries\Keys; use Appwrite\Utopia\Response; use PHPMailer\PHPMailer\PHPMailer; use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Exception\Duplicate; use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; @@ -1132,7 +1133,11 @@ Http::post('/v1/projects/:projectId/keys') 'secret' => API_KEY_STANDARD . '_' . \bin2hex(\random_bytes(128)), ]); - $key = $dbForPlatform->createDocument('keys', $key); + try { + $key = $dbForPlatform->createDocument('keys', $key); + } catch (Duplicate) { + throw new Exception(Exception::KEY_ALREADY_EXISTS); + } $dbForPlatform->purgeCachedDocument('projects', $project->getId()); diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 2bc7021b31..d02f3902a3 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -318,6 +318,7 @@ class Exception extends \Exception /** Keys */ public const string KEY_NOT_FOUND = 'key_not_found'; + public const string KEY_ALREADY_EXISTS = 'key_already_exists'; /** Variables */ public const string VARIABLE_NOT_FOUND = 'variable_not_found'; diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index fce5c5b91c..2266c2fe72 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -1168,7 +1168,7 @@ class ProjectsConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'duration' => 60, // Set session duration to 1 minute + 'duration' => 10, // Set session duration to 10 seconds ]); $this->assertEquals(200, $response['headers']['status-code']); @@ -1177,7 +1177,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertArrayHasKey('platforms', $response['body']); $this->assertArrayHasKey('webhooks', $response['body']); $this->assertArrayHasKey('keys', $response['body']); - $this->assertEquals(60, $response['body']['authDuration']); + $this->assertEquals(10, $response['body']['authDuration']); $projectId = $response['body']['$id']; @@ -1218,44 +1218,30 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); - // Check session doesn't expire too soon. - sleep(30); + // Eventually session expires, within 15 seconds (10+variance) + $this->assertEventually(function () use ($projectId, $sessionCookie) { + // Get User + $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'Cookie' => $sessionCookie, + ])); - // Get User - $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'Cookie' => $sessionCookie, - ])); + $this->assertEquals(401, $response['headers']['status-code']); + }, timeoutMs: 15 * 1000); - $this->assertEquals(200, $response['headers']['status-code']); - - // Wait just over a minute - sleep(35); - - // Get User - $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'Cookie' => $sessionCookie, - ])); - - $this->assertEquals(401, $response['headers']['status-code']); - - // Set session duration to 15s + // Set session duration to 10min $response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/auth/duration', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'duration' => 15, // seconds + 'duration' => 600, // seconds ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(15, $response['body']['authDuration']); - - // Wait 20 seconds, ensure non-valid session - \sleep(20); + $this->assertEquals(600, $response['body']['authDuration']); + // Ensure.. Something? $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, @@ -3157,7 +3143,7 @@ class ProjectsConsoleClientTest extends Scope /** * Test for SUCCESS with custom ID */ - $customKeyId = 'key-with-custom-id'; + $customKeyId = \uniqid() . 'custom-id'; $response = $this->client->call(Client::METHOD_POST, '/projects/' . $id . '/keys', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -3170,6 +3156,20 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(201, $response['headers']['status-code']); $this->assertSame($customKeyId, $response['body']['$id']); + /** + * Test for FAILURE with custom ID + */ + $response = $this->client->call(Client::METHOD_POST, '/projects/' . $id . '/keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'keyId' => $customKeyId, + 'name' => 'Key Custom', + 'scopes' => ['teams.read', 'teams.write'], + ]); + + $this->assertEquals(409, $response['headers']['status-code']); + /** * Test for SUCCESS with magic string ID */ @@ -3237,8 +3237,8 @@ class ProjectsConsoleClientTest extends Scope ], $this->getHeaders()), []); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(2, $response['body']['total']); - $this->assertCount(2, $response['body']['keys']); + $this->assertEquals(5, $response['body']['total']); + $this->assertCount(5, $response['body']['keys']); /** List keys with limit */ $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ @@ -3252,7 +3252,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertCount(1, $response['body']['keys']); - $this->assertEquals(2, $response['body']['total']); + $this->assertEquals(5, $response['body']['total']); /** List keys with offset */ $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ @@ -3265,8 +3265,8 @@ class ProjectsConsoleClientTest extends Scope ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertCount(1, $response['body']['keys']); - $this->assertEquals(2, $response['body']['total']); + $this->assertCount(4, $response['body']['keys']); + $this->assertEquals(5, $response['body']['total']); /** List keys with cursor after */ $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ @@ -3280,6 +3280,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertCount(1, $response['body']['keys']); + $this->assertEquals(5, $response['body']['total']); $this->assertEquals($key2Id, $response['body']['keys'][0]['$id']); /** List keys filtering by expire (lessThan now — should match none) */ @@ -3308,7 +3309,6 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(1, $response['body']['total']); $this->assertCount(1, $response['body']['keys']); - $this->assertEquals('Key Test 2', $response['body']['keys'][0]['name']); /** List keys filtering by name (equal — exact match) */ $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ @@ -3364,9 +3364,8 @@ class ProjectsConsoleClientTest extends Scope ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(1, $response['body']['total']); - $this->assertCount(1, $response['body']['keys']); - $this->assertEquals('Key Test', $response['body']['keys'][0]['name']); + $this->assertEquals(4, $response['body']['total']); + $this->assertCount(4, $response['body']['keys']); /** List keys filtering by scopes (contains — match key with users.read) */ $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ @@ -3381,7 +3380,6 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(1, $response['body']['total']); $this->assertCount(1, $response['body']['keys']); - $this->assertEquals('Key Test 2', $response['body']['keys'][0]['name']); /** List keys filtering by scopes (contains — no match) */ $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ @@ -3424,9 +3422,8 @@ class ProjectsConsoleClientTest extends Scope ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertCount(2, $response['body']['keys']); - $this->assertEquals('Key Test 2', $response['body']['keys'][0]['name']); - $this->assertEquals('Key Test', $response['body']['keys'][1]['name']); + $this->assertCount(5, $response['body']['keys']); + $this->assertGreaterThan($response['body']['keys'][1]['$createdAt'], $response['body']['keys'][0]['$createdAt']); /** List keys with total disabled */ $response = $this->client->call(Client::METHOD_GET, '/projects/' . $id . '/keys', array_merge([ @@ -3434,10 +3431,13 @@ class ProjectsConsoleClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ 'total' => false, + 'queries' => [ + Query::limit(1)->toString() + ] ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertCount(2, $response['body']['keys']); + $this->assertCount(1, $response['body']['keys']); $this->assertEquals(0, $response['body']['total']); /** From e2071bd5dd68c3782f852eadde994ef9bad7b4cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 10 Feb 2026 11:48:29 +0100 Subject: [PATCH 77/96] add backwards compatibility --- app/controllers/api/projects.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 33dda5d9b9..2cc3510f6f 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -1182,6 +1182,11 @@ Http::get('/v1/projects/:projectId/keys') throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } + // Backwards compatibility + if (\count(Query::getByType($queries, [Query::TYPE_LIMIT])) === 0) { + $queries[] = Query::limit(5000); + } + $queries[] = Query::equal('resourceType', ['projects']); $queries[] = Query::equal('resourceInternalId', [$project->getSequence()]); From d74704e10b8f6fd615723db6a99c27b89d3d5aee Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 10 Feb 2026 16:26:26 +0530 Subject: [PATCH 78/96] composer --- composer.lock | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/composer.lock b/composer.lock index aaeb954520..4432b7db75 100644 --- a/composer.lock +++ b/composer.lock @@ -1355,16 +1355,16 @@ }, { "name": "open-telemetry/exporter-otlp", - "version": "1.3.4", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/exporter-otlp.git", - "reference": "62e680d587beb42e5247aa6ecd89ad1ca406e8ca" + "reference": "283a0d66522f2adc6d8d7debfd7686be91c282be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/62e680d587beb42e5247aa6ecd89ad1ca406e8ca", - "reference": "62e680d587beb42e5247aa6ecd89ad1ca406e8ca", + "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/283a0d66522f2adc6d8d7debfd7686be91c282be", + "reference": "283a0d66522f2adc6d8d7debfd7686be91c282be", "shasum": "" }, "require": { @@ -1415,7 +1415,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2026-01-15T09:31:34+00:00" + "time": "2026-02-05T09:44:52+00:00" }, { "name": "open-telemetry/gen-otlp-protobuf", @@ -1482,16 +1482,16 @@ }, { "name": "open-telemetry/sdk", - "version": "1.12.0", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "7f1bd524465c1ca42755a9ef1143ba09913f5be0" + "reference": "c76f91203bf7ef98ab3f4e0a82ca21699af185e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/7f1bd524465c1ca42755a9ef1143ba09913f5be0", - "reference": "7f1bd524465c1ca42755a9ef1143ba09913f5be0", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/c76f91203bf7ef98ab3f4e0a82ca21699af185e1", + "reference": "c76f91203bf7ef98ab3f4e0a82ca21699af185e1", "shasum": "" }, "require": { @@ -1575,7 +1575,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2026-01-21T04:14:03+00:00" + "time": "2026-01-28T11:38:11+00:00" }, { "name": "open-telemetry/sem-conv", @@ -4230,12 +4230,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "64bf7bb5f1be8f4982c3bd66775b300d0d9f3ded" + "reference": "8e12530227365042c608f6e65536eb2fcf1f6970" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/64bf7bb5f1be8f4982c3bd66775b300d0d9f3ded", - "reference": "64bf7bb5f1be8f4982c3bd66775b300d0d9f3ded", + "url": "https://api.github.com/repos/utopia-php/http/zipball/8e12530227365042c608f6e65536eb2fcf1f6970", + "reference": "8e12530227365042c608f6e65536eb2fcf1f6970", "shasum": "" }, "require": { @@ -4248,7 +4248,8 @@ "laravel/pint": "1.*", "phpbench/phpbench": "1.*", "phpstan/phpstan": "1.*", - "phpunit/phpunit": "9.*" + "phpunit/phpunit": "9.*", + "swoole/ide-helper": "^6.0" }, "type": "library", "autoload": { @@ -4270,7 +4271,7 @@ "issues": "https://github.com/utopia-php/http/issues", "source": "https://github.com/utopia-php/http/tree/backport-0.34-adapters" }, - "time": "2026-02-10T06:12:40+00:00" + "time": "2026-02-10T10:54:07+00:00" }, { "name": "utopia-php/image", @@ -5453,16 +5454,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "1.8.26", + "version": "1.8.27", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "ce65854069a1af8ef0757650da5848168cca5f02" + "reference": "9c6927336a163954c0ed6d8208af8d5b83761762" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/ce65854069a1af8ef0757650da5848168cca5f02", - "reference": "ce65854069a1af8ef0757650da5848168cca5f02", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/9c6927336a163954c0ed6d8208af8d5b83761762", + "reference": "9c6927336a163954c0ed6d8208af8d5b83761762", "shasum": "" }, "require": { @@ -5498,9 +5499,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/1.8.26" + "source": "https://github.com/appwrite/sdk-generator/tree/1.8.27" }, - "time": "2026-02-08T07:41:27+00:00" + "time": "2026-02-10T06:10:29+00:00" }, { "name": "doctrine/annotations", From 4df093402337857de2a963ec5565c57b5a26f01a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 10 Feb 2026 12:01:38 +0100 Subject: [PATCH 79/96] Comment fix --- tests/e2e/Services/Projects/ProjectsConsoleClientTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 2266c2fe72..7a9557bdae 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -1241,7 +1241,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(600, $response['body']['authDuration']); - // Ensure.. Something? + // Ensure session is still expired (new duration only affects new sessions) $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, From 7c5fc442f1eed7fa777be266f66af49fd83a9a40 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 10 Feb 2026 17:38:52 +0530 Subject: [PATCH 80/96] retry --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index 4432b7db75..23bcce75a6 100644 --- a/composer.lock +++ b/composer.lock @@ -4230,12 +4230,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "8e12530227365042c608f6e65536eb2fcf1f6970" + "reference": "f6572e3b7e02c5da459520b85b82e7137e005127" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/8e12530227365042c608f6e65536eb2fcf1f6970", - "reference": "8e12530227365042c608f6e65536eb2fcf1f6970", + "url": "https://api.github.com/repos/utopia-php/http/zipball/f6572e3b7e02c5da459520b85b82e7137e005127", + "reference": "f6572e3b7e02c5da459520b85b82e7137e005127", "shasum": "" }, "require": { @@ -4271,7 +4271,7 @@ "issues": "https://github.com/utopia-php/http/issues", "source": "https://github.com/utopia-php/http/tree/backport-0.34-adapters" }, - "time": "2026-02-10T10:54:07+00:00" + "time": "2026-02-10T12:08:18+00:00" }, { "name": "utopia-php/image", From 1822ede19eb53ecfb1fe0d76104384427546a834 Mon Sep 17 00:00:00 2001 From: Hemachandar <132386067+hmacr@users.noreply.github.com> Date: Tue, 10 Feb 2026 21:21:48 +0530 Subject: [PATCH 81/96] Fix GitHub error file path (#11289) * Fix error file path in GitHub APIs * const --- app/init/constants.php | 2 ++ src/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/Get.php | 2 +- src/Appwrite/Platform/Modules/VCS/Http/GitHub/Callback/Get.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/init/constants.php b/app/init/constants.php index 0ee5271d7f..f084359068 100644 --- a/app/init/constants.php +++ b/app/init/constants.php @@ -5,6 +5,8 @@ use Appwrite\Platform\Modules\Compute\Specification; const APP_NAME = 'Appwrite'; const APP_DOMAIN = 'appwrite.io'; +const APP_VIEWS_DIR = __DIR__ . '/../views'; + // Email const APP_EMAIL_TEAM = 'team@localhost.test'; // Default email address const APP_EMAIL_SECURITY = ''; // Default security email address diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/Get.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/Get.php index 5db6cb6e43..6188c14b5d 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/Get.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/Get.php @@ -31,7 +31,7 @@ class Get extends Action ->desc('Create GitHub app installation') ->groups(['api', 'vcs']) ->label('scope', 'vcs.read') - ->label('error', __DIR__ . '/../../views/general/error.phtml') + ->label('error', APP_VIEWS_DIR . '/general/error.phtml') ->label('sdk', new Method( namespace: 'vcs', group: 'installations', diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Callback/Get.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Callback/Get.php index 535f26e0cd..1212c06a72 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Callback/Get.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Callback/Get.php @@ -35,7 +35,7 @@ class Get extends Action ->desc('Get installation and authorization from GitHub app') ->groups(['api', 'vcs']) ->label('scope', 'public') - ->label('error', __DIR__ . '/../../views/general/error.phtml') + ->label('error', APP_VIEWS_DIR . '/general/error.phtml') ->param('installation_id', '', new Text(256, 0), 'GitHub installation ID', true) ->param('setup_action', '', new Text(256, 0), 'GitHub setup action type', true) ->param('state', '', new Text(2048), 'GitHub state. Contains info sent when starting authorization flow.', true) From 161b971f536ea4191596fa9ad38a0839f32e51ed Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 11 Feb 2026 10:11:04 +0530 Subject: [PATCH 82/96] Fix oauth redirect custom scheme state --- app/controllers/api/account.php | 30 +++++++----- .../Projects/ProjectsConsoleClientTest.php | 49 +++++++++++++++++++ 2 files changed, 66 insertions(+), 13 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 17515fe949..69fa23fe50 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1514,21 +1514,25 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') } // Allow redirect to rule URL if related to project - //Check if $redirectValidator is instance of Redirect class + // Check if $redirectValidator is instance of Redirect class if ($redirectValidator instanceof Redirect) { - $rules = $authorization->skip(fn () => $dbForPlatform->find('rules', [ - Query::equal('domain', [ - parse_url($state['success'], PHP_URL_HOST), - parse_url($state['failure'], PHP_URL_HOST) - ]), - Query::equal('projectInternalId', [$project->getSequence()]), - Query::limit(2) - ])); + $domains = \array_filter([ + parse_url($state['success'], PHP_URL_HOST) ?? '', + parse_url($state['failure'], PHP_URL_HOST) ?? '' + ], fn ($domain) => \is_string($domain) && $domain !== ''); - foreach ($rules as $rule) { - $allowedHostnames = $redirectValidator->getAllowedHostnames(); - $allowedHostnames[] = $rule->getAttribute('domain', ''); - $redirectValidator->setAllowedHostnames($allowedHostnames); + if (!empty($domains)) { + $rules = $authorization->skip(fn () => $dbForPlatform->find('rules', [ + Query::equal('domain', \array_values(\array_unique($domains))), + Query::equal('projectInternalId', [$project->getSequence()]), + Query::limit(2) + ])); + + foreach ($rules as $rule) { + $allowedHostnames = $redirectValidator->getAllowedHostnames(); + $allowedHostnames[] = $rule->getAttribute('domain', ''); + $redirectValidator->setAllowedHostnames($allowedHostnames); + } } } diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 7a9557bdae..1d15f10971 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -5561,6 +5561,55 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(201, $response['headers']['status-code']); } + public function testOAuthRedirectWithCustomSchemeState(): void + { + // Prepare project + $projectId = $this->setupProject([ + 'projectId' => ID::unique(), + 'name' => 'testOAuthRedirectWithCustomSchemeState', + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + $provider = 'mock'; + $appId = '1'; + $secret = '123456'; + + // Prepare OAuth provider + $response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $projectId . '/oauth2', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'provider' => $provider, + 'appId' => $appId, + 'secret' => $secret, + 'enabled' => true, + ]); + $this->assertEquals(200, $response['headers']['status-code']); + + $scheme = 'appwrite-callback-' . $projectId; + $state = \json_encode([ + 'success' => $scheme . ':///', + 'failure' => $scheme . ':///' + ]); + + $response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider . '/redirect', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'origin' => '', + 'referer' => '', + ], [ + 'code' => 'any-code', + 'state' => $state, + 'error' => 'access_denied', + 'error_description' => 'test', + ], followRedirects: false); + + $this->assertEquals(301, $response['headers']['status-code']); + $this->assertStringStartsWith($scheme . '://', $response['headers']['location']); + $this->assertStringContainsString('error=', $response['headers']['location']); + } + /** * @group abuseEnabled */ From fed9af75681d485c7247e6fd32c61fa25d2952c6 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 11 Feb 2026 12:03:12 +0530 Subject: [PATCH 83/96] remove console dev branch --- composer.json | 8 +--- composer.lock | 111 ++++++++++++++++++++------------------------------ 2 files changed, 46 insertions(+), 73 deletions(-) diff --git a/composer.json b/composer.json index 971aed1458..881109ee60 100644 --- a/composer.json +++ b/composer.json @@ -76,7 +76,7 @@ "utopia-php/telemetry": "0.2.*", "utopia-php/vcs": "1.*", "utopia-php/websocket": "0.3.*", - "utopia-php/console": "dev-feature/console-stderr-capture as 0.0.1", + "utopia-php/console": "0.1.*", "matomo/device-detector": "6.4.*", "dragonmantank/cron-expression": "3.4.*", "phpmailer/phpmailer": "6.9.*", @@ -87,12 +87,6 @@ "league/csv": "9.24.*", "enshrined/svg-sanitize": "0.22.*" }, - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/ChiragAgg5k/console" - } - ], "require-dev": { "ext-fileinfo": "*", "appwrite/sdk-generator": "*", diff --git a/composer.lock b/composer.lock index 23bcce75a6..94c0a6b448 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "614777f35993c3bbe04bf71871c93029", + "content-hash": "909bf7bde6669e0eea5ff56178023246", "packages": [ { "name": "adhocore/jwt", @@ -216,16 +216,16 @@ }, { "name": "brick/math", - "version": "0.14.7", + "version": "0.14.8", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "07ff363b16ef8aca9692bba3be9e73fe63f34e50" + "reference": "63422359a44b7f06cae63c3b429b59e8efcc0629" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/07ff363b16ef8aca9692bba3be9e73fe63f34e50", - "reference": "07ff363b16ef8aca9692bba3be9e73fe63f34e50", + "url": "https://api.github.com/repos/brick/math/zipball/63422359a44b7f06cae63c3b429b59e8efcc0629", + "reference": "63422359a44b7f06cae63c3b429b59e8efcc0629", "shasum": "" }, "require": { @@ -264,7 +264,7 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.14.7" + "source": "https://github.com/brick/math/tree/0.14.8" }, "funding": [ { @@ -272,7 +272,7 @@ "type": "github" } ], - "time": "2026-02-07T10:57:35+00:00" + "time": "2026-02-10T14:33:43+00:00" }, { "name": "chillerlan/php-qrcode", @@ -3749,16 +3749,16 @@ }, { "name": "utopia-php/console", - "version": "dev-feature/console-stderr-capture", + "version": "0.1.1", "source": { "type": "git", - "url": "https://github.com/ChiragAgg5k/console.git", - "reference": "b55d01a0398ec51777a113a85208e901c6dad612" + "url": "https://github.com/utopia-php/console.git", + "reference": "d298e43960780e6d76e66de1228c75dc81220e3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ChiragAgg5k/console/zipball/b55d01a0398ec51777a113a85208e901c6dad612", - "reference": "b55d01a0398ec51777a113a85208e901c6dad612", + "url": "https://api.github.com/repos/utopia-php/console/zipball/d298e43960780e6d76e66de1228c75dc81220e3e", + "reference": "d298e43960780e6d76e66de1228c75dc81220e3e", "shasum": "" }, "require": { @@ -3777,20 +3777,7 @@ "Utopia\\": "src/" } }, - "scripts": { - "test": [ - "vendor/bin/phpunit --configuration phpunit.xml < tests/input.txt" - ], - "check": [ - "vendor/bin/phpstan analyse -c phpstan.neon" - ], - "lint": [ - "vendor/bin/pint --test" - ], - "format": [ - "vendor/bin/pint" - ] - }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -3803,9 +3790,10 @@ "utopia" ], "support": { - "source": "https://github.com/ChiragAgg5k/console/tree/feature/console-stderr-capture" + "issues": "https://github.com/utopia-php/console/issues", + "source": "https://github.com/utopia-php/console/tree/0.1.1" }, - "time": "2026-02-10T06:42:23+00:00" + "time": "2026-02-10T10:20:29+00:00" }, { "name": "utopia-php/database", @@ -4476,16 +4464,16 @@ }, { "name": "utopia-php/migration", - "version": "1.5.1", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "b5fe19804b41d5bdd85571e7cdb83a268b6859e2" + "reference": "93904948f6dd07491821615fd9b9acbcaadec12e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/b5fe19804b41d5bdd85571e7cdb83a268b6859e2", - "reference": "b5fe19804b41d5bdd85571e7cdb83a268b6859e2", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/93904948f6dd07491821615fd9b9acbcaadec12e", + "reference": "93904948f6dd07491821615fd9b9acbcaadec12e", "shasum": "" }, "require": { @@ -4494,7 +4482,6 @@ "ext-openssl": "*", "halaxa/json-machine": "^1.2", "php": ">=8.1", - "utopia-php/console": "0.0.*", "utopia-php/database": "5.*", "utopia-php/dsn": "0.2.*", "utopia-php/storage": "0.18.*" @@ -4526,9 +4513,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/1.5.1" + "source": "https://github.com/utopia-php/migration/tree/1.5.2" }, - "time": "2026-02-05T11:32:03+00:00" + "time": "2026-02-11T06:19:35+00:00" }, { "name": "utopia-php/mongo", @@ -4593,21 +4580,21 @@ }, { "name": "utopia-php/orchestration", - "version": "0.19.0", + "version": "0.19.1", "source": { "type": "git", "url": "https://github.com/utopia-php/orchestration.git", - "reference": "e8d8d045a8c4997bf4c9f830e9161423f005143a" + "reference": "5a1168d3c3c1af9de76289b380b60717722b36db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/orchestration/zipball/e8d8d045a8c4997bf4c9f830e9161423f005143a", - "reference": "e8d8d045a8c4997bf4c9f830e9161423f005143a", + "url": "https://api.github.com/repos/utopia-php/orchestration/zipball/5a1168d3c3c1af9de76289b380b60717722b36db", + "reference": "5a1168d3c3c1af9de76289b380b60717722b36db", "shasum": "" }, "require": { "php": ">=8.0", - "utopia-php/console": "0.0.*" + "utopia-php/console": "0.1.*" }, "require-dev": { "laravel/pint": "^1.2", @@ -4637,9 +4624,9 @@ ], "support": { "issues": "https://github.com/utopia-php/orchestration/issues", - "source": "https://github.com/utopia-php/orchestration/tree/0.19.0" + "source": "https://github.com/utopia-php/orchestration/tree/0.19.1" }, - "time": "2025-10-21T08:54:03+00:00" + "time": "2026-02-10T12:44:30+00:00" }, { "name": "utopia-php/platform", @@ -4801,22 +4788,21 @@ }, { "name": "utopia-php/queue", - "version": "0.15.4", + "version": "0.15.5", "source": { "type": "git", "url": "https://github.com/utopia-php/queue.git", - "reference": "2d693ec59119f853602f4be271602fddefbab507" + "reference": "aa80ffe6350efd3394615c3763dba138223a225a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/queue/zipball/2d693ec59119f853602f4be271602fddefbab507", - "reference": "2d693ec59119f853602f4be271602fddefbab507", + "url": "https://api.github.com/repos/utopia-php/queue/zipball/aa80ffe6350efd3394615c3763dba138223a225a", + "reference": "aa80ffe6350efd3394615c3763dba138223a225a", "shasum": "" }, "require": { "php": ">=8.3", "php-amqplib/php-amqplib": "^3.7", - "utopia-php/console": "0.0.*", "utopia-php/fetch": "0.5.*", "utopia-php/pools": "1.*", "utopia-php/servers": "0.2.*", @@ -4862,9 +4848,9 @@ ], "support": { "issues": "https://github.com/utopia-php/queue/issues", - "source": "https://github.com/utopia-php/queue/tree/0.15.4" + "source": "https://github.com/utopia-php/queue/tree/0.15.5" }, - "time": "2026-02-04T08:50:35+00:00" + "time": "2026-02-10T12:30:46+00:00" }, { "name": "utopia-php/registry", @@ -5728,16 +5714,16 @@ }, { "name": "laravel/pint", - "version": "v1.27.0", + "version": "v1.27.1", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "c67b4195b75491e4dfc6b00b1c78b68d86f54c90" + "reference": "54cca2de13790570c7b6f0f94f37896bee4abcb5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/c67b4195b75491e4dfc6b00b1c78b68d86f54c90", - "reference": "c67b4195b75491e4dfc6b00b1c78b68d86f54c90", + "url": "https://api.github.com/repos/laravel/pint/zipball/54cca2de13790570c7b6f0f94f37896bee4abcb5", + "reference": "54cca2de13790570c7b6f0f94f37896bee4abcb5", "shasum": "" }, "require": { @@ -5748,13 +5734,13 @@ "php": "^8.2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.92.4", - "illuminate/view": "^12.44.0", - "larastan/larastan": "^3.8.1", - "laravel-zero/framework": "^12.0.4", + "friendsofphp/php-cs-fixer": "^3.93.1", + "illuminate/view": "^12.51.0", + "larastan/larastan": "^3.9.2", + "laravel-zero/framework": "^12.0.5", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^2.3.3", - "pestphp/pest": "^3.8.4" + "pestphp/pest": "^3.8.5" }, "bin": [ "builds/pint" @@ -5791,7 +5777,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2026-01-05T16:49:17+00:00" + "time": "2026-02-10T20:00:20+00:00" }, { "name": "matthiasmullie/minify", @@ -8959,12 +8945,6 @@ } ], "aliases": [ - { - "package": "utopia-php/console", - "version": "dev-feature/console-stderr-capture", - "alias": "0.0.1", - "alias_normalized": "0.0.1.0" - }, { "package": "utopia-php/framework", "version": "dev-backport-0.34-adapters", @@ -8980,7 +8960,6 @@ ], "minimum-stability": "stable", "stability-flags": { - "utopia-php/console": 20, "utopia-php/framework": 20, "utopia-php/platform": 20 }, From b08e0ad8ac111114099ebd801e2679d8cf04c30e Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 11 Feb 2026 19:34:38 +1300 Subject: [PATCH 84/96] Update app/config/variables.php --- app/config/variables.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/variables.php b/app/config/variables.php index 9a27ffca18..0303cd7977 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -360,7 +360,7 @@ return [ ], [ 'name' => '_APP_DB_ADAPTER', - 'description' => 'To switch between mariadb and postgresql', + 'description' => 'Which database adapter to use. Must be one of: mariadb, postgresql.', 'introduction' => '1.6.0', 'default' => 'mariadb', 'required' => true, From 1dec34cc2d7537a9a460f5b3d888354d025dfaa5 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 11 Feb 2026 19:34:49 +1300 Subject: [PATCH 85/96] Update docker-compose.yml --- docker-compose.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4d497eba6d..50761677a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -660,13 +660,8 @@ services: - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: - mariadb: - condition: service_started - postgresql: - condition: service_started - redis: - condition: service_started - openruntimes-executor: + - ${_APP_DB_HOST:-mariadb} + - redis condition: service_healthy environment: - _APP_ENV From 00fdf76d71a64c35766e5b676ea769efa2ccf6de Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 11 Feb 2026 19:34:59 +1300 Subject: [PATCH 86/96] Update docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 50761677a1..54f7d7bc90 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1196,7 +1196,7 @@ services: command: "mysqld --innodb-flush-method=fsync" postgresql: - image: postgres:15 + image: postgres:18 container_name: appwrite-postgresql <<: *x-logging networks: From 33cb992934e2f59b3d57d64ac654b04f703e0cc1 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 11 Feb 2026 12:07:36 +0530 Subject: [PATCH 87/96] bump all to stable --- composer.json | 4 ++-- composer.lock | 49 ++++++++++++++++--------------------------------- 2 files changed, 18 insertions(+), 35 deletions(-) diff --git a/composer.json b/composer.json index 881109ee60..03a1d37598 100644 --- a/composer.json +++ b/composer.json @@ -58,7 +58,7 @@ "utopia-php/emails": "0.6.*", "utopia-php/dns": "1.5.*", "utopia-php/dsn": "0.2.1", - "utopia-php/framework": "dev-backport-0.34-adapters as 0.33.38", + "utopia-php/framework": "0.33.*", "utopia-php/fetch": "0.5.*", "utopia-php/image": "0.8.*", "utopia-php/locale": "0.8.*", @@ -66,7 +66,7 @@ "utopia-php/messaging": "0.20.*", "utopia-php/migration": "1.5.*", "utopia-php/orchestration": "0.19.*", - "utopia-php/platform": "dev-bump-cli-and-framework as 0.7.15", + "utopia-php/platform": "0.7.*", "utopia-php/pools": "1.*", "utopia-php/preloader": "0.2.*", "utopia-php/queue": "0.15.*", diff --git a/composer.lock b/composer.lock index 94c0a6b448..9d3e063ae2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "909bf7bde6669e0eea5ff56178023246", + "content-hash": "06d83bf3bbd4729377e2be95738a2efb", "packages": [ { "name": "adhocore/jwt", @@ -4214,16 +4214,16 @@ }, { "name": "utopia-php/framework", - "version": "dev-backport-0.34-adapters", + "version": "0.33.39", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "f6572e3b7e02c5da459520b85b82e7137e005127" + "reference": "409a258814d664d3a50fa2f48b6695679334d30b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/f6572e3b7e02c5da459520b85b82e7137e005127", - "reference": "f6572e3b7e02c5da459520b85b82e7137e005127", + "url": "https://api.github.com/repos/utopia-php/http/zipball/409a258814d664d3a50fa2f48b6695679334d30b", + "reference": "409a258814d664d3a50fa2f48b6695679334d30b", "shasum": "" }, "require": { @@ -4257,9 +4257,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/backport-0.34-adapters" + "source": "https://github.com/utopia-php/http/tree/0.33.39" }, - "time": "2026-02-10T12:08:18+00:00" + "time": "2026-02-11T06:33:42+00:00" }, { "name": "utopia-php/image", @@ -4630,16 +4630,16 @@ }, { "name": "utopia-php/platform", - "version": "dev-bump-cli-and-framework", + "version": "0.7.16", "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "2868328278789617335aff435d2ddca0b2fc3465" + "reference": "34e67e4b80b5741c380071fe765fbc12a132de4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/2868328278789617335aff435d2ddca0b2fc3465", - "reference": "2868328278789617335aff435d2ddca0b2fc3465", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/34e67e4b80b5741c380071fe765fbc12a132de4f", + "reference": "34e67e4b80b5741c380071fe765fbc12a132de4f", "shasum": "" }, "require": { @@ -4647,7 +4647,7 @@ "ext-redis": "*", "php": ">=8.0", "utopia-php/cli": "0.22.*", - "utopia-php/framework": "dev-backport-0.34-adapters as 0.33.38", + "utopia-php/framework": "0.33.*", "utopia-php/queue": "0.15.*" }, "require-dev": { @@ -4658,7 +4658,6 @@ "type": "library", "autoload": { "psr-4": { - "Utopia\\": "src", "Utopia\\Platform\\": "src/Platform" } }, @@ -4676,9 +4675,9 @@ ], "support": { "issues": "https://github.com/utopia-php/platform/issues", - "source": "https://github.com/utopia-php/platform/tree/bump-cli-and-framework" + "source": "https://github.com/utopia-php/platform/tree/0.7.16" }, - "time": "2026-02-10T04:48:33+00:00" + "time": "2026-02-11T06:36:48+00:00" }, { "name": "utopia-php/pools", @@ -8944,25 +8943,9 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [ - { - "package": "utopia-php/framework", - "version": "dev-backport-0.34-adapters", - "alias": "0.33.38", - "alias_normalized": "0.33.38.0" - }, - { - "package": "utopia-php/platform", - "version": "dev-bump-cli-and-framework", - "alias": "0.7.15", - "alias_normalized": "0.7.15.0" - } - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "utopia-php/framework": 20, - "utopia-php/platform": 20 - }, + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { From 32c617a149d0bd62d02d3db4f0a3fa4eaee7d720 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 11 Feb 2026 20:02:36 +1300 Subject: [PATCH 88/96] fix: remove invalid YAML condition syntax in docker-compose.yml The appwrite-worker-functions depends_on section mixed list format (- redis) with mapping format (condition: service_healthy), causing a YAML parse error at line 696 that prevented docker compose from starting, failing all CI checks. Co-Authored-By: Claude Opus 4.6 --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 458eaf8dc7..0a959cd137 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -693,7 +693,6 @@ services: depends_on: - ${_APP_DB_HOST:-mariadb} - redis - condition: service_healthy environment: - _APP_ENV - _APP_WORKER_PER_CORE From bc69154024886850ab643f5bfa842e670b968860 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 11 Feb 2026 20:39:21 +1300 Subject: [PATCH 89/96] fix: add retry logic to helperGetLatestCommit for GitHub API rate limits The testCreateSiteFromTemplateCommit test fails intermittently when the unauthenticated GitHub API call gets rate limited, returning null. Added 3 retries with 5s delay to handle transient failures. Co-Authored-By: Claude Opus 4.6 --- tests/e2e/Services/Sites/SitesBase.php | 33 ++++++++++++++++---------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/tests/e2e/Services/Sites/SitesBase.php b/tests/e2e/Services/Sites/SitesBase.php index e7af09d1d9..239237c8b1 100644 --- a/tests/e2e/Services/Sites/SitesBase.php +++ b/tests/e2e/Services/Sites/SitesBase.php @@ -335,21 +335,28 @@ trait SitesBase protected function helperGetLatestCommit(string $owner, string $repository): ?string { - $ch = curl_init("https://api.github.com/repos/{$owner}/{$repository}/commits/main"); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_HTTPHEADER, [ - 'User-Agent: Appwrite', - 'Accept: application/vnd.github.v3+json' - ]); + $maxRetries = 3; + for ($attempt = 0; $attempt < $maxRetries; $attempt++) { + if ($attempt > 0) { + sleep(5); + } - $response = curl_exec($ch); - $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - curl_close($ch); + $ch = curl_init("https://api.github.com/repos/{$owner}/{$repository}/commits/main"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'User-Agent: Appwrite', + 'Accept: application/vnd.github.v3+json' + ]); - if ($httpCode === 200) { - $commitData = json_decode($response, true); - if (isset($commitData['sha'])) { - return $commitData['sha']; + $response = curl_exec($ch); + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + + if ($httpCode === 200) { + $commitData = json_decode($response, true); + if (isset($commitData['sha'])) { + return $commitData['sha']; + } } } From a2dc62d4e5fb52d145a8f67177d6e646f8eb94d1 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 11 Feb 2026 15:20:30 +0530 Subject: [PATCH 90/96] fix --- src/Appwrite/Platform/Tasks/SDKs.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Tasks/SDKs.php b/src/Appwrite/Platform/Tasks/SDKs.php index 302723364d..9bb75427d0 100644 --- a/src/Appwrite/Platform/Tasks/SDKs.php +++ b/src/Appwrite/Platform/Tasks/SDKs.php @@ -78,8 +78,11 @@ class SDKs extends Action ->callback($this->action(...)); } - public function action(?string $selectedPlatform, ?string $selectedSDK, ?string $version, ?string $git, ?string $message, ?string $release, ?string $commit, ?string $sdks): void + public function action(?string $platform, ?string $sdk, ?string $version, ?string $git, ?string $message, ?string $release, ?string $commit, ?string $sdks): void { + $selectedPlatform = $platform; + $selectedSDK = $sdk; + if (!$sdks) { $selectedPlatform ??= Console::confirm('Choose Platform ("' . implode('", "', static::getPlatforms()) . '" or "*" for all):'); $selectedSDK ??= \strtolower(Console::confirm('Choose SDK ("*" for all):')); From 61c5374134bc80dd1d13229afcb1ecfe662a3366 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 11 Feb 2026 16:04:20 +0530 Subject: [PATCH 91/96] remove orchestration --- composer.json | 1 - composer.lock | 52 +-------------------------------------------------- 2 files changed, 1 insertion(+), 52 deletions(-) diff --git a/composer.json b/composer.json index 03a1d37598..f3100ac9cb 100644 --- a/composer.json +++ b/composer.json @@ -65,7 +65,6 @@ "utopia-php/logger": "0.6.*", "utopia-php/messaging": "0.20.*", "utopia-php/migration": "1.5.*", - "utopia-php/orchestration": "0.19.*", "utopia-php/platform": "0.7.*", "utopia-php/pools": "1.*", "utopia-php/preloader": "0.2.*", diff --git a/composer.lock b/composer.lock index 9d3e063ae2..bb9f10f1eb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "06d83bf3bbd4729377e2be95738a2efb", + "content-hash": "367aaf665ff75a13d5d7c8b3bedb89a9", "packages": [ { "name": "adhocore/jwt", @@ -4578,56 +4578,6 @@ }, "time": "2025-10-20T11:11:23+00:00" }, - { - "name": "utopia-php/orchestration", - "version": "0.19.1", - "source": { - "type": "git", - "url": "https://github.com/utopia-php/orchestration.git", - "reference": "5a1168d3c3c1af9de76289b380b60717722b36db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/utopia-php/orchestration/zipball/5a1168d3c3c1af9de76289b380b60717722b36db", - "reference": "5a1168d3c3c1af9de76289b380b60717722b36db", - "shasum": "" - }, - "require": { - "php": ">=8.0", - "utopia-php/console": "0.1.*" - }, - "require-dev": { - "laravel/pint": "^1.2", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\Orchestration\\": "src/Orchestration" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Lite & fast micro PHP abstraction library for container orchestration", - "keywords": [ - "docker", - "framework", - "kubernetes", - "orchestration", - "php", - "swarm", - "upf", - "utopia" - ], - "support": { - "issues": "https://github.com/utopia-php/orchestration/issues", - "source": "https://github.com/utopia-php/orchestration/tree/0.19.1" - }, - "time": "2026-02-10T12:44:30+00:00" - }, { "name": "utopia-php/platform", "version": "0.7.16", From f7f97cdb33b3418fe1e449f6426c69504857150c Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 11 Feb 2026 16:16:59 +0530 Subject: [PATCH 92/96] chore: release cli 13.3.2 --- app/config/sdks.php | 2 +- composer.json | 2 +- composer.lock | 169 +++++++++++++------------------------ docs/sdks/cli/CHANGELOG.md | 5 ++ 4 files changed, 67 insertions(+), 111 deletions(-) diff --git a/app/config/sdks.php b/app/config/sdks.php index 3476e9d224..e3f0f62e12 100644 --- a/app/config/sdks.php +++ b/app/config/sdks.php @@ -227,7 +227,7 @@ return [ [ 'key' => 'cli', 'name' => 'Command Line', - 'version' => '13.3.1', + 'version' => '13.3.2', 'url' => 'https://github.com/appwrite/sdk-for-cli', 'package' => 'https://www.npmjs.com/package/appwrite-cli', 'enabled' => true, diff --git a/composer.json b/composer.json index 356723ec8d..09f9b27819 100644 --- a/composer.json +++ b/composer.json @@ -58,7 +58,7 @@ "utopia-php/emails": "0.6.*", "utopia-php/dns": "1.5.*", "utopia-php/dsn": "0.2.1", - "utopia-php/framework": "0.33.*", + "utopia-php/framework": "0.33.38", "utopia-php/fetch": "0.5.*", "utopia-php/image": "0.8.*", "utopia-php/locale": "0.8.*", diff --git a/composer.lock b/composer.lock index ce40ffa7a9..551edb5208 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "917f9050c673379c91e46814c7c07f64", + "content-hash": "10ec8ae8a5f80e1b3119688c94cce062", "packages": [ { "name": "adhocore/jwt", @@ -216,16 +216,16 @@ }, { "name": "brick/math", - "version": "0.14.7", + "version": "0.14.8", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "07ff363b16ef8aca9692bba3be9e73fe63f34e50" + "reference": "63422359a44b7f06cae63c3b429b59e8efcc0629" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/07ff363b16ef8aca9692bba3be9e73fe63f34e50", - "reference": "07ff363b16ef8aca9692bba3be9e73fe63f34e50", + "url": "https://api.github.com/repos/brick/math/zipball/63422359a44b7f06cae63c3b429b59e8efcc0629", + "reference": "63422359a44b7f06cae63c3b429b59e8efcc0629", "shasum": "" }, "require": { @@ -264,7 +264,7 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.14.7" + "source": "https://github.com/brick/math/tree/0.14.8" }, "funding": [ { @@ -272,7 +272,7 @@ "type": "github" } ], - "time": "2026-02-07T10:57:35+00:00" + "time": "2026-02-10T14:33:43+00:00" }, { "name": "chillerlan/php-qrcode", @@ -1355,16 +1355,16 @@ }, { "name": "open-telemetry/exporter-otlp", - "version": "1.3.4", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/exporter-otlp.git", - "reference": "62e680d587beb42e5247aa6ecd89ad1ca406e8ca" + "reference": "283a0d66522f2adc6d8d7debfd7686be91c282be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/62e680d587beb42e5247aa6ecd89ad1ca406e8ca", - "reference": "62e680d587beb42e5247aa6ecd89ad1ca406e8ca", + "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/283a0d66522f2adc6d8d7debfd7686be91c282be", + "reference": "283a0d66522f2adc6d8d7debfd7686be91c282be", "shasum": "" }, "require": { @@ -1415,7 +1415,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2026-01-15T09:31:34+00:00" + "time": "2026-02-05T09:44:52+00:00" }, { "name": "open-telemetry/gen-otlp-protobuf", @@ -1482,16 +1482,16 @@ }, { "name": "open-telemetry/sdk", - "version": "1.12.0", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "7f1bd524465c1ca42755a9ef1143ba09913f5be0" + "reference": "c76f91203bf7ef98ab3f4e0a82ca21699af185e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/7f1bd524465c1ca42755a9ef1143ba09913f5be0", - "reference": "7f1bd524465c1ca42755a9ef1143ba09913f5be0", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/c76f91203bf7ef98ab3f4e0a82ca21699af185e1", + "reference": "c76f91203bf7ef98ab3f4e0a82ca21699af185e1", "shasum": "" }, "require": { @@ -1575,7 +1575,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2026-01-21T04:14:03+00:00" + "time": "2026-01-28T11:38:11+00:00" }, { "name": "open-telemetry/sem-conv", @@ -3745,54 +3745,6 @@ }, "time": "2025-11-18T17:02:00+00:00" }, - { - "name": "utopia-php/console", - "version": "0.0.1", - "source": { - "type": "git", - "url": "https://github.com/utopia-php/console.git", - "reference": "f77104e4a888fa9cb3e08f32955ec09479ab7a92" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/utopia-php/console/zipball/f77104e4a888fa9cb3e08f32955ec09479ab7a92", - "reference": "f77104e4a888fa9cb3e08f32955ec09479ab7a92", - "shasum": "" - }, - "require": { - "php": ">=7.4" - }, - "require-dev": { - "laravel/pint": "1.2.*", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.3", - "squizlabs/php_codesniffer": "^3.6", - "swoole/ide-helper": "4.8.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Console helpers for logging, prompting, and executing commands", - "keywords": [ - "cli", - "console", - "php", - "terminal", - "utopia" - ], - "support": { - "issues": "https://github.com/utopia-php/console/issues", - "source": "https://github.com/utopia-php/console/tree/0.0.1" - }, - "time": "2025-10-20T14:41:36+00:00" - }, { "name": "utopia-php/database", "version": "5.0.2", @@ -4112,21 +4064,20 @@ }, { "name": "utopia-php/emails", - "version": "0.6.6", + "version": "0.6.8", "source": { "type": "git", "url": "https://github.com/utopia-php/emails.git", - "reference": "354f7fe591e1fba7736afada558cb3b02ec03fea" + "reference": "25dfcd46ed47b862d2a7e7c98d92a3a4680b6f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/emails/zipball/354f7fe591e1fba7736afada558cb3b02ec03fea", - "reference": "354f7fe591e1fba7736afada558cb3b02ec03fea", + "url": "https://api.github.com/repos/utopia-php/emails/zipball/25dfcd46ed47b862d2a7e7c98d92a3a4680b6f1b", + "reference": "25dfcd46ed47b862d2a7e7c98d92a3a4680b6f1b", "shasum": "" }, "require": { "php": ">=8.0", - "utopia-php/cli": "^0.15", "utopia-php/domains": "^1.0", "utopia-php/fetch": "^0.5", "utopia-php/validators": "0.*" @@ -4134,7 +4085,9 @@ "require-dev": { "laravel/pint": "1.25.*", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.3", + "utopia-php/cli": "^0.22", + "utopia-php/console": "0.*" }, "type": "library", "autoload": { @@ -4166,9 +4119,9 @@ ], "support": { "issues": "https://github.com/utopia-php/emails/issues", - "source": "https://github.com/utopia-php/emails/tree/0.6.6" + "source": "https://github.com/utopia-php/emails/tree/0.6.8" }, - "time": "2026-02-02T10:41:22+00:00" + "time": "2026-02-09T12:31:56+00:00" }, { "name": "utopia-php/fetch", @@ -4460,16 +4413,16 @@ }, { "name": "utopia-php/migration", - "version": "1.5.1", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "b5fe19804b41d5bdd85571e7cdb83a268b6859e2" + "reference": "93904948f6dd07491821615fd9b9acbcaadec12e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/b5fe19804b41d5bdd85571e7cdb83a268b6859e2", - "reference": "b5fe19804b41d5bdd85571e7cdb83a268b6859e2", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/93904948f6dd07491821615fd9b9acbcaadec12e", + "reference": "93904948f6dd07491821615fd9b9acbcaadec12e", "shasum": "" }, "require": { @@ -4478,7 +4431,6 @@ "ext-openssl": "*", "halaxa/json-machine": "^1.2", "php": ">=8.1", - "utopia-php/console": "0.0.*", "utopia-php/database": "5.*", "utopia-php/dsn": "0.2.*", "utopia-php/storage": "0.18.*" @@ -4510,9 +4462,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/1.5.1" + "source": "https://github.com/utopia-php/migration/tree/1.5.2" }, - "time": "2026-02-05T11:32:03+00:00" + "time": "2026-02-11T06:19:35+00:00" }, { "name": "utopia-php/mongo", @@ -4784,22 +4736,21 @@ }, { "name": "utopia-php/queue", - "version": "0.15.4", + "version": "0.15.5", "source": { "type": "git", "url": "https://github.com/utopia-php/queue.git", - "reference": "2d693ec59119f853602f4be271602fddefbab507" + "reference": "aa80ffe6350efd3394615c3763dba138223a225a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/queue/zipball/2d693ec59119f853602f4be271602fddefbab507", - "reference": "2d693ec59119f853602f4be271602fddefbab507", + "url": "https://api.github.com/repos/utopia-php/queue/zipball/aa80ffe6350efd3394615c3763dba138223a225a", + "reference": "aa80ffe6350efd3394615c3763dba138223a225a", "shasum": "" }, "require": { "php": ">=8.3", "php-amqplib/php-amqplib": "^3.7", - "utopia-php/console": "0.0.*", "utopia-php/fetch": "0.5.*", "utopia-php/pools": "1.*", "utopia-php/servers": "0.2.*", @@ -4845,9 +4796,9 @@ ], "support": { "issues": "https://github.com/utopia-php/queue/issues", - "source": "https://github.com/utopia-php/queue/tree/0.15.4" + "source": "https://github.com/utopia-php/queue/tree/0.15.5" }, - "time": "2026-02-04T08:50:35+00:00" + "time": "2026-02-10T12:30:46+00:00" }, { "name": "utopia-php/registry", @@ -4903,16 +4854,16 @@ }, { "name": "utopia-php/servers", - "version": "0.2.4", + "version": "0.2.5", "source": { "type": "git", "url": "https://github.com/utopia-php/servers.git", - "reference": "8675d32f4315e91cdb7757a829356030029ed4f5" + "reference": "4770e879a90685af4ba14e7e5d95d0a17c7fdf03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/servers/zipball/8675d32f4315e91cdb7757a829356030029ed4f5", - "reference": "8675d32f4315e91cdb7757a829356030029ed4f5", + "url": "https://api.github.com/repos/utopia-php/servers/zipball/4770e879a90685af4ba14e7e5d95d0a17c7fdf03", + "reference": "4770e879a90685af4ba14e7e5d95d0a17c7fdf03", "shasum": "" }, "require": { @@ -4951,9 +4902,9 @@ ], "support": { "issues": "https://github.com/utopia-php/servers/issues", - "source": "https://github.com/utopia-php/servers/tree/0.2.4" + "source": "https://github.com/utopia-php/servers/tree/0.2.5" }, - "time": "2026-02-04T07:15:26+00:00" + "time": "2026-02-10T04:21:53+00:00" }, { "name": "utopia-php/span", @@ -5488,16 +5439,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "1.8.26", + "version": "1.8.28", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "ce65854069a1af8ef0757650da5848168cca5f02" + "reference": "4762aa017b28a3a7e4e53da6e193d0c196ec3fd4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/ce65854069a1af8ef0757650da5848168cca5f02", - "reference": "ce65854069a1af8ef0757650da5848168cca5f02", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/4762aa017b28a3a7e4e53da6e193d0c196ec3fd4", + "reference": "4762aa017b28a3a7e4e53da6e193d0c196ec3fd4", "shasum": "" }, "require": { @@ -5533,9 +5484,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/1.8.26" + "source": "https://github.com/appwrite/sdk-generator/tree/1.8.28" }, - "time": "2026-02-08T07:41:27+00:00" + "time": "2026-02-11T10:35:18+00:00" }, { "name": "doctrine/annotations", @@ -5762,16 +5713,16 @@ }, { "name": "laravel/pint", - "version": "v1.27.0", + "version": "v1.27.1", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "c67b4195b75491e4dfc6b00b1c78b68d86f54c90" + "reference": "54cca2de13790570c7b6f0f94f37896bee4abcb5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/c67b4195b75491e4dfc6b00b1c78b68d86f54c90", - "reference": "c67b4195b75491e4dfc6b00b1c78b68d86f54c90", + "url": "https://api.github.com/repos/laravel/pint/zipball/54cca2de13790570c7b6f0f94f37896bee4abcb5", + "reference": "54cca2de13790570c7b6f0f94f37896bee4abcb5", "shasum": "" }, "require": { @@ -5782,13 +5733,13 @@ "php": "^8.2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.92.4", - "illuminate/view": "^12.44.0", - "larastan/larastan": "^3.8.1", - "laravel-zero/framework": "^12.0.4", + "friendsofphp/php-cs-fixer": "^3.93.1", + "illuminate/view": "^12.51.0", + "larastan/larastan": "^3.9.2", + "laravel-zero/framework": "^12.0.5", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^2.3.3", - "pestphp/pest": "^3.8.4" + "pestphp/pest": "^3.8.5" }, "bin": [ "builds/pint" @@ -5825,7 +5776,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2026-01-05T16:49:17+00:00" + "time": "2026-02-10T20:00:20+00:00" }, { "name": "matthiasmullie/minify", diff --git a/docs/sdks/cli/CHANGELOG.md b/docs/sdks/cli/CHANGELOG.md index 1e8b2177c0..eea3c07522 100644 --- a/docs/sdks/cli/CHANGELOG.md +++ b/docs/sdks/cli/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 13.3.2 + +- Fix handle null rows in table parser +- Export config zod schemas + ## 13.3.1 - Fix generated TS imports to auto-detect ESM vs non-ESM From 5371aa68203e5bcfc212c5f214da83679a8db267 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 11 Feb 2026 16:30:29 +0530 Subject: [PATCH 93/96] chore(ci): add php-retry to tests workflow --- .github/workflows/tests.yml | 242 +++++++++++++++++++++--------------- 1 file changed, 141 insertions(+), 101 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ada8b8c85d..652888bd0b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -108,9 +108,14 @@ jobs: run: docker compose exec -T appwrite vars - name: Run Unit Tests - run: | - docker compose exec \ - -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ + uses: itznotabug/php-retry@v3 + with: + max_attempts: 3 + timeout_minutes: 30 + test_dir: tests/unit + command: >- + docker compose exec + -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" appwrite test /usr/src/code/tests/unit e2e_general_test: @@ -143,9 +148,14 @@ jobs: done - name: Run General Tests - run: | - docker compose exec -T \ - -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ + uses: itznotabug/php-retry@v3 + with: + max_attempts: 3 + timeout_minutes: 30 + test_dir: tests/e2e/General + command: >- + docker compose exec -T + -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" appwrite test /usr/src/code/tests/e2e/General --debug - name: Failure Logs @@ -219,37 +229,42 @@ jobs: done - name: Run ${{ matrix.service }} tests with Project table mode - run: | - echo "Using project tables" + uses: itznotabug/php-retry@v3 + with: + max_attempts: 3 + timeout_minutes: 30 + test_dir: tests/e2e/Services/${{ matrix.service }} + command: | + echo "Using project tables" - export _APP_DATABASE_SHARED_TABLES= - export _APP_DATABASE_SHARED_TABLES_V1= + export _APP_DATABASE_SHARED_TABLES= + export _APP_DATABASE_SHARED_TABLES_V1= - # Set DB Adapter Specific ENV Vars using if-elif - if [ "${{ matrix.db_adapter }}" = "MARIADB" ]; then - export _APP_DB_ADAPTER=mariadb - export _APP_DB_HOST=mariadb - export _APP_DB_PORT=3306 - export _APP_DB_SCHEMA=appwrite - elif [ "${{ matrix.db_adapter }}" = "POSTGRESQL" ]; then - export _APP_DB_ADAPTER=postgresql - export _APP_DB_HOST=postgresql - export _APP_DB_PORT=5432 - export _APP_DB_SCHEMA=appwrite - else - echo "Unknown DB adapter: ${{ matrix.db_adapter }}" - exit 1 - fi + # Set DB Adapter Specific ENV Vars using if-elif + if [ "${{ matrix.db_adapter }}" = "MARIADB" ]; then + export _APP_DB_ADAPTER=mariadb + export _APP_DB_HOST=mariadb + export _APP_DB_PORT=3306 + export _APP_DB_SCHEMA=appwrite + elif [ "${{ matrix.db_adapter }}" = "POSTGRESQL" ]; then + export _APP_DB_ADAPTER=postgresql + export _APP_DB_HOST=postgresql + export _APP_DB_PORT=5432 + export _APP_DB_SCHEMA=appwrite + else + echo "Unknown DB adapter: ${{ matrix.db_adapter }}" + exit 1 + fi - docker compose exec -T \ - -e _APP_DATABASE_SHARED_TABLES \ - -e _APP_DATABASE_SHARED_TABLES_V1 \ - -e _APP_DB_ADAPTER \ - -e _APP_DB_HOST \ - -e _APP_DB_PORT \ - -e _APP_DB_SCHEMA \ - -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ - appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude-group abuseEnabled,screenshots + docker compose exec -T \ + -e _APP_DATABASE_SHARED_TABLES \ + -e _APP_DATABASE_SHARED_TABLES_V1 \ + -e _APP_DB_ADAPTER \ + -e _APP_DB_HOST \ + -e _APP_DB_PORT \ + -e _APP_DB_SCHEMA \ + -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ + appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude-group abuseEnabled,screenshots - name: Failure Logs if: failure() @@ -323,22 +338,27 @@ jobs: done - name: Run ${{ matrix.service }} tests with ${{ matrix.tables-mode }} table mode - run: | - if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then - echo "Using shared tables V1" - export _APP_DATABASE_SHARED_TABLES=database_db_main - export _APP_DATABASE_SHARED_TABLES_V1=database_db_main - elif [ "${{ matrix.tables-mode }}" == "Shared V2" ]; then - echo "Using shared tables V2" - export _APP_DATABASE_SHARED_TABLES=database_db_main - export _APP_DATABASE_SHARED_TABLES_V1= - fi - - docker compose exec -T \ - -e _APP_DATABASE_SHARED_TABLES \ - -e _APP_DATABASE_SHARED_TABLES_V1 \ - -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ - appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude-group abuseEnabled,screenshots + uses: itznotabug/php-retry@v3 + with: + max_attempts: 3 + timeout_minutes: 30 + test_dir: tests/e2e/Services/${{ matrix.service }} + command: | + if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then + echo "Using shared tables V1" + export _APP_DATABASE_SHARED_TABLES=database_db_main + export _APP_DATABASE_SHARED_TABLES_V1=database_db_main + elif [ "${{ matrix.tables-mode }}" == "Shared V2" ]; then + echo "Using shared tables V2" + export _APP_DATABASE_SHARED_TABLES=database_db_main + export _APP_DATABASE_SHARED_TABLES_V1= + fi + + docker compose exec -T \ + -e _APP_DATABASE_SHARED_TABLES \ + -e _APP_DATABASE_SHARED_TABLES_V1 \ + -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ + appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude-group abuseEnabled,screenshots - name: Failure Logs if: failure() @@ -371,16 +391,21 @@ jobs: sleep 30 - name: Run Projects tests in dedicated table mode - run: | - echo "Using project tables" - export _APP_DATABASE_SHARED_TABLES= - export _APP_DATABASE_SHARED_TABLES_V1= + uses: itznotabug/php-retry@v3 + with: + max_attempts: 3 + timeout_minutes: 30 + test_dir: tests/e2e/Services/Projects + command: | + echo "Using project tables" + export _APP_DATABASE_SHARED_TABLES= + export _APP_DATABASE_SHARED_TABLES_V1= - docker compose exec -T \ - -e _APP_DATABASE_SHARED_TABLES \ - -e _APP_DATABASE_SHARED_TABLES_V1 \ - -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ - appwrite test /usr/src/code/tests/e2e/Services/Projects --debug --group=abuseEnabled + docker compose exec -T \ + -e _APP_DATABASE_SHARED_TABLES \ + -e _APP_DATABASE_SHARED_TABLES_V1 \ + -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ + appwrite test /usr/src/code/tests/e2e/Services/Projects --debug --group=abuseEnabled - name: Failure Logs if: failure() @@ -421,22 +446,27 @@ jobs: sleep 30 - name: Run Projects tests in ${{ matrix.tables-mode }} table mode - run: | - if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then - echo "Using shared tables V1" - export _APP_DATABASE_SHARED_TABLES=database_db_main - export _APP_DATABASE_SHARED_TABLES_V1=database_db_main - elif [ "${{ matrix.tables-mode }}" == "Shared V2" ]; then - echo "Using shared tables V2" - export _APP_DATABASE_SHARED_TABLES=database_db_main - export _APP_DATABASE_SHARED_TABLES_V1= - fi + uses: itznotabug/php-retry@v3 + with: + max_attempts: 3 + timeout_minutes: 30 + test_dir: tests/e2e/Services/Projects + command: | + if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then + echo "Using shared tables V1" + export _APP_DATABASE_SHARED_TABLES=database_db_main + export _APP_DATABASE_SHARED_TABLES_V1=database_db_main + elif [ "${{ matrix.tables-mode }}" == "Shared V2" ]; then + echo "Using shared tables V2" + export _APP_DATABASE_SHARED_TABLES=database_db_main + export _APP_DATABASE_SHARED_TABLES_V1= + fi - docker compose exec -T \ - -e _APP_DATABASE_SHARED_TABLES \ - -e _APP_DATABASE_SHARED_TABLES_V1 \ - -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ - appwrite test /usr/src/code/tests/e2e/Services/Projects --debug --group=abuseEnabled + docker compose exec -T \ + -e _APP_DATABASE_SHARED_TABLES \ + -e _APP_DATABASE_SHARED_TABLES_V1 \ + -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ + appwrite test /usr/src/code/tests/e2e/Services/Projects --debug --group=abuseEnabled - name: Failure Logs if: failure() @@ -469,17 +499,22 @@ jobs: sleep 30 - name: Run Site tests with browser connected in dedicated table mode - run: | - echo "Keeping original value of _APP_BROWSER_HOST" - echo "Using project tables" - export _APP_DATABASE_SHARED_TABLES= - export _APP_DATABASE_SHARED_TABLES_V1= + uses: itznotabug/php-retry@v3 + with: + max_attempts: 3 + timeout_minutes: 30 + test_dir: tests/e2e/Services/Sites + command: | + echo "Keeping original value of _APP_BROWSER_HOST" + echo "Using project tables" + export _APP_DATABASE_SHARED_TABLES= + export _APP_DATABASE_SHARED_TABLES_V1= - docker compose exec -T \ - -e _APP_DATABASE_SHARED_TABLES \ - -e _APP_DATABASE_SHARED_TABLES_V1 \ - -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ - appwrite test /usr/src/code/tests/e2e/Services/Sites --debug --group=screenshots + docker compose exec -T \ + -e _APP_DATABASE_SHARED_TABLES \ + -e _APP_DATABASE_SHARED_TABLES_V1 \ + -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ + appwrite test /usr/src/code/tests/e2e/Services/Sites --debug --group=screenshots - name: Failure Logs if: failure() @@ -520,23 +555,28 @@ jobs: sleep 30 - name: Run Site tests with browser connected in ${{ matrix.tables-mode }} table mode - run: | - echo "Keeping original value of _APP_BROWSER_HOST" - if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then - echo "Using shared tables V1" - export _APP_DATABASE_SHARED_TABLES=database_db_main - export _APP_DATABASE_SHARED_TABLES_V1=database_db_main - elif [ "${{ matrix.tables-mode }}" == "Shared V2" ]; then - echo "Using shared tables V2" - export _APP_DATABASE_SHARED_TABLES=database_db_main - export _APP_DATABASE_SHARED_TABLES_V1= - fi + uses: itznotabug/php-retry@v3 + with: + max_attempts: 3 + timeout_minutes: 30 + test_dir: tests/e2e/Services/Sites + command: | + echo "Keeping original value of _APP_BROWSER_HOST" + if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then + echo "Using shared tables V1" + export _APP_DATABASE_SHARED_TABLES=database_db_main + export _APP_DATABASE_SHARED_TABLES_V1=database_db_main + elif [ "${{ matrix.tables-mode }}" == "Shared V2" ]; then + echo "Using shared tables V2" + export _APP_DATABASE_SHARED_TABLES=database_db_main + export _APP_DATABASE_SHARED_TABLES_V1= + fi - docker compose exec -T \ - -e _APP_DATABASE_SHARED_TABLES \ - -e _APP_DATABASE_SHARED_TABLES_V1 \ - -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ - appwrite test /usr/src/code/tests/e2e/Services/Sites --debug --group=screenshots + docker compose exec -T \ + -e _APP_DATABASE_SHARED_TABLES \ + -e _APP_DATABASE_SHARED_TABLES_V1 \ + -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ + appwrite test /usr/src/code/tests/e2e/Services/Sites --debug --group=screenshots - name: Failure Logs if: failure() @@ -544,4 +584,4 @@ jobs: echo "=== Appwrite Worker Builds Logs ===" docker compose logs appwrite-worker-builds echo "=== OpenRuntimes Executor Logs ===" - docker compose logs openruntimes-executor \ No newline at end of file + docker compose logs openruntimes-executor From dcb759e3fedeba709a0501ca88e3c362b2a90f72 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 11 Feb 2026 16:49:59 +0530 Subject: [PATCH 94/96] chore(ci): restore retry job metadata inputs --- .github/workflows/tests.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 652888bd0b..abc504cc9c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -112,6 +112,8 @@ jobs: with: max_attempts: 3 timeout_minutes: 30 + job_id: ${{ job.check_run_id }} + github_token: ${{ secrets.GITHUB_TOKEN }} test_dir: tests/unit command: >- docker compose exec @@ -152,6 +154,8 @@ jobs: with: max_attempts: 3 timeout_minutes: 30 + job_id: ${{ job.check_run_id }} + github_token: ${{ secrets.GITHUB_TOKEN }} test_dir: tests/e2e/General command: >- docker compose exec -T @@ -233,6 +237,8 @@ jobs: with: max_attempts: 3 timeout_minutes: 30 + job_id: ${{ job.check_run_id }} + github_token: ${{ secrets.GITHUB_TOKEN }} test_dir: tests/e2e/Services/${{ matrix.service }} command: | echo "Using project tables" @@ -342,6 +348,8 @@ jobs: with: max_attempts: 3 timeout_minutes: 30 + job_id: ${{ job.check_run_id }} + github_token: ${{ secrets.GITHUB_TOKEN }} test_dir: tests/e2e/Services/${{ matrix.service }} command: | if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then @@ -395,6 +403,8 @@ jobs: with: max_attempts: 3 timeout_minutes: 30 + job_id: ${{ job.check_run_id }} + github_token: ${{ secrets.GITHUB_TOKEN }} test_dir: tests/e2e/Services/Projects command: | echo "Using project tables" @@ -450,6 +460,8 @@ jobs: with: max_attempts: 3 timeout_minutes: 30 + job_id: ${{ job.check_run_id }} + github_token: ${{ secrets.GITHUB_TOKEN }} test_dir: tests/e2e/Services/Projects command: | if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then @@ -503,6 +515,8 @@ jobs: with: max_attempts: 3 timeout_minutes: 30 + job_id: ${{ job.check_run_id }} + github_token: ${{ secrets.GITHUB_TOKEN }} test_dir: tests/e2e/Services/Sites command: | echo "Keeping original value of _APP_BROWSER_HOST" @@ -559,6 +573,8 @@ jobs: with: max_attempts: 3 timeout_minutes: 30 + job_id: ${{ job.check_run_id }} + github_token: ${{ secrets.GITHUB_TOKEN }} test_dir: tests/e2e/Services/Sites command: | echo "Keeping original value of _APP_BROWSER_HOST" From b243404a71f40bccda908e01fc3c5ab728a680ae Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 11 Feb 2026 16:53:25 +0530 Subject: [PATCH 95/96] chore(ci): add PR comment permissions to retry jobs --- .github/workflows/tests.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index abc504cc9c..fc678a72da 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -80,6 +80,9 @@ jobs: name: Unit Test runs-on: ubuntu-latest needs: setup + permissions: + contents: read + pull-requests: write steps: - name: checkout @@ -124,6 +127,9 @@ jobs: name: E2E General Test runs-on: ubuntu-latest needs: setup + permissions: + contents: read + pull-requests: write steps: - name: checkout uses: actions/checkout@v4 @@ -174,6 +180,9 @@ jobs: name: E2E Service Test runs-on: ubuntu-latest needs: setup + permissions: + contents: read + pull-requests: write strategy: fail-fast: false matrix: @@ -285,6 +294,9 @@ jobs: runs-on: ubuntu-latest needs: [ setup, check_database_changes ] if: needs.check_database_changes.outputs.database_changed == 'true' + permissions: + contents: read + pull-requests: write strategy: fail-fast: false matrix: @@ -380,6 +392,9 @@ jobs: name: E2E Service Test (Abuse enabled) runs-on: ubuntu-latest needs: setup + permissions: + contents: read + pull-requests: write steps: - name: checkout uses: actions/checkout@v4 @@ -430,6 +445,9 @@ jobs: runs-on: ubuntu-latest needs: [ setup, check_database_changes ] if: needs.check_database_changes.outputs.database_changed == 'true' + permissions: + contents: read + pull-requests: write strategy: fail-fast: false matrix: @@ -492,6 +510,9 @@ jobs: name: E2E Service Test (Site Screenshots) runs-on: ubuntu-latest needs: setup + permissions: + contents: read + pull-requests: write steps: - name: checkout uses: actions/checkout@v4 @@ -543,6 +564,9 @@ jobs: runs-on: ubuntu-latest needs: [ setup, check_database_changes ] if: needs.check_database_changes.outputs.database_changed == 'true' + permissions: + contents: read + pull-requests: write strategy: fail-fast: false matrix: From 1a966741f4e0d481f6ef125fbd5932cb5d6167da Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 11 Feb 2026 18:01:18 +0530 Subject: [PATCH 96/96] (fix): Fix TypeError in Origin validator when array is passed Move type check before assignment to prevent TypeError when non-string value (like array) is passed to Origin::isValid(). The property \$this->origin is typed as string, so assigning an array before the is_string() check caused the error. --- src/Appwrite/Network/Validator/Origin.php | 8 ++++---- tests/unit/Network/Validators/OriginTest.php | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Network/Validator/Origin.php b/src/Appwrite/Network/Validator/Origin.php index 2f76aa2f86..8b9974e990 100644 --- a/src/Appwrite/Network/Validator/Origin.php +++ b/src/Appwrite/Network/Validator/Origin.php @@ -51,14 +51,14 @@ class Origin extends Validator */ public function isValid($origin): bool { - $this->origin = $origin; - $this->scheme = null; - $this->host = null; - if (!is_string($origin) || empty($origin)) { return false; } + $this->origin = $origin; + $this->scheme = null; + $this->host = null; + $this->scheme = $this->parseScheme($origin); $this->host = strtolower(parse_url($origin, PHP_URL_HOST) ?? ''); diff --git a/tests/unit/Network/Validators/OriginTest.php b/tests/unit/Network/Validators/OriginTest.php index aa3ab65e5a..7a19daecbf 100644 --- a/tests/unit/Network/Validators/OriginTest.php +++ b/tests/unit/Network/Validators/OriginTest.php @@ -16,6 +16,8 @@ class OriginTest extends TestCase $this->assertEquals(false, $validator->isValid('')); $this->assertEquals(false, $validator->isValid('/')); + $this->assertEquals(false, $validator->isValid([])); + $this->assertEquals(false, $validator->isValid(['http://localhost'])); $this->assertEquals(true, $validator->isValid('https://localhost')); $this->assertEquals(true, $validator->isValid('http://localhost'));