Merge pull request #7017 from appwrite/chore-remove-install-analytics
Remove install analytics
This commit is contained in:
commit
ab760ba46b
7 changed files with 57 additions and 58 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -1,4 +1,4 @@
|
||||||
[submodule "app/console"]
|
[submodule "app/console"]
|
||||||
path = app/console
|
path = app/console
|
||||||
url = https://github.com/appwrite/console
|
url = https://github.com/appwrite/console
|
||||||
branch = 3.2.3
|
branch = 3.2.4
|
||||||
|
|
|
@ -86,7 +86,7 @@ return [
|
||||||
Exception::GENERAL_PROTOCOL_UNSUPPORTED => [
|
Exception::GENERAL_PROTOCOL_UNSUPPORTED => [
|
||||||
'name' => Exception::GENERAL_PROTOCOL_UNSUPPORTED,
|
'name' => Exception::GENERAL_PROTOCOL_UNSUPPORTED,
|
||||||
'description' => 'The request cannot be fulfilled with the current protocol. Please check the value of the _APP_OPTIONS_FORCE_HTTPS environment variable.',
|
'description' => 'The request cannot be fulfilled with the current protocol. Please check the value of the _APP_OPTIONS_FORCE_HTTPS environment variable.',
|
||||||
'code' => 500,
|
'code' => 426,
|
||||||
],
|
],
|
||||||
Exception::GENERAL_CODES_DISABLED => [
|
Exception::GENERAL_CODES_DISABLED => [
|
||||||
'name' => Exception::GENERAL_CODES_DISABLED,
|
'name' => Exception::GENERAL_CODES_DISABLED,
|
||||||
|
@ -732,4 +732,21 @@ return [
|
||||||
'description' => 'Migration is already in progress. You can check the status of the migration in your Appwrite Console\'s "Settings" > "Migrations".',
|
'description' => 'Migration is already in progress. You can check the status of the migration in your Appwrite Console\'s "Settings" > "Migrations".',
|
||||||
'code' => 409,
|
'code' => 409,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
/** Realtime */
|
||||||
|
Exception::REALTIME_MESSAGE_FORMAT_INVALID => [
|
||||||
|
'name' => Exception::REALTIME_MESSAGE_FORMAT_INVALID,
|
||||||
|
'description' => 'Message format is not valid.',
|
||||||
|
'code' => 1003,
|
||||||
|
],
|
||||||
|
Exception::REALTIME_POLICY_VIOLATION => [
|
||||||
|
'name' => Exception::REALTIME_POLICY_VIOLATION,
|
||||||
|
'description' => 'Policy violation.',
|
||||||
|
'code' => 1008,
|
||||||
|
],
|
||||||
|
Exception::REALTIME_TOO_MANY_MESSAGES => [
|
||||||
|
'name' => Exception::REALTIME_TOO_MANY_MESSAGES,
|
||||||
|
'description' => 'Too many messages.',
|
||||||
|
'code' => 1013,
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit e9657389879c8d76a9b3a0d3486c1d86f43c3bb9
|
Subproject commit fe835e50328ed80f67c66d2d449c0f7b51ade544
|
|
@ -1,8 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Appwrite\Auth\Auth;
|
use Appwrite\Auth\Auth;
|
||||||
|
use Appwrite\Extend\Exception;
|
||||||
use Appwrite\Messaging\Adapter\Realtime;
|
use Appwrite\Messaging\Adapter\Realtime;
|
||||||
use Appwrite\Network\Validator\Origin;
|
use Appwrite\Network\Validator\Origin;
|
||||||
|
use Appwrite\Utopia\Request;
|
||||||
use Appwrite\Utopia\Response;
|
use Appwrite\Utopia\Response;
|
||||||
use Swoole\Http\Request as SwooleRequest;
|
use Swoole\Http\Request as SwooleRequest;
|
||||||
use Swoole\Http\Response as SwooleResponse;
|
use Swoole\Http\Response as SwooleResponse;
|
||||||
|
@ -20,7 +22,6 @@ use Utopia\Database\DateTime;
|
||||||
use Utopia\Database\Document;
|
use Utopia\Database\Document;
|
||||||
use Utopia\Database\Query;
|
use Utopia\Database\Query;
|
||||||
use Utopia\Database\Validator\Authorization;
|
use Utopia\Database\Validator\Authorization;
|
||||||
use Appwrite\Utopia\Request;
|
|
||||||
use Utopia\Cache\Adapter\Sharding;
|
use Utopia\Cache\Adapter\Sharding;
|
||||||
use Utopia\Cache\Cache;
|
use Utopia\Cache\Cache;
|
||||||
use Utopia\Config\Config;
|
use Utopia\Config\Config;
|
||||||
|
@ -28,6 +29,9 @@ use Utopia\Database\Database;
|
||||||
use Utopia\WebSocket\Server;
|
use Utopia\WebSocket\Server;
|
||||||
use Utopia\WebSocket\Adapter;
|
use Utopia\WebSocket\Adapter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Utopia\Registry\Registry $register
|
||||||
|
*/
|
||||||
require_once __DIR__ . '/init.php';
|
require_once __DIR__ . '/init.php';
|
||||||
|
|
||||||
Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
|
Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
|
||||||
|
@ -122,12 +126,12 @@ $server = new Server($adapter);
|
||||||
$logError = function (Throwable $error, string $action) use ($register) {
|
$logError = function (Throwable $error, string $action) use ($register) {
|
||||||
$logger = $register->get('logger');
|
$logger = $register->get('logger');
|
||||||
|
|
||||||
if ($logger) {
|
if ($logger && !$error instanceof Exception) {
|
||||||
$version = App::getEnv('_APP_VERSION', 'UNKNOWN');
|
$version = App::getEnv('_APP_VERSION', 'UNKNOWN');
|
||||||
|
|
||||||
$log = new Log();
|
$log = new Log();
|
||||||
$log->setNamespace("realtime");
|
$log->setNamespace("realtime");
|
||||||
$log->setServer(\gethostname());
|
$log->setServer(gethostname());
|
||||||
$log->setVersion($version);
|
$log->setVersion($version);
|
||||||
$log->setType(Log::TYPE_ERROR);
|
$log->setType(Log::TYPE_ERROR);
|
||||||
$log->setMessage($error->getMessage());
|
$log->setMessage($error->getMessage());
|
||||||
|
@ -182,7 +186,7 @@ $server->onStart(function () use ($stats, $register, $containerId, &$statsDocume
|
||||||
|
|
||||||
$statsDocument = Authorization::skip(fn () => $database->createDocument('realtime', $document));
|
$statsDocument = Authorization::skip(fn () => $database->createDocument('realtime', $document));
|
||||||
break;
|
break;
|
||||||
} catch (\Throwable $th) {
|
} catch (Throwable) {
|
||||||
Console::warning("Collection not ready. Retrying connection ({$attempts})...");
|
Console::warning("Collection not ready. Retrying connection ({$attempts})...");
|
||||||
sleep(DATABASE_RECONNECT_SLEEP);
|
sleep(DATABASE_RECONNECT_SLEEP);
|
||||||
}
|
}
|
||||||
|
@ -210,7 +214,7 @@ $server->onStart(function () use ($stats, $register, $containerId, &$statsDocume
|
||||||
->setAttribute('value', json_encode($payload));
|
->setAttribute('value', json_encode($payload));
|
||||||
|
|
||||||
Authorization::skip(fn () => $database->updateDocument('realtime', $statsDocument->getId(), $statsDocument));
|
Authorization::skip(fn () => $database->updateDocument('realtime', $statsDocument->getId(), $statsDocument));
|
||||||
} catch (\Throwable $th) {
|
} catch (Throwable $th) {
|
||||||
call_user_func($logError, $th, "updateWorkerDocument");
|
call_user_func($logError, $th, "updateWorkerDocument");
|
||||||
} finally {
|
} finally {
|
||||||
$register->get('pools')->reclaim();
|
$register->get('pools')->reclaim();
|
||||||
|
@ -362,7 +366,7 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats,
|
||||||
$stats->incr($event['project'], 'messages', $num);
|
$stats->incr($event['project'], 'messages', $num);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (\Throwable $th) {
|
} catch (Throwable $th) {
|
||||||
call_user_func($logError, $th, "pubSubConnection");
|
call_user_func($logError, $th, "pubSubConnection");
|
||||||
|
|
||||||
Console::error('Pub/sub error: ' . $th->getMessage());
|
Console::error('Pub/sub error: ' . $th->getMessage());
|
||||||
|
@ -389,19 +393,19 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
|
||||||
App::setResource('response', fn() => $response);
|
App::setResource('response', fn() => $response);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/** @var \Utopia\Database\Document $project */
|
/** @var Document $project */
|
||||||
$project = $app->getResource('project');
|
$project = $app->getResource('project');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Project Check
|
* Project Check
|
||||||
*/
|
*/
|
||||||
if (empty($project->getId())) {
|
if (empty($project->getId())) {
|
||||||
throw new Exception('Missing or unknown project ID', 1008);
|
throw new Exception(Exception::REALTIME_POLICY_VIOLATION, 'Missing or unknown project ID');
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbForProject = getProjectDB($project);
|
$dbForProject = getProjectDB($project);
|
||||||
$console = $app->getResource('console'); /** @var \Utopia\Database\Document $console */
|
$console = $app->getResource('console'); /** @var Document $console */
|
||||||
$user = $app->getResource('user'); /** @var \Utopia\Database\Document $user */
|
$user = $app->getResource('user'); /** @var Document $user */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Abuse Check
|
* Abuse Check
|
||||||
|
@ -416,7 +420,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
|
||||||
$abuse = new Abuse($timeLimit);
|
$abuse = new Abuse($timeLimit);
|
||||||
|
|
||||||
if (App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled' && $abuse->check()) {
|
if (App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled' && $abuse->check()) {
|
||||||
throw new Exception('Too many requests', 1013);
|
throw new Exception(Exception::REALTIME_TOO_MANY_MESSAGES, 'Too many requests');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -425,10 +429,10 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
|
||||||
* Skip this check for non-web platforms which are not required to send an origin header.
|
* Skip this check for non-web platforms which are not required to send an origin header.
|
||||||
*/
|
*/
|
||||||
$origin = $request->getOrigin();
|
$origin = $request->getOrigin();
|
||||||
$originValidator = new Origin(\array_merge($project->getAttribute('platforms', []), $console->getAttribute('platforms', [])));
|
$originValidator = new Origin(array_merge($project->getAttribute('platforms', []), $console->getAttribute('platforms', [])));
|
||||||
|
|
||||||
if (!$originValidator->isValid($origin) && $project->getId() !== 'console') {
|
if (!$originValidator->isValid($origin) && $project->getId() !== 'console') {
|
||||||
throw new Exception($originValidator->getDescription(), 1008);
|
throw new Exception(Exception::REALTIME_POLICY_VIOLATION, $originValidator->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
$roles = Auth::getRoles($user);
|
$roles = Auth::getRoles($user);
|
||||||
|
@ -439,7 +443,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
|
||||||
* Channels Check
|
* Channels Check
|
||||||
*/
|
*/
|
||||||
if (empty($channels)) {
|
if (empty($channels)) {
|
||||||
throw new Exception('Missing channels', 1008);
|
throw new Exception(Exception::REALTIME_POLICY_VIOLATION, 'Missing channels');
|
||||||
}
|
}
|
||||||
|
|
||||||
$realtime->subscribe($project->getId(), $connection, $roles, $channels);
|
$realtime->subscribe($project->getId(), $connection, $roles, $channels);
|
||||||
|
@ -460,7 +464,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
|
||||||
]);
|
]);
|
||||||
$stats->incr($project->getId(), 'connections');
|
$stats->incr($project->getId(), 'connections');
|
||||||
$stats->incr($project->getId(), 'connectionsTotal');
|
$stats->incr($project->getId(), 'connectionsTotal');
|
||||||
} catch (\Throwable $th) {
|
} catch (Throwable $th) {
|
||||||
call_user_func($logError, $th, "initServer");
|
call_user_func($logError, $th, "initServer");
|
||||||
|
|
||||||
$response = [
|
$response = [
|
||||||
|
@ -486,7 +490,6 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server,
|
||||||
|
|
||||||
$server->onMessage(function (int $connection, string $message) use ($server, $register, $realtime, $containerId) {
|
$server->onMessage(function (int $connection, string $message) use ($server, $register, $realtime, $containerId) {
|
||||||
try {
|
try {
|
||||||
$app = new App('UTC');
|
|
||||||
$response = new Response(new SwooleResponse());
|
$response = new Response(new SwooleResponse());
|
||||||
$projectId = $realtime->connections[$connection]['projectId'];
|
$projectId = $realtime->connections[$connection]['projectId'];
|
||||||
$database = getConsoleDB();
|
$database = getConsoleDB();
|
||||||
|
@ -494,6 +497,8 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
|
||||||
if ($projectId !== 'console') {
|
if ($projectId !== 'console') {
|
||||||
$project = Authorization::skip(fn() => $database->getDocument('projects', $projectId));
|
$project = Authorization::skip(fn() => $database->getDocument('projects', $projectId));
|
||||||
$database = getProjectDB($project);
|
$database = getProjectDB($project);
|
||||||
|
} else {
|
||||||
|
$project = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -510,22 +515,22 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
|
||||||
$abuse = new Abuse($timeLimit);
|
$abuse = new Abuse($timeLimit);
|
||||||
|
|
||||||
if ($abuse->check() && App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled') {
|
if ($abuse->check() && App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') === 'enabled') {
|
||||||
throw new Exception('Too many messages', 1013);
|
throw new Exception(Exception::REALTIME_TOO_MANY_MESSAGES, 'Too many messages.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = json_decode($message, true);
|
$message = json_decode($message, true);
|
||||||
|
|
||||||
if (is_null($message) || (!array_key_exists('type', $message) && !array_key_exists('data', $message))) {
|
if (is_null($message) || (!array_key_exists('type', $message) && !array_key_exists('data', $message))) {
|
||||||
throw new Exception('Message format is not valid.', 1003);
|
throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'Message format is not valid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($message['type']) {
|
switch ($message['type']) {
|
||||||
/**
|
/**
|
||||||
* This type is used to authenticate.
|
* This type is used to authenticate.
|
||||||
*/
|
*/
|
||||||
case 'authentication':
|
case 'authentication':
|
||||||
if (!array_key_exists('session', $message['data'])) {
|
if (!array_key_exists('session', $message['data'])) {
|
||||||
throw new Exception('Payload is not valid.', 1003);
|
throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'Payload is not valid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$session = Auth::decodeSession($message['data']['session']);
|
$session = Auth::decodeSession($message['data']['session']);
|
||||||
|
@ -540,7 +545,7 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
|
||||||
|| !Auth::sessionVerify($user->getAttribute('sessions', []), Auth::$secret, $authDuration) // Validate user has valid login token
|
|| !Auth::sessionVerify($user->getAttribute('sessions', []), Auth::$secret, $authDuration) // Validate user has valid login token
|
||||||
) {
|
) {
|
||||||
// cookie not valid
|
// cookie not valid
|
||||||
throw new Exception('Session is not valid.', 1003);
|
throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'Session is not valid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$roles = Auth::getRoles($user);
|
$roles = Auth::getRoles($user);
|
||||||
|
@ -560,9 +565,9 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new Exception('Message type is not valid.', 1003);
|
throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'Message type is not valid.');
|
||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (Throwable $th) {
|
||||||
$response = [
|
$response = [
|
||||||
'type' => 'error',
|
'type' => 'error',
|
||||||
'data' => [
|
'data' => [
|
||||||
|
|
|
@ -33,7 +33,7 @@ use Utopia\Logger\Logger;
|
||||||
use Utopia\Pools\Group;
|
use Utopia\Pools\Group;
|
||||||
use Utopia\Queue\Connection;
|
use Utopia\Queue\Connection;
|
||||||
|
|
||||||
Authorization::disable();
|
Authorization::setDefaultStatus(false);
|
||||||
Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
|
Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -225,8 +225,13 @@ class Exception extends \Exception
|
||||||
public const MIGRATION_ALREADY_EXISTS = 'migration_already_exists';
|
public const MIGRATION_ALREADY_EXISTS = 'migration_already_exists';
|
||||||
public const MIGRATION_IN_PROGRESS = 'migration_in_progress';
|
public const MIGRATION_IN_PROGRESS = 'migration_in_progress';
|
||||||
|
|
||||||
protected $type = '';
|
/** Realtime */
|
||||||
protected $errors = [];
|
public const REALTIME_MESSAGE_FORMAT_INVALID = 'realtime_message_format_invalid';
|
||||||
|
public const REALTIME_TOO_MANY_MESSAGES = 'realtime_too_many_messages';
|
||||||
|
public const REALTIME_POLICY_VIOLATION = 'realtime_policy_violation';
|
||||||
|
|
||||||
|
protected string $type = '';
|
||||||
|
protected array $errors = [];
|
||||||
|
|
||||||
public function __construct(string $type = Exception::GENERAL_UNKNOWN, string $message = null, int $code = null, \Throwable $previous = null)
|
public function __construct(string $type = Exception::GENERAL_UNKNOWN, string $message = null, int $code = null, \Throwable $previous = null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,9 +6,6 @@ use Appwrite\Auth\Auth;
|
||||||
use Appwrite\Docker\Compose;
|
use Appwrite\Docker\Compose;
|
||||||
use Appwrite\Docker\Env;
|
use Appwrite\Docker\Env;
|
||||||
use Appwrite\Utopia\View;
|
use Appwrite\Utopia\View;
|
||||||
use Utopia\Analytics\Adapter;
|
|
||||||
use Utopia\Analytics\Adapter\GoogleAnalytics;
|
|
||||||
use Utopia\Analytics\Event;
|
|
||||||
use Utopia\CLI\Console;
|
use Utopia\CLI\Console;
|
||||||
use Utopia\Config\Config;
|
use Utopia\Config\Config;
|
||||||
use Utopia\Validator\Text;
|
use Utopia\Validator\Text;
|
||||||
|
@ -43,12 +40,6 @@ class Install extends Action
|
||||||
/** @var array<string, array<string, string>> $vars array whre key is variable name and value is variable */
|
/** @var array<string, array<string, string>> $vars array whre key is variable name and value is variable */
|
||||||
$vars = [];
|
$vars = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* We are using a random value every execution for identification.
|
|
||||||
* This allows us to collect information without invading the privacy of our users.
|
|
||||||
*/
|
|
||||||
$analytics = new GoogleAnalytics('UA-26264668-9', uniqid('server.', true));
|
|
||||||
|
|
||||||
foreach ($config as $category) {
|
foreach ($config as $category) {
|
||||||
foreach ($category['variables'] ?? [] as $var) {
|
foreach ($category['variables'] ?? [] as $var) {
|
||||||
$vars[$var['name']] = $var;
|
$vars[$var['name']] = $var;
|
||||||
|
@ -82,7 +73,7 @@ class Install extends Action
|
||||||
file_put_contents($this->path . '/docker-compose.yml.' . $time . '.backup', $data);
|
file_put_contents($this->path . '/docker-compose.yml.' . $time . '.backup', $data);
|
||||||
$compose = new Compose($data);
|
$compose = new Compose($data);
|
||||||
$appwrite = $compose->getService('appwrite');
|
$appwrite = $compose->getService('appwrite');
|
||||||
$oldVersion = ($appwrite) ? $appwrite->getImageVersion() : null;
|
$oldVersion = $appwrite?->getImageVersion();
|
||||||
try {
|
try {
|
||||||
$ports = $compose->getService('traefik')->getPorts();
|
$ports = $compose->getService('traefik')->getPorts();
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
|
@ -209,14 +200,12 @@ class Install extends Action
|
||||||
|
|
||||||
if (!file_put_contents($this->path . '/docker-compose.yml', $templateForCompose->render(false))) {
|
if (!file_put_contents($this->path . '/docker-compose.yml', $templateForCompose->render(false))) {
|
||||||
$message = 'Failed to save Docker Compose file';
|
$message = 'Failed to save Docker Compose file';
|
||||||
$this->sendEvent($analytics, $message);
|
|
||||||
Console::error($message);
|
Console::error($message);
|
||||||
Console::exit(1);
|
Console::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_put_contents($this->path . '/.env', $templateForEnv->render(false))) {
|
if (!file_put_contents($this->path . '/.env', $templateForEnv->render(false))) {
|
||||||
$message = 'Failed to save environment variables file';
|
$message = 'Failed to save environment variables file';
|
||||||
$this->sendEvent($analytics, $message);
|
|
||||||
Console::error($message);
|
Console::error($message);
|
||||||
Console::exit(1);
|
Console::exit(1);
|
||||||
}
|
}
|
||||||
|
@ -237,29 +226,12 @@ class Install extends Action
|
||||||
|
|
||||||
if ($exit !== 0) {
|
if ($exit !== 0) {
|
||||||
$message = 'Failed to install Appwrite dockers';
|
$message = 'Failed to install Appwrite dockers';
|
||||||
$this->sendEvent($analytics, $message);
|
|
||||||
Console::error($message);
|
Console::error($message);
|
||||||
Console::error($stderr);
|
Console::error($stderr);
|
||||||
Console::exit($exit);
|
Console::exit($exit);
|
||||||
} else {
|
} else {
|
||||||
$message = 'Appwrite installed successfully';
|
$message = 'Appwrite installed successfully';
|
||||||
$this->sendEvent($analytics, $message);
|
|
||||||
Console::success($message);
|
Console::success($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sendEvent(Adapter $analytics, string $message): void
|
|
||||||
{
|
|
||||||
$event = new Event();
|
|
||||||
$event->setName(APP_VERSION_STABLE);
|
|
||||||
$event->setValue($message);
|
|
||||||
$event->setUrl('http://localhost/');
|
|
||||||
$event->setProps([
|
|
||||||
'category' => 'install/server',
|
|
||||||
'action' => 'install',
|
|
||||||
]);
|
|
||||||
$event->setType('install/server');
|
|
||||||
|
|
||||||
$analytics->createEvent($event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue