Merge branch '1.9.x' into feat/migrate-di-container

This commit is contained in:
Chirag Aggarwal
2026-04-05 21:16:30 +05:30
committed by GitHub
8 changed files with 64 additions and 12 deletions
+5 -1
View File
@@ -325,17 +325,20 @@ $container->set('bus', function (Registry $register) use ($container) {
$container->set('telemetry', fn () => new NoTelemetry(), []);
$exitCode = 0;
$cli
->error()
->inject('error')
->inject('logError')
->action(function (Throwable $error, callable $logError) use ($taskName) {
->action(function (Throwable $error, callable $logError) use ($taskName, &$exitCode) {
call_user_func_array($logError, [
$error,
'Task',
$taskName,
]);
$exitCode = 1;
Timer::clearAll();
});
@@ -344,3 +347,4 @@ $cli->shutdown()->action(fn () => Timer::clearAll());
Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
require_once __DIR__ . '/init/span.php';
run($cli->run(...));
Console::exit($exitCode);
@@ -0,0 +1 @@
Export documents to a JSON file from your Appwrite database. This endpoint allows you to export documents to a JSON file stored in a secure internal bucket. You'll receive an email with a download link when the export is complete.
@@ -0,0 +1 @@
Import documents from a JSON file into your Appwrite database. This endpoint allows you to import documents from a JSON file uploaded to Appwrite Storage bucket.
@@ -130,10 +130,25 @@ class Create extends CollectionAction
$indexes[] = new Document($index);
}
try {
if (!$dbForDatabases->exists(null, Database::METADATA)) {
// Bootstrap the database metadata without a separate existence
// check to avoid races when multiple first collections are created
// concurrently for the same VectorsDB database.
for ($attempt = 0; $attempt < 5; $attempt++) {
try {
$dbForDatabases->create();
break;
} catch (DuplicateException) {
break;
} catch (\Throwable $e) {
if ($dbForDatabases->exists(null, Database::METADATA)) {
break;
}
if ($attempt === 4) {
throw $e;
}
\usleep(100_000);
}
}
$dbForDatabases->createCollection(
+19
View File
@@ -210,6 +210,25 @@ abstract class Format
return $this->services;
}
protected function getDescriptionContents(?string $description): string
{
if ($description === null || $description === '') {
return '';
}
if (!\str_ends_with($description, '.md')) {
return $description;
}
$contents = @\file_get_contents($description);
if ($contents === false) {
throw new \RuntimeException('Documentation file not found or unreadable: ' . $description);
}
return $contents;
}
protected function getRequestEnumName(string $service, string $method, string $param): ?string
{
/* `$service` is `$namespace` */
@@ -125,10 +125,7 @@ class OpenAPI3 extends Format
$namespace = $sdk->getNamespace() ?? 'default';
if ($desc === null) {
$desc = '';
}
$descContents = \str_ends_with($desc, '.md') ? \file_get_contents($desc) : $desc;
$descContents = $this->getDescriptionContents($desc);
$temp = [
'summary' => $route->getDesc(),
@@ -193,7 +190,7 @@ class OpenAPI3 extends Format
'parameters' => [],
'required' => [],
'responses' => [],
'description' => ($desc) ? \file_get_contents($desc) : '',
'description' => $this->getDescriptionContents($desc),
'demo' => \strtolower($namespace) . '/' . Template::fromCamelCaseToDash($methodObj->getMethodName()) . '.md',
'public' => $methodObj->isPublic(),
];
@@ -126,10 +126,7 @@ class Swagger2 extends Format
$sdkPlatforms = array_values(array_unique($sdkPlatforms));
$namespace = $sdk->getNamespace() ?? 'default';
if ($desc === null) {
$desc = '';
}
$descContents = \str_ends_with($desc, '.md') ? \file_get_contents($desc) : $desc;
$descContents = $this->getDescriptionContents($desc);
$temp = [
'summary' => $route->getDesc(),
@@ -201,7 +198,7 @@ class Swagger2 extends Format
'parameters' => [],
'required' => [],
'responses' => [],
'description' => ($desc) ? \file_get_contents($desc) : '',
'description' => $this->getDescriptionContents($desc),
'demo' => \strtolower($namespace) . '/' . Template::fromCamelCaseToDash($methodObj->getMethodName()) . '.md',
'public' => $methodObj->isPublic(),
];
@@ -100,6 +100,24 @@ trait FunctionsBase
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertNotEquals(401, $function['headers']['status-code'], 'Auth failed while polling function activation');
if (
($function['body']['deploymentId'] ?? '') !== $deploymentId
&& ($function['body']['latestDeploymentId'] ?? '') === $deploymentId
&& ($function['body']['latestDeploymentStatus'] ?? '') === 'ready'
) {
$activation = $this->updateFunctionDeployment($functionId, $deploymentId);
$this->assertContains(
$activation['headers']['status-code'],
[200, 409],
'Deployment activation request failed: ' . json_encode($activation['body'], JSON_PRETTY_PRINT)
);
if ($activation['headers']['status-code'] === 200) {
$function = $activation;
}
}
$this->assertEquals($deploymentId, $function['body']['deploymentId'] ?? '', 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT));
}, 120000, 500);
}