From 9a3687ae3b9c10efae65ccadb319aaff810db7c7 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 28 Jul 2025 10:43:35 +0300 Subject: [PATCH 1/6] Run tests --- app/controllers/api/storage.php | 4 ++-- composer.json | 2 +- composer.lock | 27 ++++++++++++++++++--------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 480f6c63c6..867b8ff350 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -77,7 +77,7 @@ App::post('/v1/storage/buckets') )) ->param('bucketId', '', new CustomId(), 'Unique 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', '', new Text(128), 'Bucket name') - ->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) + ->param('permissions', [], new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('enabled', true, new Boolean(true), 'Is bucket enabled? When set to \'disabled\', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.', true) ->param('maximumFileSize', fn (array $plan) => empty($plan['fileSize']) ? (int) System::getEnv('_APP_STORAGE_LIMIT', 0) : $plan['fileSize'] * 1000 * 1000, fn (array $plan) => new Range(1, empty($plan['fileSize']) ? (int) System::getEnv('_APP_STORAGE_LIMIT', 0) : $plan['fileSize'] * 1000 * 1000), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human(System::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '.', true, ['plan']) @@ -88,7 +88,7 @@ App::post('/v1/storage/buckets') ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $bucketId, string $name, ?array $permissions, bool $fileSecurity, bool $enabled, int $maximumFileSize, array $allowedFileExtensions, ?string $compression, ?bool $encryption, bool $antivirus, Response $response, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $bucketId, string $name, array $permissions, bool $fileSecurity, bool $enabled, int $maximumFileSize, array $allowedFileExtensions, ?string $compression, ?bool $encryption, bool $antivirus, Response $response, Database $dbForProject, Event $queueForEvents) { $bucketId = $bucketId === 'unique()' ? ID::unique() : $bucketId; diff --git a/composer.json b/composer.json index 659d6221f7..289aa74e88 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "utopia-php/cache": "0.13.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.73.0", + "utopia-php/database": "dev-document-constructor as 0.73.0", "utopia-php/detector": "0.1.*", "utopia-php/domains": "0.8.*", "utopia-php/dsn": "0.2.1", diff --git a/composer.lock b/composer.lock index 718dbaf64b..481dce2631 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": "f4876940be4499bea26a77a036dece4f", + "content-hash": "1d9f78df647dcd880216183c9b7a3f9f", "packages": [ { "name": "adhocore/jwt", @@ -3493,16 +3493,16 @@ }, { "name": "utopia-php/database", - "version": "0.73.0", + "version": "dev-document-constructor", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "f9b6c587e54069dc64c2d29174ce8a42b7ba6491" + "reference": "2d37031df8d939dee5d01815442c5efaf8f66d9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/f9b6c587e54069dc64c2d29174ce8a42b7ba6491", - "reference": "f9b6c587e54069dc64c2d29174ce8a42b7ba6491", + "url": "https://api.github.com/repos/utopia-php/database/zipball/2d37031df8d939dee5d01815442c5efaf8f66d9d", + "reference": "2d37031df8d939dee5d01815442c5efaf8f66d9d", "shasum": "" }, "require": { @@ -3543,9 +3543,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.73.0" + "source": "https://github.com/utopia-php/database/tree/document-constructor" }, - "time": "2025-07-27T04:10:06+00:00" + "time": "2025-07-28T07:36:23+00:00" }, { "name": "utopia-php/detector", @@ -8237,9 +8237,18 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-document-constructor", + "alias": "0.73.0", + "alias_normalized": "0.73.0.0" + } + ], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": { + "utopia-php/database": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { From 66fa7ad659bcd8c59f76ef92175c2dda845b8997 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 28 Jul 2025 11:08:32 +0300 Subject: [PATCH 2/6] Use null default with fallback --- app/controllers/api/storage.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 867b8ff350..eedda7d744 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -77,7 +77,7 @@ App::post('/v1/storage/buckets') )) ->param('bucketId', '', new CustomId(), 'Unique 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', '', new Text(128), 'Bucket name') - ->param('permissions', [], new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) + ->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('enabled', true, new Boolean(true), 'Is bucket enabled? When set to \'disabled\', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.', true) ->param('maximumFileSize', fn (array $plan) => empty($plan['fileSize']) ? (int) System::getEnv('_APP_STORAGE_LIMIT', 0) : $plan['fileSize'] * 1000 * 1000, fn (array $plan) => new Range(1, empty($plan['fileSize']) ? (int) System::getEnv('_APP_STORAGE_LIMIT', 0) : $plan['fileSize'] * 1000 * 1000), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human(System::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '.', true, ['plan']) @@ -88,12 +88,13 @@ App::post('/v1/storage/buckets') ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $bucketId, string $name, array $permissions, bool $fileSecurity, bool $enabled, int $maximumFileSize, array $allowedFileExtensions, ?string $compression, ?bool $encryption, bool $antivirus, Response $response, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $bucketId, string $name, ?array $permissions, bool $fileSecurity, bool $enabled, int $maximumFileSize, array $allowedFileExtensions, ?string $compression, ?bool $encryption, bool $antivirus, Response $response, Database $dbForProject, Event $queueForEvents) { $bucketId = $bucketId === 'unique()' ? ID::unique() : $bucketId; // Map aggregate permissions into the multiple permissions they represent. $permissions = Permission::aggregate($permissions); + $permissions ??= []; $compression ??= Compression::NONE; $encryption ??= true; try { @@ -146,7 +147,7 @@ App::post('/v1/storage/buckets') $bucket = $dbForProject->getDocument('buckets', $bucketId); - $dbForProject->createCollection('bucket_' . $bucket->getSequence(), $attributes, $indexes, permissions: $permissions ?? [], documentSecurity: $fileSecurity); + $dbForProject->createCollection('bucket_' . $bucket->getSequence(), $attributes, $indexes, permissions: $permissions, documentSecurity: $fileSecurity); } catch (DuplicateException) { throw new Exception(Exception::STORAGE_BUCKET_ALREADY_EXISTS); } From 78887b9df630c1732d773fd1810d2b0693af1acb Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 28 Jul 2025 11:18:03 +0300 Subject: [PATCH 3/6] fallbacks --- app/controllers/api/storage.php | 3 +-- .../Modules/Databases/Http/Databases/Collections/Update.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index eedda7d744..8cfeb5da3b 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -93,8 +93,7 @@ App::post('/v1/storage/buckets') $bucketId = $bucketId === 'unique()' ? ID::unique() : $bucketId; // Map aggregate permissions into the multiple permissions they represent. - $permissions = Permission::aggregate($permissions); - $permissions ??= []; + $permissions = Permission::aggregate($permissions) ?? []; $compression ??= Compression::NONE; $encryption ??= true; try { 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 09b3ee2b35..03148eeb2b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php @@ -85,7 +85,7 @@ class Update extends Action throw new Exception($this->getNotFoundException()); } - $permissions ??= $collection->getPermissions() ?? []; + $permissions ??= $collection->getPermissions(); // Map aggregate permissions into the multiple permissions they represent. $permissions = Permission::aggregate($permissions); From bbf3164cac6e848fbde1b2a75712bdff9ab9f03b Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 28 Jul 2025 13:40:27 +0300 Subject: [PATCH 4/6] Run tests --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index 481dce2631..94478255d8 100644 --- a/composer.lock +++ b/composer.lock @@ -3497,12 +3497,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "2d37031df8d939dee5d01815442c5efaf8f66d9d" + "reference": "957a496d89398713464da229eeb36cafa0820151" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/2d37031df8d939dee5d01815442c5efaf8f66d9d", - "reference": "2d37031df8d939dee5d01815442c5efaf8f66d9d", + "url": "https://api.github.com/repos/utopia-php/database/zipball/957a496d89398713464da229eeb36cafa0820151", + "reference": "957a496d89398713464da229eeb36cafa0820151", "shasum": "" }, "require": { @@ -3545,7 +3545,7 @@ "issues": "https://github.com/utopia-php/database/issues", "source": "https://github.com/utopia-php/database/tree/document-constructor" }, - "time": "2025-07-28T07:36:23+00:00" + "time": "2025-07-28T10:39:09+00:00" }, { "name": "utopia-php/detector", From ff171853b42cb4c5bb165b1dc9baeb7934f44a5b Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 28 Jul 2025 17:14:41 +0300 Subject: [PATCH 5/6] use 0.73.1 --- composer.json | 2 +- composer.lock | 27 +++++++++------------------ 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index 289aa74e88..40740b711f 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "utopia-php/cache": "0.13.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "dev-document-constructor as 0.73.0", + "utopia-php/database": "0.73.*", "utopia-php/detector": "0.1.*", "utopia-php/domains": "0.8.*", "utopia-php/dsn": "0.2.1", diff --git a/composer.lock b/composer.lock index 94478255d8..5545eb2d3e 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": "1d9f78df647dcd880216183c9b7a3f9f", + "content-hash": "f152305ec0b90245773867cde288582d", "packages": [ { "name": "adhocore/jwt", @@ -3493,16 +3493,16 @@ }, { "name": "utopia-php/database", - "version": "dev-document-constructor", + "version": "0.73.1", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "957a496d89398713464da229eeb36cafa0820151" + "reference": "a893ea6b959613452712ed17301b5eae49e3793f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/957a496d89398713464da229eeb36cafa0820151", - "reference": "957a496d89398713464da229eeb36cafa0820151", + "url": "https://api.github.com/repos/utopia-php/database/zipball/a893ea6b959613452712ed17301b5eae49e3793f", + "reference": "a893ea6b959613452712ed17301b5eae49e3793f", "shasum": "" }, "require": { @@ -3543,9 +3543,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/document-constructor" + "source": "https://github.com/utopia-php/database/tree/0.73.1" }, - "time": "2025-07-28T10:39:09+00:00" + "time": "2025-07-28T12:28:29+00:00" }, { "name": "utopia-php/detector", @@ -8237,18 +8237,9 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [ - { - "package": "utopia-php/database", - "version": "dev-document-constructor", - "alias": "0.73.0", - "alias_normalized": "0.73.0.0" - } - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "utopia-php/database": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From a520e9fcc9dedc01387e661d8e2aec1af489ce10 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 29 Jul 2025 08:34:44 +0300 Subject: [PATCH 6/6] Update 0.73.2 --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 5545eb2d3e..bddc8ec936 100644 --- a/composer.lock +++ b/composer.lock @@ -3493,16 +3493,16 @@ }, { "name": "utopia-php/database", - "version": "0.73.1", + "version": "0.73.2", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "a893ea6b959613452712ed17301b5eae49e3793f" + "reference": "68545dfd5d1ac41ca2f4f5a59719b890fcd8f480" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/a893ea6b959613452712ed17301b5eae49e3793f", - "reference": "a893ea6b959613452712ed17301b5eae49e3793f", + "url": "https://api.github.com/repos/utopia-php/database/zipball/68545dfd5d1ac41ca2f4f5a59719b890fcd8f480", + "reference": "68545dfd5d1ac41ca2f4f5a59719b890fcd8f480", "shasum": "" }, "require": { @@ -3543,9 +3543,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.73.1" + "source": "https://github.com/utopia-php/database/tree/0.73.2" }, - "time": "2025-07-28T12:28:29+00:00" + "time": "2025-07-29T03:23:04+00:00" }, { "name": "utopia-php/detector",