diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0522e33da5..529f6103d1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -344,13 +344,13 @@ Things to remember when releasing SDKs: ## Debug -Appwrite uses [yasd](https://github.com/swoole/yasd) debugger, which can be made available during build of Appwrite. You can connect to the debugger using VS Code's [PHP Debug](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug) extension. +Appwrite uses [XDebug](https://github.com/xdebug/xdebug) debugger, which can be made available during build of Appwrite. You can connect to the debugger using VS Code's [PHP Debug](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug) extension. If you are in PHP Storm you don't need any plugin. Below are the settings required for remote debugger connection: -1. Create an init file. -2. Duplicate **dev/yasd_init.php.stub** file and name it **dev/yasd_init.php**. -3. Set **DEBUG** build arg in **appwrite** service in **docker-compose.yml** file. +1. Set **DEBUG** build arg in **appwrite** service in **docker-compose.yml** file. +2. If needed edit the **dev/xdebug.ini** file to your needs. +3. Launch your Appwrite instance while your debugger is listening for connections. ### VS Code Launch Configuration diff --git a/Dockerfile b/Dockerfile index 7c37d4a4f1..968b0bb22a 100755 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ ENV VITE_APPWRITE_GROWTH_ENDPOINT=$VITE_APPWRITE_GROWTH_ENDPOINT RUN npm ci RUN npm run build -FROM appwrite/base:0.4.3 as final +FROM appwrite/base:0.7.2 as final LABEL maintainer="team@appwrite.io" @@ -56,6 +56,7 @@ COPY ./public /usr/src/code/public COPY ./bin /usr/local/bin COPY ./docs /usr/src/code/docs COPY ./src /usr/src/code/src +COPY ./dev /usr/src/code/dev # Set Volumes RUN mkdir -p /storage/uploads && \ @@ -126,9 +127,10 @@ RUN chmod +x /usr/local/bin/calc-tier-stats && \ RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/ # Enable Extensions -RUN if [ "$DEBUG" == "true" ]; then printf "zend_extension=yasd \nyasd.debug_mode=remote \nyasd.init_file=/usr/src/code/dev/yasd_init.php \nyasd.remote_port=9005 \nyasd.log_level=-1" >> /usr/local/etc/php/conf.d/yasd.ini; fi - +RUN if [ "$DEBUG" == "true" ]; then cp /usr/src/code/dev/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini; fi RUN if [ "$DEBUG" == "true" ]; then echo "opcache.enable=0" >> /usr/local/etc/php/conf.d/appwrite.ini; fi +RUN if [ "$DEBUG" = "false" ]; then rm -rf /usr/src/code/dev; fi +RUN if [ "$DEBUG" = "false" ]; then rm -f /usr/local/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so; fi RUN echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/appwrite.ini RUN echo "opcache.preload=/usr/src/code/app/preload.php" >> /usr/local/etc/php/conf.d/appwrite.ini RUN echo "opcache.enable_cli=1" >> /usr/local/etc/php/conf.d/appwrite.ini diff --git a/app/config/collections.php b/app/config/collections.php index 96e7cd7b25..59050b9b47 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -1573,17 +1573,6 @@ $commonCollections = [ 'array' => false, 'filters' => [], ], - [ - '$id' => ID::custom('description'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => 256, - 'signed' => true, - 'required' => false, - 'default' => '', - 'array' => false, - 'filters' => [], - ], [ '$id' => ID::custom('status'), 'type' => Database::VAR_STRING, @@ -1744,17 +1733,6 @@ $commonCollections = [ 'array' => false, 'filters' => [], ], - [ - '$id' => ID::custom('description'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => 2048, - 'signed' => true, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => [], - ], [ '$id' => ID::custom('total'), 'type' => Database::VAR_INTEGER, diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index 52b2f0c735..1c5d1ae34a 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -521,7 +521,7 @@ App::get('/v1/avatars/initials') // if there is no space, try to split by `_` underscore $words = (count($words) == 1) ? \explode('_', \strtoupper($name)) : $words; - $initials = null; + $initials = ''; $code = 0; foreach ($words as $key => $w) { diff --git a/app/controllers/api/messaging.php b/app/controllers/api/messaging.php index efbf8431d7..1b18aa48f0 100644 --- a/app/controllers/api/messaging.php +++ b/app/controllers/api/messaging.php @@ -1908,17 +1908,15 @@ App::post('/v1/messaging/topics') ->label('sdk.response.model', Response::MODEL_TOPIC) ->param('topicId', '', new CustomId(), 'Topic ID. Choose a custom Topic ID or a new Topic ID.') ->param('name', '', new Text(128), 'Topic Name.') - ->param('description', '', new Text(2048), 'Topic Description.', true) ->inject('queueForEvents') ->inject('dbForProject') ->inject('response') - ->action(function (string $topicId, string $name, string $description, Event $queueForEvents, Database $dbForProject, Response $response) { + ->action(function (string $topicId, string $name, Event $queueForEvents, Database $dbForProject, Response $response) { $topicId = $topicId == 'unique()' ? ID::unique() : $topicId; $topic = new Document([ '$id' => $topicId, 'name' => $name, - 'description' => $description ]); try { @@ -2105,11 +2103,10 @@ App::patch('/v1/messaging/topics/:topicId') ->label('sdk.response.model', Response::MODEL_TOPIC) ->param('topicId', '', new UID(), 'Topic ID.') ->param('name', '', new Text(128), 'Topic Name.', true) - ->param('description', '', new Text(2048), 'Topic Description.', true) ->inject('queueForEvents') ->inject('dbForProject') ->inject('response') - ->action(function (string $topicId, string $name, string $description, Event $queueForEvents, Database $dbForProject, Response $response) { + ->action(function (string $topicId, string $name, Event $queueForEvents, Database $dbForProject, Response $response) { $topic = $dbForProject->getDocument('topics', $topicId); if ($topic->isEmpty()) { @@ -2120,10 +2117,6 @@ App::patch('/v1/messaging/topics/:topicId') $topic->setAttribute('name', $name); } - if (!empty($description)) { - $topic->setAttribute('description', $description); - } - $topic = $dbForProject->updateDocument('topics', $topicId, $topic); $queueForEvents @@ -2508,7 +2501,6 @@ App::post('/v1/messaging/messages/email') ->param('targets', [], new ArrayList(new UID()), 'List of Targets IDs.', true) ->param('cc', [], new ArrayList(new UID()), 'Array of target IDs to be added as CC.', true) ->param('bcc', [], new ArrayList(new UID()), 'Array of target IDs to be added as BCC.', true) - ->param('description', '', new Text(256), 'Description for message.', true) ->param('status', MessageStatus::DRAFT, new WhiteList([MessageStatus::DRAFT, MessageStatus::SCHEDULED, MessageStatus::PROCESSING]), 'Message Status. Value must be one of: ' . implode(', ', [MessageStatus::DRAFT, MessageStatus::SCHEDULED, MessageStatus::PROCESSING]) . '.', true) ->param('html', false, new Boolean(), 'Is content of type HTML', true) ->param('scheduledAt', null, new DatetimeValidator(requireDateInFuture: true), 'Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.', true) @@ -2518,7 +2510,7 @@ App::post('/v1/messaging/messages/email') ->inject('project') ->inject('queueForMessaging') ->inject('response') - ->action(function (string $messageId, string $subject, string $content, array $topics, array $users, array $targets, array $cc, array $bcc, string $description, string $status, bool $html, ?string $scheduledAt, Event $queueForEvents, Database $dbForProject, Database $dbForConsole, Document $project, Messaging $queueForMessaging, Response $response) { + ->action(function (string $messageId, string $subject, string $content, array $topics, array $users, array $targets, array $cc, array $bcc, string $status, bool $html, ?string $scheduledAt, Event $queueForEvents, Database $dbForProject, Database $dbForConsole, Document $project, Messaging $queueForMessaging, Response $response) { $messageId = $messageId == 'unique()' ? ID::unique() : $messageId; @@ -2557,7 +2549,6 @@ App::post('/v1/messaging/messages/email') 'topics' => $topics, 'users' => $users, 'targets' => $targets, - 'description' => $description, 'scheduledAt' => $scheduledAt, 'data' => [ 'subject' => $subject, @@ -2627,7 +2618,6 @@ App::post('/v1/messaging/messages/sms') ->param('topics', [], new ArrayList(new UID()), 'List of Topic IDs.', true) ->param('users', [], new ArrayList(new UID()), 'List of User IDs.', true) ->param('targets', [], new ArrayList(new UID()), 'List of Targets IDs.', true) - ->param('description', '', new Text(256), 'Description for Message.', true) ->param('status', MessageStatus::DRAFT, new WhiteList([MessageStatus::DRAFT, MessageStatus::SCHEDULED, MessageStatus::PROCESSING]), 'Message Status. Value must be one of: ' . implode(', ', [MessageStatus::DRAFT, MessageStatus::SCHEDULED, MessageStatus::PROCESSING]) . '.', true) ->param('scheduledAt', null, new DatetimeValidator(requireDateInFuture: true), 'Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.', true) ->inject('queueForEvents') @@ -2636,7 +2626,7 @@ App::post('/v1/messaging/messages/sms') ->inject('project') ->inject('queueForMessaging') ->inject('response') - ->action(function (string $messageId, string $content, array $topics, array $users, array $targets, string $description, string $status, ?string $scheduledAt, Event $queueForEvents, Database $dbForProject, Database $dbForConsole, Document $project, Messaging $queueForMessaging, Response $response) { + ->action(function (string $messageId, string $content, array $topics, array $users, array $targets, string $status, ?string $scheduledAt, Event $queueForEvents, Database $dbForProject, Database $dbForConsole, Document $project, Messaging $queueForMessaging, Response $response) { $messageId = $messageId == 'unique()' ? ID::unique() : $messageId; @@ -2673,7 +2663,6 @@ App::post('/v1/messaging/messages/sms') 'topics' => $topics, 'users' => $users, 'targets' => $targets, - 'description' => $description, 'data' => [ 'content' => $content, ], @@ -2739,7 +2728,6 @@ App::post('/v1/messaging/messages/push') ->param('topics', [], new ArrayList(new UID()), 'List of Topic IDs.', true) ->param('users', [], new ArrayList(new UID()), 'List of User IDs.', true) ->param('targets', [], new ArrayList(new UID()), 'List of Targets IDs.', true) - ->param('description', '', new Text(256), 'Description for Message.', true) ->param('data', null, new JSON(), 'Additional Data for push notification.', true) ->param('action', '', new Text(256), 'Action for push notification.', true) ->param('icon', '', new Text(256), 'Icon for push notification. Available only for Android and Web Platform.', true) @@ -2755,7 +2743,7 @@ App::post('/v1/messaging/messages/push') ->inject('project') ->inject('queueForMessaging') ->inject('response') - ->action(function (string $messageId, string $title, string $body, array $topics, array $users, array $targets, string $description, ?array $data, string $action, string $icon, string $sound, string $color, string $tag, string $badge, string $status, ?string $scheduledAt, Event $queueForEvents, Database $dbForProject, Database $dbForConsole, Document $project, Messaging $queueForMessaging, Response $response) { + ->action(function (string $messageId, string $title, string $body, array $topics, array $users, array $targets, ?array $data, string $action, string $icon, string $sound, string $color, string $tag, string $badge, string $status, ?string $scheduledAt, Event $queueForEvents, Database $dbForProject, Database $dbForConsole, Document $project, Messaging $queueForMessaging, Response $response) { $messageId = $messageId == 'unique()' ? ID::unique() : $messageId; @@ -2802,7 +2790,6 @@ App::post('/v1/messaging/messages/push') 'topics' => $topics, 'users' => $users, 'targets' => $targets, - 'description' => $description, 'scheduledAt' => $scheduledAt, 'data' => $pushData, 'status' => $status, @@ -3076,7 +3063,6 @@ App::patch('/v1/messaging/messages/email/:messageId') ->param('users', null, new ArrayList(new UID()), 'List of User IDs.', true) ->param('targets', null, new ArrayList(new UID()), 'List of Targets IDs.', true) ->param('subject', null, new Text(998), 'Email Subject.', true) - ->param('description', null, new Text(256), 'Description for Message.', true) ->param('content', null, new Text(64230), 'Email Content.', true) ->param('status', MessageStatus::DRAFT, new WhiteList([MessageStatus::DRAFT, MessageStatus::SCHEDULED, MessageStatus::PROCESSING]), 'Message Status. Value must be one of: ' . implode(', ', [MessageStatus::DRAFT, MessageStatus::SCHEDULED, MessageStatus::PROCESSING]) . '.', true) ->param('html', null, new Boolean(), 'Is content of type HTML', true) @@ -3089,7 +3075,7 @@ App::patch('/v1/messaging/messages/email/:messageId') ->inject('project') ->inject('queueForMessaging') ->inject('response') - ->action(function (string $messageId, ?array $topics, ?array $users, ?array $targets, ?string $subject, ?string $description, ?string $content, ?string $status, ?bool $html, ?array $cc, ?array $bcc, ?string $scheduledAt, Event $queueForEvents, Database $dbForProject, Database $dbForConsole, Document $project, Messaging $queueForMessaging, Response $response) { + ->action(function (string $messageId, ?array $topics, ?array $users, ?array $targets, ?string $subject, ?string $content, ?string $status, ?bool $html, ?array $cc, ?array $bcc, ?string $scheduledAt, Event $queueForEvents, Database $dbForProject, Database $dbForConsole, Document $project, Messaging $queueForMessaging, Response $response) { $message = $dbForProject->getDocument('messages', $messageId); if ($message->isEmpty()) { @@ -3140,10 +3126,6 @@ App::patch('/v1/messaging/messages/email/:messageId') $message->setAttribute('data', $data); - if (!\is_null($description)) { - $message->setAttribute('description', $description); - } - if (!\is_null($status)) { $message->setAttribute('status', $status); } @@ -3214,7 +3196,6 @@ App::patch('/v1/messaging/messages/sms/:messageId') ->param('topics', null, new ArrayList(new UID()), 'List of Topic IDs.', true) ->param('users', null, new ArrayList(new UID()), 'List of User IDs.', true) ->param('targets', null, new ArrayList(new UID()), 'List of Targets IDs.', true) - ->param('description', null, new Text(256), 'Description for Message.', true) ->param('content', null, new Text(64230), 'Email Content.', true) ->param('status', null, new WhiteList(['draft', 'cancelled', 'processing']), 'Message Status. Value must be either draft or cancelled or processing.', true) ->param('scheduledAt', null, new DatetimeValidator(requireDateInFuture: true), 'Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.', true) @@ -3224,7 +3205,7 @@ App::patch('/v1/messaging/messages/sms/:messageId') ->inject('project') ->inject('queueForMessaging') ->inject('response') - ->action(function (string $messageId, ?array $topics, ?array $users, ?array $targets, ?string $description, ?string $content, ?string $status, ?string $scheduledAt, Event $queueForEvents, Database $dbForProject, Database $dbForConsole, Document $project, Messaging $queueForMessaging, Response $response) { + ->action(function (string $messageId, ?array $topics, ?array $users, ?array $targets, ?string $content, ?string $status, ?string $scheduledAt, Event $queueForEvents, Database $dbForProject, Database $dbForConsole, Document $project, Messaging $queueForMessaging, Response $response) { $message = $dbForProject->getDocument('messages', $messageId); if ($message->isEmpty()) { @@ -3263,10 +3244,6 @@ App::patch('/v1/messaging/messages/sms/:messageId') $message->setAttribute('status', $status); } - if (!\is_null($description)) { - $message->setAttribute('description', $description); - } - if (!\is_null($scheduledAt)) { if (\is_null($message->getAttribute(('scheduleId')))) { $schedule = $dbForConsole->createDocument('schedules', new Document([ @@ -3333,7 +3310,6 @@ App::patch('/v1/messaging/messages/push/:messageId') ->param('topics', null, new ArrayList(new UID()), 'List of Topic IDs.', true) ->param('users', null, new ArrayList(new UID()), 'List of User IDs.', true) ->param('targets', null, new ArrayList(new UID()), 'List of Targets IDs.', true) - ->param('description', null, new Text(256), 'Description for Message.', true) ->param('title', null, new Text(256), 'Title for push notification.', true) ->param('body', null, new Text(64230), 'Body for push notification.', true) ->param('data', null, new JSON(), 'Additional Data for push notification.', true) @@ -3351,7 +3327,7 @@ App::patch('/v1/messaging/messages/push/:messageId') ->inject('project') ->inject('queueForMessaging') ->inject('response') - ->action(function (string $messageId, ?array $topics, ?array $users, ?array $targets, ?string $description, ?string $title, ?string $body, ?array $data, ?string $action, ?string $icon, ?string $sound, ?string $color, ?string $tag, ?int $badge, ?string $status, ?string $scheduledAt, Event $queueForEvents, Database $dbForProject, Database $dbForConsole, Document $project, Messaging $queueForMessaging, Response $response) { + ->action(function (string $messageId, ?array $topics, ?array $users, ?array $targets, ?string $title, ?string $body, ?array $data, ?string $action, ?string $icon, ?string $sound, ?string $color, ?string $tag, ?int $badge, ?string $status, ?string $scheduledAt, Event $queueForEvents, Database $dbForProject, Database $dbForConsole, Document $project, Messaging $queueForMessaging, Response $response) { $message = $dbForProject->getDocument('messages', $messageId); if ($message->isEmpty()) { @@ -3422,10 +3398,6 @@ App::patch('/v1/messaging/messages/push/:messageId') $message->setAttribute('status', $status); } - if (!\is_null($description)) { - $message->setAttribute('description', $description); - } - if (!\is_null($scheduledAt)) { if (\is_null($message->getAttribute(('scheduleId')))) { $schedule = $dbForConsole->createDocument('schedules', new Document([ diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index eb0685d3ee..fc5d00dfd0 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -963,7 +963,11 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview') break; } - $image = new Image($source); + try { + $image = new Image($source); + } catch (ImagickException $e) { + throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED, $e->getMessage()); + } $image->crop((int) $width, (int) $height, $gravity); diff --git a/app/controllers/general.php b/app/controllers/general.php index dbcb3ea55d..50505bbf9f 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -739,7 +739,7 @@ App::error() 'code' => $code, 'file' => $file, 'line' => $line, - 'trace' => $trace, + 'trace' => \json_encode($trace, JSON_UNESCAPED_UNICODE) === false ? [] : $trace, // check for failing encode 'version' => $version, 'type' => $type, ] : [ diff --git a/composer.json b/composer.json index 7f5e849301..b6951e9a43 100644 --- a/composer.json +++ b/composer.json @@ -51,9 +51,9 @@ "utopia-php/config": "0.2.*", "utopia-php/database": "0.48.*", "utopia-php/domains": "0.5.*", - "utopia-php/dsn": "0.1.*", + "utopia-php/dsn": "0.2.*", "utopia-php/framework": "0.33.*", - "utopia-php/image": "0.5.*", + "utopia-php/image": "0.6.*", "utopia-php/locale": "0.4.*", "utopia-php/logger": "0.3.*", "utopia-php/messaging": "0.9.*", @@ -74,7 +74,7 @@ "chillerlan/php-qrcode": "4.3.4", "adhocore/jwt": "1.1.2", "webonyx/graphql-php": "14.11.*", - "league/csv": "9.7.1" + "league/csv": "^9.14" }, "repositories": [ { @@ -96,7 +96,7 @@ }, "config": { "platform": { - "php": "8.0" + "php": "8.2" } } } diff --git a/composer.lock b/composer.lock index 0fd00fa43f..aa249007a4 100644 --- a/composer.lock +++ b/composer.lock @@ -463,34 +463,39 @@ }, { "name": "league/csv", - "version": "9.7.1", + "version": "9.14.0", "source": { "type": "git", "url": "https://github.com/thephpleague/csv.git", - "reference": "0ec57e8264ec92565974ead0d1724cf1026e10c1" + "reference": "34bf0df7340b60824b9449b5c526fcc3325070d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/0ec57e8264ec92565974ead0d1724cf1026e10c1", - "reference": "0ec57e8264ec92565974ead0d1724cf1026e10c1", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/34bf0df7340b60824b9449b5c526fcc3325070d5", + "reference": "34bf0df7340b60824b9449b5c526fcc3325070d5", "shasum": "" }, "require": { + "ext-filter": "*", "ext-json": "*", "ext-mbstring": "*", - "php": "^7.3 || ^8.0" + "php": "^8.1.2" }, "require-dev": { - "ext-curl": "*", + "doctrine/collections": "^2.1.4", "ext-dom": "*", - "friendsofphp/php-cs-fixer": "^2.16", - "phpstan/phpstan": "^0.12.0", - "phpstan/phpstan-phpunit": "^0.12.0", - "phpstan/phpstan-strict-rules": "^0.12.0", - "phpunit/phpunit": "^9.5" + "ext-xdebug": "*", + "friendsofphp/php-cs-fixer": "^v3.22.0", + "phpbench/phpbench": "^1.2.15", + "phpstan/phpstan": "^1.10.50", + "phpstan/phpstan-deprecation-rules": "^1.1.4", + "phpstan/phpstan-phpunit": "^1.3.15", + "phpstan/phpstan-strict-rules": "^1.5.2", + "phpunit/phpunit": "^10.5.3", + "symfony/var-dumper": "^6.4.0" }, "suggest": { - "ext-dom": "Required to use the XMLConverter and or the HTMLConverter classes", + "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes", "ext-iconv": "Needed to ease transcoding CSV using iconv stream filters" }, "type": "library", @@ -520,7 +525,7 @@ } ], "description": "CSV data manipulation made easy in PHP", - "homepage": "http://csv.thephpleague.com", + "homepage": "https://csv.thephpleague.com", "keywords": [ "convert", "csv", @@ -543,7 +548,7 @@ "type": "github" } ], - "time": "2021-04-17T16:32:08+00:00" + "time": "2023-12-29T07:34:53+00:00" }, { "name": "matomo/device-detector", @@ -1306,16 +1311,16 @@ }, { "name": "utopia-php/dsn", - "version": "0.1.0", + "version": "0.2.0", "source": { "type": "git", "url": "https://github.com/utopia-php/dsn.git", - "reference": "17a5935eab1b89fb4b95600db50a1b6d5faa6cea" + "reference": "c11f37a12c3f6aaf9fea97ca7cb363dcc93668d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/dsn/zipball/17a5935eab1b89fb4b95600db50a1b6d5faa6cea", - "reference": "17a5935eab1b89fb4b95600db50a1b6d5faa6cea", + "url": "https://api.github.com/repos/utopia-php/dsn/zipball/c11f37a12c3f6aaf9fea97ca7cb363dcc93668d7", + "reference": "c11f37a12c3f6aaf9fea97ca7cb363dcc93668d7", "shasum": "" }, "require": { @@ -1347,9 +1352,9 @@ ], "support": { "issues": "https://github.com/utopia-php/dsn/issues", - "source": "https://github.com/utopia-php/dsn/tree/0.1.0" + "source": "https://github.com/utopia-php/dsn/tree/0.2.0" }, - "time": "2022-10-26T10:06:20+00:00" + "time": "2023-11-02T12:01:43+00:00" }, { "name": "utopia-php/framework", @@ -1398,16 +1403,16 @@ }, { "name": "utopia-php/image", - "version": "0.5.4", + "version": "0.6.0", "source": { "type": "git", "url": "https://github.com/utopia-php/image.git", - "reference": "ca5f436f9aa22dedaa6648f24f3687733808e336" + "reference": "88f7209172bdabd81e76ac981c95fac117dc6e08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/image/zipball/ca5f436f9aa22dedaa6648f24f3687733808e336", - "reference": "ca5f436f9aa22dedaa6648f24f3687733808e336", + "url": "https://api.github.com/repos/utopia-php/image/zipball/88f7209172bdabd81e76ac981c95fac117dc6e08", + "reference": "88f7209172bdabd81e76ac981c95fac117dc6e08", "shasum": "" }, "require": { @@ -1415,6 +1420,8 @@ "php": ">=8.0" }, "require-dev": { + "laravel/pint": "1.2.*", + "phpstan/phpstan": "1.9.x-dev", "phpunit/phpunit": "^9.3", "vimeo/psalm": "4.13.1" }, @@ -1428,12 +1435,6 @@ "license": [ "MIT" ], - "authors": [ - { - "name": "Eldad Fux", - "email": "eldad@appwrite.io" - } - ], "description": "A simple Image manipulation library", "keywords": [ "framework", @@ -1444,9 +1445,9 @@ ], "support": { "issues": "https://github.com/utopia-php/image/issues", - "source": "https://github.com/utopia-php/image/tree/0.5.4" + "source": "https://github.com/utopia-php/image/tree/0.6.0" }, - "time": "2022-05-11T12:30:41+00:00" + "time": "2024-01-24T06:59:44+00:00" }, { "name": "utopia-php/locale", @@ -5172,7 +5173,7 @@ "ext-fileinfo": "*" }, "platform-overrides": { - "php": "8.0" + "php": "8.2" }, "plugin-api-version": "2.6.0" } diff --git a/dev/xdebug.ini b/dev/xdebug.ini new file mode 100644 index 0000000000..e29c8bd46e --- /dev/null +++ b/dev/xdebug.ini @@ -0,0 +1,6 @@ +zend_extension=xdebug + +[xdebug] +xdebug.mode=develop,debug +xdebug.client_host=host.docker.internal +xdebug.start_with_request=yes \ No newline at end of file diff --git a/dev/yasd_init.php.stub b/dev/yasd_init.php.stub deleted file mode 100644 index efcc37c0b5..0000000000 --- a/dev/yasd_init.php.stub +++ /dev/null @@ -1,4 +0,0 @@ -strict) { $password = strtolower($password); - $this->userId = strtolower($this->userId); - $this->email = strtolower($this->email); - $this->name = strtolower($this->name); - $this->phone = strtolower($this->phone); + $this->userId = strtolower($this->userId ?? ''); + $this->email = strtolower($this->email ?? ''); + $this->name = strtolower($this->name ?? ''); + $this->phone = strtolower($this->phone ?? ''); } if ($this->userId && strpos($password, $this->userId) !== false) { diff --git a/tests/e2e/Services/GraphQL/AvatarsTest.php b/tests/e2e/Services/GraphQL/AvatarsTest.php index b95e3b251f..9f3fa7a3bb 100644 --- a/tests/e2e/Services/GraphQL/AvatarsTest.php +++ b/tests/e2e/Services/GraphQL/AvatarsTest.php @@ -29,7 +29,7 @@ class AvatarsTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $graphQLPayload); - $this->assertEquals(18767, \strlen($creditCardIcon['body'])); + $this->assertEquals(18546, \strlen($creditCardIcon['body'])); return $creditCardIcon['body']; } @@ -50,7 +50,7 @@ class AvatarsTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $graphQLPayload); - $this->assertEquals(11100, \strlen($browserIcon['body'])); + $this->assertEquals(13312, \strlen($browserIcon['body'])); return $browserIcon['body']; } @@ -71,7 +71,7 @@ class AvatarsTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $graphQLPayload); - $this->assertEquals(7460, \strlen($countryFlag['body'])); + $this->assertEquals(8814, \strlen($countryFlag['body'])); return $countryFlag['body']; } @@ -92,7 +92,7 @@ class AvatarsTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $graphQLPayload); - $this->assertEquals(36036, \strlen($image['body'])); + $this->assertEquals(52585, \strlen($image['body'])); return $image['body']; } @@ -134,7 +134,7 @@ class AvatarsTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $graphQLPayload); - $this->assertEquals(14771, \strlen($qrCode['body'])); + $this->assertEquals(29428, \strlen($qrCode['body'])); return $qrCode['body']; } @@ -155,7 +155,7 @@ class AvatarsTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $graphQLPayload); - $this->assertEquals(5041, \strlen($initials['body'])); + $this->assertEquals(5025, \strlen($initials['body'])); return $initials['body']; } diff --git a/tests/e2e/Services/GraphQL/Base.php b/tests/e2e/Services/GraphQL/Base.php index 2597047bf3..0396895749 100644 --- a/tests/e2e/Services/GraphQL/Base.php +++ b/tests/e2e/Services/GraphQL/Base.php @@ -2022,11 +2022,10 @@ trait Base } }'; case self::$CREATE_TOPIC: - return 'mutation createTopic($topicId: String!, $name: String!, $description: String!) { - messagingCreateTopic(topicId: $topicId, name: $name, description: $description) { + return 'mutation createTopic($topicId: String!, $name: String!) { + messagingCreateTopic(topicId: $topicId, name: $name) { _id name - description } }'; case self::$LIST_TOPICS: @@ -2036,7 +2035,6 @@ trait Base topics { _id name - description } } }'; @@ -2045,15 +2043,13 @@ trait Base messagingGetTopic(topicId: $topicId) { _id name - description } }'; case self::$UPDATE_TOPIC: - return 'mutation updateTopic($topicId: String!, $name: String!, $description: String!) { - messagingUpdateTopic(topicId: $topicId, name: $name, description: $description) { + return 'mutation updateTopic($topicId: String!, $name: String!) { + messagingUpdateTopic(topicId: $topicId, name: $name) { _id name - description } }'; case self::$DELETE_TOPIC: @@ -2120,8 +2116,8 @@ trait Base } }'; case self::$CREATE_EMAIL: - return 'mutation createEmail($messageId: String!, $topics: [String!], $users: [String!], $targets: [String!], $subject: String!, $content: String!, $status: String, $description: String, $html: Boolean, $cc: [String], $bcc: [String], $scheduledAt: String) { - messagingCreateEmail(messageId: $messageId, topics: $topics, users: $users, targets: $targets, subject: $subject, content: $content, status: $status, description: $description, html: $html, cc: $cc, bcc: $bcc, scheduledAt: $scheduledAt) { + return 'mutation createEmail($messageId: String!, $topics: [String!], $users: [String!], $targets: [String!], $subject: String!, $content: String!, $status: String, $html: Boolean, $cc: [String], $bcc: [String], $scheduledAt: String) { + messagingCreateEmail(messageId: $messageId, topics: $topics, users: $users, targets: $targets, subject: $subject, content: $content, status: $status, html: $html, cc: $cc, bcc: $bcc, scheduledAt: $scheduledAt) { _id topics users @@ -2131,12 +2127,11 @@ trait Base deliveryErrors deliveredTotal status - description } }'; case self::$CREATE_SMS: - return 'mutation createSMS($messageId: String!, $topics: [String!], $users: [String!], $targets: [String!], $content: String!, $status: String, $description: String, $scheduledAt: String) { - messagingCreateSMS(messageId: $messageId, topics: $topics, users: $users, targets: $targets, content: $content, status: $status, description: $description, scheduledAt: $scheduledAt) { + return 'mutation createSMS($messageId: String!, $topics: [String!], $users: [String!], $targets: [String!], $content: String!, $status: String, $scheduledAt: String) { + messagingCreateSMS(messageId: $messageId, topics: $topics, users: $users, targets: $targets, content: $content, status: $status, scheduledAt: $scheduledAt) { _id topics users @@ -2146,12 +2141,11 @@ trait Base deliveryErrors deliveredTotal status - description } }'; case self::$CREATE_PUSH_NOTIFICATION: - return 'mutation createPushNotification($messageId: String!, $topics: [String!], $users: [String!], $targets: [String!], $title: String!, $body: String!, $data: Json, $action: String, $icon: String, $sound: String, $color: String, $tag: String, $badge: String, $status: String, $description: String, $scheduledAt: String) { - messagingCreatePushNotification(messageId: $messageId, topics: $topics, users: $users, targets: $targets, title: $title, body: $body, data: $data, action: $action, icon: $icon, sound: $sound, color: $color, tag: $tag, badge: $badge, status: $status, description: $description, scheduledAt: $scheduledAt) { + return 'mutation createPushNotification($messageId: String!, $topics: [String!], $users: [String!], $targets: [String!], $title: String!, $body: String!, $data: Json, $action: String, $icon: String, $sound: String, $color: String, $tag: String, $badge: String, $status: String, $scheduledAt: String) { + messagingCreatePushNotification(messageId: $messageId, topics: $topics, users: $users, targets: $targets, title: $title, body: $body, data: $data, action: $action, icon: $icon, sound: $sound, color: $color, tag: $tag, badge: $badge, status: $status, scheduledAt: $scheduledAt) { _id topics users @@ -2161,7 +2155,6 @@ trait Base deliveryErrors deliveredTotal status - description } }'; case self::$LIST_MESSAGES: @@ -2179,7 +2172,6 @@ trait Base deliveryErrors deliveredTotal status - description } } }'; @@ -2196,12 +2188,11 @@ trait Base deliveryErrors deliveredTotal status - description } }'; case self::$UPDATE_EMAIL: - return 'mutation updateEmail($messageId: String!, $topics: [String!], $users: [String!], $targets: [String!], $subject: String, $content: String, $status: String, $description: String, $html: Boolean, $cc: [String], $bcc: [String], $scheduledAt: String) { - messagingUpdateEmail(messageId: $messageId, topics: $topics, users: $users, targets: $targets, subject: $subject, content: $content, status: $status, description: $description, html: $html, cc: $cc, bcc: $bcc, scheduledAt: $scheduledAt) { + return 'mutation updateEmail($messageId: String!, $topics: [String!], $users: [String!], $targets: [String!], $subject: String, $content: String, $status: String, , $html: Boolean, $cc: [String], $bcc: [String], $scheduledAt: String) { + messagingUpdateEmail(messageId: $messageId, topics: $topics, users: $users, targets: $targets, subject: $subject, content: $content, status: $status, html: $html, cc: $cc, bcc: $bcc, scheduledAt: $scheduledAt) { _id topics users @@ -2211,12 +2202,11 @@ trait Base deliveryErrors deliveredTotal status - description } }'; case self::$UPDATE_SMS: - return 'mutation updateSMS($messageId: String!, $topics: [String!], $users: [String!], $targets: [String!], $content: String, $status: String, $description: String, $scheduledAt: String) { - messagingUpdateSMS(messageId: $messageId, topics: $topics, users: $users, targets: $targets, content: $content, status: $status, description: $description, scheduledAt: $scheduledAt) { + return 'mutation updateSMS($messageId: String!, $topics: [String!], $users: [String!], $targets: [String!], $content: String, $status: String, $scheduledAt: String) { + messagingUpdateSMS(messageId: $messageId, topics: $topics, users: $users, targets: $targets, content: $content, status: $status, scheduledAt: $scheduledAt) { _id topics users @@ -2226,12 +2216,11 @@ trait Base deliveryErrors deliveredTotal status - description } }'; case self::$UPDATE_PUSH_NOTIFICATION: - return 'mutation updatePushNotification($messageId: String!, $topics: [String!], $users: [String!], $targets: [String!], $title: String, $body: String, $data: Json, $action: String, $icon: String, $sound: String, $color: String, $tag: String, $badge: String, $status: String, $description: String, $scheduledAt: String) { - messagingUpdatePushNotification(messageId: $messageId, topics: $topics, users: $users, targets: $targets, title: $title, body: $body, data: $data, action: $action, icon: $icon, sound: $sound, color: $color, tag: $tag, badge: $badge, status: $status, description: $description, scheduledAt: $scheduledAt) { + return 'mutation updatePushNotification($messageId: String!, $topics: [String!], $users: [String!], $targets: [String!], $title: String, $body: String, $data: Json, $action: String, $icon: String, $sound: String, $color: String, $tag: String, $badge: String, $status: String, $scheduledAt: String) { + messagingUpdatePushNotification(messageId: $messageId, topics: $topics, users: $users, targets: $targets, title: $title, body: $body, data: $data, action: $action, icon: $icon, sound: $sound, color: $color, tag: $tag, badge: $badge, status: $status, scheduledAt: $scheduledAt) { _id topics users @@ -2241,7 +2230,6 @@ trait Base deliveryErrors deliveredTotal status - description } }'; case self::$COMPLEX_QUERY: diff --git a/tests/e2e/Services/GraphQL/MessagingTest.php b/tests/e2e/Services/GraphQL/MessagingTest.php index 40134c2217..dba655b558 100644 --- a/tests/e2e/Services/GraphQL/MessagingTest.php +++ b/tests/e2e/Services/GraphQL/MessagingTest.php @@ -285,7 +285,6 @@ class MessagingTest extends Scope 'variables' => [ 'topicId' => ID::unique(), 'name' => 'topic1', - 'description' => 'Active users', ], ]; $response = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([ @@ -296,7 +295,6 @@ class MessagingTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals('topic1', $response['body']['data']['messagingCreateTopic']['name']); - $this->assertEquals('Active users', $response['body']['data']['messagingCreateTopic']['description']); return $response['body']['data']['messagingCreateTopic']; } @@ -313,7 +311,6 @@ class MessagingTest extends Scope 'variables' => [ 'topicId' => $topicId, 'name' => 'topic2', - 'description' => 'Inactive users', ], ]; $response = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([ @@ -324,7 +321,6 @@ class MessagingTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals('topic2', $response['body']['data']['messagingUpdateTopic']['name']); - $this->assertEquals('Inactive users', $response['body']['data']['messagingUpdateTopic']['description']); return $topicId; } @@ -368,7 +364,6 @@ class MessagingTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals('topic2', $response['body']['data']['messagingGetTopic']['name']); - $this->assertEquals('Inactive users', $response['body']['data']['messagingGetTopic']['description']); } /** @@ -594,7 +589,6 @@ class MessagingTest extends Scope 'variables' => [ 'topicId' => ID::unique(), 'name' => 'topic1', - 'description' => 'Active users', ], ]; $topic = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([ @@ -801,7 +795,6 @@ class MessagingTest extends Scope 'variables' => [ 'topicId' => ID::unique(), 'name' => 'topic1', - 'description' => 'Active users', ], ]; $topic = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([ @@ -1006,7 +999,6 @@ class MessagingTest extends Scope 'variables' => [ 'topicId' => ID::unique(), 'name' => 'topic1', - 'description' => 'Active users', ], ]; $topic = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([ diff --git a/tests/e2e/Services/GraphQL/ScopeTest.php b/tests/e2e/Services/GraphQL/ScopeTest.php index a8b5b7cea4..ebf535268e 100644 --- a/tests/e2e/Services/GraphQL/ScopeTest.php +++ b/tests/e2e/Services/GraphQL/ScopeTest.php @@ -34,7 +34,7 @@ class ScopeTest extends Scope 'x-appwrite-key' => $apiKey, ], $gqlPayload); - $message = "app.${projectId}@service.localhost (role: applications) missing scope (databases.write)"; + $message = "app.{$projectId}@service.localhost (role: applications) missing scope (databases.write)"; $this->assertArrayHasKey('errors', $database['body']); $this->assertEquals($message, $database['body']['errors'][0]['message']); } diff --git a/tests/e2e/Services/Messaging/MessagingBase.php b/tests/e2e/Services/Messaging/MessagingBase.php index 07b8a26f60..d5ac040a75 100644 --- a/tests/e2e/Services/Messaging/MessagingBase.php +++ b/tests/e2e/Services/Messaging/MessagingBase.php @@ -289,7 +289,6 @@ trait MessagingBase ]); $this->assertEquals(201, $response['headers']['status-code']); $this->assertEquals('my-app', $response['body']['name']); - $this->assertEquals('', $response['body']['description']); return $response['body']; } @@ -305,11 +304,9 @@ trait MessagingBase 'x-appwrite-key' => $this->getProject()['apiKey'], ], [ 'name' => 'android-app', - 'description' => 'updated-description' ]); $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals('android-app', $response['body']['name']); - $this->assertEquals('updated-description', $response['body']['description']); return $response['body']['$id']; } @@ -318,17 +315,6 @@ trait MessagingBase */ public function testListTopic(string $topicId) { - $response = $this->client->call(Client::METHOD_GET, '/messaging/topics', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'], - ], [ - 'search' => 'updated-description', - ]); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(1, \count($response['body']['topics'])); - $response = $this->client->call(Client::METHOD_GET, '/messaging/topics', [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -370,7 +356,6 @@ trait MessagingBase ]); $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals('android-app', $response['body']['name']); - $this->assertEquals('updated-description', $response['body']['description']); $this->assertEquals(0, $response['body']['total']); } @@ -427,7 +412,6 @@ trait MessagingBase $this->assertEquals(200, $topic['headers']['status-code']); $this->assertEquals('android-app', $topic['body']['name']); - $this->assertEquals('updated-description', $topic['body']['description']); $this->assertEquals(1, $topic['body']['total']); return [ @@ -663,7 +647,6 @@ trait MessagingBase $this->assertEquals(200, $topic['headers']['status-code']); $this->assertEquals('android-app', $topic['body']['name']); - $this->assertEquals('updated-description', $topic['body']['description']); $this->assertEquals(0, $topic['body']['total']); } @@ -815,7 +798,6 @@ trait MessagingBase ], [ 'topicId' => ID::unique(), 'name' => 'topic1', - 'description' => 'Test Topic' ]); $this->assertEquals(201, $topic['headers']['status-code']); @@ -976,7 +958,6 @@ trait MessagingBase ], [ 'topicId' => ID::unique(), 'name' => 'topic1', - 'description' => 'Test Topic' ]); $this->assertEquals(201, $topic['headers']['status-code']); @@ -1137,7 +1118,6 @@ trait MessagingBase ], [ 'topicId' => ID::unique(), 'name' => 'topic1', - 'description' => 'Test Topic' ]); $this->assertEquals(201, $topic['headers']['status-code']); diff --git a/tests/e2e/Services/Messaging/MessagingConsoleClientTest.php b/tests/e2e/Services/Messaging/MessagingConsoleClientTest.php index 94080fcf49..1b0d840f96 100644 --- a/tests/e2e/Services/Messaging/MessagingConsoleClientTest.php +++ b/tests/e2e/Services/Messaging/MessagingConsoleClientTest.php @@ -188,7 +188,6 @@ class MessagingConsoleClientTest extends Scope ], $this->getHeaders()), [ 'topicId' => ID::unique(), 'name' => 'my-app', - 'description' => 'web app' ]); $this->assertEquals(201, $topic['headers']['status-code']); @@ -196,7 +195,7 @@ class MessagingConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'description' => 'updated-description' + 'name' => 'android-app' ]); $this->assertEquals(200, $response['headers']['status-code']); diff --git a/tests/e2e/Services/Storage/StorageBase.php b/tests/e2e/Services/Storage/StorageBase.php index a9f9260f8e..b5023a2afd 100644 --- a/tests/e2e/Services/Storage/StorageBase.php +++ b/tests/e2e/Services/Storage/StorageBase.php @@ -28,7 +28,7 @@ trait StorageBase 'name' => 'Test Bucket', 'fileSecurity' => true, 'maximumFileSize' => 2000000, //2MB - 'allowedFileExtensions' => ["jpg", "png", 'jfif'], + 'allowedFileExtensions' => ['jpg', 'png', 'jfif'], 'permissions' => [ Permission::read(Role::any()), Permission::create(Role::any()), diff --git a/tests/resources/initials.png b/tests/resources/initials.png index ea6bf729b5..3e51f228cc 100644 Binary files a/tests/resources/initials.png and b/tests/resources/initials.png differ diff --git a/tests/resources/qr/qr-default.png b/tests/resources/qr/qr-default.png index a7da496d9f..58af53bb93 100644 Binary files a/tests/resources/qr/qr-default.png and b/tests/resources/qr/qr-default.png differ diff --git a/tests/resources/qr/qr-size-200-margin-10.png b/tests/resources/qr/qr-size-200-margin-10.png index 56c59408ef..b40529396e 100644 Binary files a/tests/resources/qr/qr-size-200-margin-10.png and b/tests/resources/qr/qr-size-200-margin-10.png differ diff --git a/tests/resources/qr/qr-size-200.png b/tests/resources/qr/qr-size-200.png index 202c0cc197..a44e4861e3 100644 Binary files a/tests/resources/qr/qr-size-200.png and b/tests/resources/qr/qr-size-200.png differ