diff --git a/CHANGES.md b/CHANGES.md index 32ecd4f277..0363f28683 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +# Version 1.4.9 + +## Bug fixes + +* Fix 400 error on function domain execution in [#7059](https://github.com/appwrite/appwrite/pull/7059) + # Version 1.4.8 ## Notable changes diff --git a/README-CN.md b/README-CN.md index 3881a8ac82..4a2f9edd65 100644 --- a/README-CN.md +++ b/README-CN.md @@ -66,7 +66,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.4.8 + appwrite/appwrite:1.4.9 ``` ### Windows @@ -78,7 +78,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.4.8 + appwrite/appwrite:1.4.9 ``` #### PowerShell @@ -88,7 +88,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.4.8 + appwrite/appwrite:1.4.9 ``` 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 diff --git a/README.md b/README.md index 9adc815bdd..9b4ba2bb58 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.4.8 + appwrite/appwrite:1.4.9 ``` ### Windows @@ -88,7 +88,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.4.8 + appwrite/appwrite:1.4.9 ``` #### PowerShell @@ -98,7 +98,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.4.8 + appwrite/appwrite:1.4.9 ``` Once the Docker installation is complete, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after completing the installation. diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 8ca1371488..b1195cd878 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -352,7 +352,7 @@ App::get('/v1/health/queue/webhooks') ->inject('response') ->action(function (Connection $queue, Response $response) { $client = new Client(Event::WEBHOOK_QUEUE_NAME, $queue); - $response->dynamic(new Document([ 'size' => $client->sumProcessingJobs() ]), Response::MODEL_HEALTH_QUEUE); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); }, ['response']); App::get('/v1/health/queue/logs') @@ -370,7 +370,7 @@ App::get('/v1/health/queue/logs') ->inject('response') ->action(function (Connection $queue, Response $response) { $client = new Client(Event::AUDITS_QUEUE_NAME, $queue); - $response->dynamic(new Document([ 'size' => $client->sumProcessingJobs() ]), Response::MODEL_HEALTH_QUEUE); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); }, ['response']); App::get('/v1/health/queue/certificates') @@ -388,7 +388,7 @@ App::get('/v1/health/queue/certificates') ->inject('response') ->action(function (Connection $queue, Response $response) { $client = new Client(Event::CERTIFICATES_QUEUE_NAME, $queue); - $response->dynamic(new Document([ 'size' => $client->sumProcessingJobs() ]), Response::MODEL_HEALTH_QUEUE); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); }, ['response']); App::get('/v1/health/queue/builds') @@ -406,7 +406,7 @@ App::get('/v1/health/queue/builds') ->inject('response') ->action(function (Connection $queue, Response $response) { $client = new Client(Event::BUILDS_QUEUE_NAME, $queue); - $response->dynamic(new Document([ 'size' => $client->sumProcessingJobs() ]), Response::MODEL_HEALTH_QUEUE); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); }, ['response']); App::get('/v1/health/queue/databases') @@ -425,7 +425,7 @@ App::get('/v1/health/queue/databases') ->inject('response') ->action(function (string $name, Connection $queue, Response $response) { $client = new Client($name, $queue); - $response->dynamic(new Document([ 'size' => $client->sumProcessingJobs() ]), Response::MODEL_HEALTH_QUEUE); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); }, ['response']); App::get('/v1/health/queue/deletes') @@ -443,7 +443,7 @@ App::get('/v1/health/queue/deletes') ->inject('response') ->action(function (Connection $queue, Response $response) { $client = new Client(Event::DELETE_QUEUE_NAME, $queue); - $response->dynamic(new Document([ 'size' => $client->sumProcessingJobs() ]), Response::MODEL_HEALTH_QUEUE); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); }, ['response']); App::get('/v1/health/queue/mails') @@ -461,7 +461,7 @@ App::get('/v1/health/queue/mails') ->inject('response') ->action(function (Connection $queue, Response $response) { $client = new Client(Event::MAILS_QUEUE_NAME, $queue); - $response->dynamic(new Document([ 'size' => $client->sumProcessingJobs() ]), Response::MODEL_HEALTH_QUEUE); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); }, ['response']); App::get('/v1/health/queue/messaging') @@ -479,7 +479,7 @@ App::get('/v1/health/queue/messaging') ->inject('response') ->action(function (Connection $queue, Response $response) { $client = new Client(Event::MESSAGING_QUEUE_NAME, $queue); - $response->dynamic(new Document([ 'size' => $client->sumProcessingJobs() ]), Response::MODEL_HEALTH_QUEUE); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); }, ['response']); App::get('/v1/health/queue/migrations') @@ -497,7 +497,7 @@ App::get('/v1/health/queue/migrations') ->inject('response') ->action(function (Connection $queue, Response $response) { $client = new Client(Event::MIGRATIONS_QUEUE_NAME, $queue); - $response->dynamic(new Document([ 'size' => $client->sumProcessingJobs() ]), Response::MODEL_HEALTH_QUEUE); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); }, ['response']); App::get('/v1/health/queue/functions') @@ -515,7 +515,7 @@ App::get('/v1/health/queue/functions') ->inject('response') ->action(function (Connection $queue, Response $response) { $client = new Client(Event::FUNCTIONS_QUEUE_NAME, $queue); - $response->dynamic(new Document([ 'size' => $client->sumProcessingJobs() ]), Response::MODEL_HEALTH_QUEUE); + $response->dynamic(new Document([ 'size' => $client->getQueueSize() ]), Response::MODEL_HEALTH_QUEUE); }, ['response']); App::get('/v1/health/storage/local') diff --git a/app/controllers/general.php b/app/controllers/general.php index 247669731a..cf383b6710 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -408,7 +408,7 @@ App::init() * @see https://www.owasp.org/index.php/List_of_useful_HTTP_headers */ if (App::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled') === 'enabled') { // Force HTTPS - if ($request->getProtocol() !== 'https' && ($requestHeaders['host'] ?? '') !== 'localhost' && ($requestHeaders['host'] ?? '') !== APP_HOSTNAME_INTERNAL) { // localhost allowed for proxy, APP_HOSTNAME_INTERNAL allowed for migrations + if ($request->getProtocol() !== 'https' && ($swooleRequest->header['host'] ?? '') !== 'localhost' && ($swooleRequest->header['host'] ?? '') !== APP_HOSTNAME_INTERNAL) { // localhost allowed for proxy, APP_HOSTNAME_INTERNAL allowed for migrations if ($request->getMethod() !== Request::METHOD_GET) { throw new AppwriteException(AppwriteException::GENERAL_PROTOCOL_UNSUPPORTED, 'Method unsupported over HTTP. Please use HTTPS instead.'); } diff --git a/app/init.php b/app/init.php index 020af63761..e4b9e7573d 100644 --- a/app/init.php +++ b/app/init.php @@ -110,7 +110,7 @@ const APP_KEY_ACCCESS = 24 * 60 * 60; // 24 hours const APP_USER_ACCCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours const APP_CACHE_BUSTER = 515; -const APP_VERSION_STABLE = '1.4.8'; +const APP_VERSION_STABLE = '1.4.9'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_IP = 'ip'; diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 18f1a091c0..efa0fad8fb 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -73,6 +73,7 @@ abstract class Migration '1.4.6' => 'V19', '1.4.7' => 'V19', '1.4.8' => 'V19', + '1.4.9' => 'V19', ]; /** diff --git a/src/Appwrite/Platform/Workers/Deletes.php b/src/Appwrite/Platform/Workers/Deletes.php index 2130499257..b91ddb901a 100644 --- a/src/Appwrite/Platform/Workers/Deletes.php +++ b/src/Appwrite/Platform/Workers/Deletes.php @@ -178,7 +178,8 @@ class Deletes extends Action $project = $dbForConsole->getDocument('projects', $document->getAttribute('projectId')); if ($project->isEmpty()) { - Console::warning('Unable to delete schedule for function ' . $document->getAttribute('resourceId')); + $dbForConsole->deleteDocument('schedules', $document->getId()); + Console::success('Deleted schedule for deleted project ' . $document->getAttribute('projectId')); return; } @@ -920,17 +921,28 @@ class Deletes extends Action $count = 0; $chunk = 0; $limit = 50; + $results = []; $sum = $limit; + $cursor = null; $executionStart = \microtime(true); while ($sum === $limit) { $chunk++; - $results = $database->find($collection, \array_merge([Query::limit($limit)], $queries)); + $mergedQueries = \array_merge([Query::limit($limit)], $queries); + if ($cursor instanceof Document) { + $mergedQueries[] = Query::cursorAfter($cursor); + } + + $results = $database->find($collection, $mergedQueries); $sum = count($results); + if ($sum > 0) { + $cursor = $results[$sum - 1]; + } + foreach ($results as $document) { if (is_callable($callback)) { $callback($document); diff --git a/src/Appwrite/Utopia/Request.php b/src/Appwrite/Utopia/Request.php index a9eef62e06..cb877afad4 100644 --- a/src/Appwrite/Utopia/Request.php +++ b/src/Appwrite/Utopia/Request.php @@ -107,6 +107,10 @@ class Request extends UtopiaRequest { $headers = $this->generateHeaders(); + if (empty($this->swoole->cookie)) { + return $headers; + } + $cookieHeaders = []; foreach ($this->swoole->cookie as $key => $value) { $cookieHeaders[] = "{$key}={$value}";