1
0
Fork 0
mirror of synced 2024-09-29 17:01:37 +13:00

Merge remote-tracking branch 'origin/migrations-backups' into migrations-backups

This commit is contained in:
fogelito 2024-09-01 13:13:16 +03:00
commit ff702d774f
6 changed files with 35 additions and 21 deletions

View file

@ -1,9 +1,5 @@
<?php
const APP_PLATFORM_SERVER = 'server';
const APP_PLATFORM_CLIENT = 'client';
const APP_PLATFORM_CONSOLE = 'console';
return [
APP_PLATFORM_CLIENT => [
'key' => APP_PLATFORM_CLIENT,

View file

@ -142,6 +142,9 @@ const APP_SOCIAL_DEV = 'https://dev.to/appwrite';
const APP_SOCIAL_STACKSHARE = 'https://stackshare.io/appwrite';
const APP_SOCIAL_YOUTUBE = 'https://www.youtube.com/c/appwrite?sub_confirmation=1';
const APP_HOSTNAME_INTERNAL = 'appwrite';
const APP_PLATFORM_SERVER = 'server';
const APP_PLATFORM_CLIENT = 'client';
const APP_PLATFORM_CONSOLE = 'console';
// Database Reconnect
const DATABASE_RECONNECT_SLEEP = 2;

View file

@ -82,7 +82,7 @@
},
"require-dev": {
"ext-fileinfo": "*",
"appwrite/sdk-generator": "0.38.*",
"appwrite/sdk-generator": "0.39.*",
"phpunit/phpunit": "9.5.20",
"swoole/ide-helper": "5.1.2",
"textalk/websocket": "1.5.7",

14
composer.lock generated
View file

@ -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": "b737874b23ae7480c9579c5ee28ad46f",
"content-hash": "0e770d4489dbe657c00281b1afd3c0ee",
"packages": [
{
"name": "adhocore/jwt",
@ -3001,16 +3001,16 @@
"packages-dev": [
{
"name": "appwrite/sdk-generator",
"version": "0.38.8",
"version": "0.39.18",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "6367c57ddbcf7b88cacb900c4fe7ef3f28bf38ef"
"reference": "3f12532d3a41f6e3e7528f41c0e79a6d473c4a4c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/6367c57ddbcf7b88cacb900c4fe7ef3f28bf38ef",
"reference": "6367c57ddbcf7b88cacb900c4fe7ef3f28bf38ef",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/3f12532d3a41f6e3e7528f41c0e79a6d473c4a4c",
"reference": "3f12532d3a41f6e3e7528f41c0e79a6d473c4a4c",
"shasum": ""
},
"require": {
@ -3046,9 +3046,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/0.38.8"
"source": "https://github.com/appwrite/sdk-generator/tree/0.39.18"
},
"time": "2024-06-17T00:42:27+00:00"
"time": "2024-08-27T11:22:14+00:00"
},
{
"name": "doctrine/deprecations",

View file

@ -5,9 +5,11 @@ namespace Appwrite\Platform\Tasks;
use Appwrite\Specification\Format\OpenAPI3;
use Appwrite\Specification\Format\Swagger2;
use Appwrite\Specification\Specification;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Request as AppwriteRequest;
use Appwrite\Utopia\Response as AppwriteResponse;
use Exception;
use Swoole\Http\Response as HttpResponse;
use Swoole\Http\Request as SwooleRequest;
use Swoole\Http\Response as SwooleResponse;
use Utopia\App;
use Utopia\Cache\Adapter\None;
use Utopia\Cache\Cache;
@ -17,7 +19,8 @@ use Utopia\Database\Adapter\MySQL;
use Utopia\Database\Database;
use Utopia\Platform\Action;
use Utopia\Registry\Registry;
use Utopia\Request;
use Utopia\Request as UtopiaRequest;
use Utopia\Response as UtopiaResponse;
use Utopia\System\System;
use Utopia\Validator\Text;
use Utopia\Validator\WhiteList;
@ -29,6 +32,16 @@ class Specs extends Action
return 'specs';
}
public function getRequest(): UtopiaRequest
{
return new AppwriteRequest(new SwooleRequest());
}
public function getResponse(): UtopiaResponse
{
return new AppwriteResponse(new SwooleResponse());
}
public function __construct()
{
$this
@ -42,11 +55,11 @@ class Specs extends Action
public function action(string $version, string $mode, Registry $register): void
{
$appRoutes = App::getRoutes();
$response = new Response(new HttpResponse());
$response = $this->getResponse();
$mocks = ($mode === 'mocks');
// Mock dependencies
App::setResource('request', fn () => new Request());
App::setResource('request', fn () => $this->getRequest());
App::setResource('response', fn () => $response);
App::setResource('dbForConsole', fn () => new Database(new MySQL(''), new Cache(new None())));
App::setResource('dbForProject', fn () => new Database(new MySQL(''), new Cache(new None())));
@ -183,10 +196,8 @@ class Specs extends Action
case APP_AUTH_TYPE_SESSION:
$sdkPlatforms[] = APP_PLATFORM_CLIENT;
break;
case APP_AUTH_TYPE_KEY:
$sdkPlatforms[] = APP_PLATFORM_SERVER;
break;
case APP_AUTH_TYPE_JWT:
case APP_AUTH_TYPE_KEY:
$sdkPlatforms[] = APP_PLATFORM_SERVER;
break;
case APP_AUTH_TYPE_ADMIN:

View file

@ -122,7 +122,11 @@ class Request extends UtopiaRequest
*/
public function getHeaders(): array
{
$headers = $this->generateHeaders();
try {
$headers = $this->generateHeaders();
} catch (\Throwable) {
$headers = [];
}
if (empty($this->swoole->cookie)) {
return $headers;