1
0
Fork 0
mirror of synced 2024-06-02 02:44:47 +12:00

Merge branch 'master' of https://github.com/appwrite/appwrite into 0.10.x

This commit is contained in:
Torsten Dittmann 2021-09-09 13:34:40 +02:00
commit c13e9be80c
10 changed files with 34 additions and 30 deletions

View file

@ -217,7 +217,7 @@ return [
[
'key' => 'php',
'name' => 'PHP',
'version' => '2.3.0',
'version' => '2.3.1',
'url' => 'https://github.com/appwrite/sdk-for-php',
'package' => 'https://packagist.org/packages/appwrite/appwrite',
'enabled' => true,

View file

@ -42,7 +42,7 @@ App::init(function ($utopia, $request, $response, $console, $project, $consoleDB
if (empty($domain->get()) || !$domain->isKnown() || $domain->isTest()) {
$domains[$domain->get()] = false;
Console::warning($domain->get() . ' is not a publicly accessible domain. Skipping SSL certificate generation.');
} elseif(str_ends_with($request->getURI(), '/.well-known/acme-challenge')) {
} elseif(str_starts_with($request->getURI(), '/.well-known/acme-challenge')) {
Console::warning('Skipping SSL certificates generation on ACME challenge.');
} else {
Authorization::disable();

View file

@ -110,8 +110,8 @@ $server->onStart(function () use ($stats, $register, $containerId, &$documentId)
continue;
}
$connections = $value['connections'];
$messages = $value['messages'];
$connections = $stats->get($projectId, 'connections');
$messages = $stats->get($projectId, 'messages');
$usage = new Event('v1-usage', 'UsageV1');
$usage
@ -129,11 +129,13 @@ $server->onStart(function () use ($stats, $register, $containerId, &$documentId)
if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
$usage->trigger();
}
unset($usage, $connections, $messages);
}
$payload = [];
foreach ($stats as $projectId => $value) {
if (!empty($value['connectionsTotal'])) {
$payload[$projectId] = $value['connectionsTotal'];
$payload[$projectId] = $stats->get($projectId, 'connectionsTotal');
}
}
if (empty($payload)) {
@ -210,7 +212,7 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats,
$event = [
'project' => 'console',
'roles' => ['team:' . $value['teamId']],
'roles' => ['team:' . $stats->get($projectId, 'teamId')],
'data' => [
'event' => 'stats.connections',
'channels' => ['project'],

View file

@ -482,7 +482,7 @@ class FunctionsV1 extends Worker
$exitCode = 0;
try {
$exitCode = (int)!$orchestration->execute(
$exitCode = (int) !$orchestration->execute(
name: $container,
command: $orchestration->parseCommandString($command),
stdout: $stdout,
@ -509,8 +509,8 @@ class FunctionsV1 extends Worker
'tagId' => $tag->getId(),
'status' => $functionStatus,
'exitCode' => $exitCode,
'stdout' => \mb_substr($stdout, -4000), // log last 4000 chars output
'stderr' => \mb_substr($stderr, -4000), // log last 4000 chars output
'stdout' => \utf8_encode(\mb_substr($stdout, -4000)), // log last 4000 chars output
'stderr' => \utf8_encode(\mb_substr($stderr, -4000)), // log last 4000 chars output
'time' => $executionTime
]));
@ -535,11 +535,11 @@ class FunctionsV1 extends Worker
$target = Realtime::fromPayload('functions.executions.update', $execution);
Realtime::send(
$projectId,
$execution->getArrayCopy(),
'functions.executions.update',
$target['channels'],
$target['roles']
projectId: $projectId,
payload: $execution->getArrayCopy(),
event: 'functions.executions.update',
channels: $target['channels'],
roles: $target['roles']
);
$usage = new Event('v1-usage', 'UsageV1');
@ -551,8 +551,7 @@ class FunctionsV1 extends Worker
->setParam('functionStatus', $functionStatus)
->setParam('functionExecutionTime', $executionTime * 1000) // ms
->setParam('networkRequestSize', 0)
->setParam('networkResponseSize', 0)
;
->setParam('networkResponseSize', 0);
if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
$usage->trigger();

View file

@ -64,7 +64,7 @@
"slickdeals/statsd": "3.1.0"
},
"require-dev": {
"appwrite/sdk-generator": "0.14.3",
"appwrite/sdk-generator": "0.14.4",
"phpunit/phpunit": "9.5.6",
"swoole/ide-helper": "4.6.7",
"textalk/websocket": "1.5.2",

24
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": "432285e325d8c4b39da4f8d5d00d2b03",
"content-hash": "82b47392837605b4fb552e5c9374c4cc",
"packages": [
{
"name": "adhocore/jwt",
@ -248,16 +248,16 @@
},
{
"name": "chillerlan/php-settings-container",
"version": "2.1.1",
"version": "2.1.2",
"source": {
"type": "git",
"url": "https://github.com/chillerlan/php-settings-container.git",
"reference": "98ccc1b31b31a53bcb563465c4961879b2b93096"
"reference": "ec834493a88682dd69652a1eeaf462789ed0c5f5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/98ccc1b31b31a53bcb563465c4961879b2b93096",
"reference": "98ccc1b31b31a53bcb563465c4961879b2b93096",
"url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/ec834493a88682dd69652a1eeaf462789ed0c5f5",
"reference": "ec834493a88682dd69652a1eeaf462789ed0c5f5",
"shasum": ""
},
"require": {
@ -307,7 +307,7 @@
"type": "ko_fi"
}
],
"time": "2021-01-06T15:57:03+00:00"
"time": "2021-09-06T15:17:01+00:00"
},
{
"name": "colinmollenhour/credis",
@ -2516,16 +2516,16 @@
},
{
"name": "appwrite/sdk-generator",
"version": "0.14.3",
"version": "0.14.4",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "a1075a59db33fe2bba9e648bf67b3ece1debcfa4"
"reference": "b89a51170f99e6977df72c46522c7d931257bc28"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/a1075a59db33fe2bba9e648bf67b3ece1debcfa4",
"reference": "a1075a59db33fe2bba9e648bf67b3ece1debcfa4",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/b89a51170f99e6977df72c46522c7d931257bc28",
"reference": "b89a51170f99e6977df72c46522c7d931257bc28",
"shasum": ""
},
"require": {
@ -2559,9 +2559,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.14.3"
"source": "https://github.com/appwrite/sdk-generator/tree/0.14.4"
},
"time": "2021-09-06T09:32:51+00:00"
"time": "2021-09-07T13:23:19+00:00"
},
{
"name": "composer/package-versions-deprecated",

View file

@ -326,6 +326,7 @@ class FunctionsCustomServerTest extends Scope
$this->assertStringContainsString('http', $execution['body']['stdout']);
$this->assertStringContainsString('PHP', $execution['body']['stdout']);
$this->assertStringContainsString('8.0', $execution['body']['stdout']);
$this->assertStringContainsString('êä', $execution['body']['stdout']); // tests unknown utf-8 chars
$this->assertEquals('', $execution['body']['stderr']);
$this->assertGreaterThan(0.05, $execution['body']['time']);
$this->assertLessThan(0.500, $execution['body']['time']);

0
tests/resources/functions/package-php.sh Normal file → Executable file
View file

Binary file not shown.

View file

@ -25,4 +25,6 @@ echo $_ENV['APPWRITE_FUNCTION_RUNTIME_NAME']."\n";
echo $_ENV['APPWRITE_FUNCTION_RUNTIME_VERSION']."\n";
// echo $result['$id'];
echo $_ENV['APPWRITE_FUNCTION_EVENT']."\n";
echo $_ENV['APPWRITE_FUNCTION_EVENT_DATA']."\n";
echo $_ENV['APPWRITE_FUNCTION_EVENT_DATA']."\n";
// Test unknwon UTF-8 chars
echo "\xEA\xE4\n";