diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 7b218e050a..1afd6b652e 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -15,23 +15,17 @@ use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Messaging\Adapter\Realtime; use Appwrite\Utopia\Request; use Appwrite\Utopia\Response; -use Appwrite\Utopia\View; use Utopia\Abuse\Abuse; use Utopia\Abuse\Adapters\TimeLimit; use Utopia\App; use Utopia\Cache\Adapter\Filesystem; use Utopia\Cache\Cache; -use Utopia\CLI\Console; use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; -use Utopia\DSN\DSN; -use Utopia\Logger\Log; -use Utopia\Logger\Log\User; -use Utopia\Logger\Logger; use Utopia\System\System; use Utopia\Validator\WhiteList; @@ -745,38 +739,3 @@ App::init() throw new Exception(Exception::GENERAL_USAGE_DISABLED); } }); - -App::error() - ->inject('error') - ->inject('request') - ->inject('response') - ->inject('project') - ->inject('queueForUsage') - ->action(function (Throwable $error, Request $request, Response $response, Document $project, Audit $queueForAudits, Usage $queueForUsage) { - - if ($error instanceof AppwriteException) { - $publish = $error->isPublishable(); - } else { - $publish = $error->getCode() === 0 || $error->getCode() >= 500; - } - - if ($publish && $project->getId() !== 'console') { - if (!Auth::isPrivilegedUser(Authorization::getRoles())) { - $fileSize = 0; - $file = $request->getFiles('file'); - if (!empty($file)) { - $fileSize = (\is_array($file['size']) && isset($file['size'][0])) ? $file['size'][0] : $file['size']; - } - - $queueForUsage - ->addMetric(METRIC_NETWORK_REQUESTS, 1) - ->addMetric(METRIC_NETWORK_INBOUND, $request->getSize() + $fileSize) - ->addMetric(METRIC_NETWORK_OUTBOUND, $response->getSize()); - } - - $queueForUsage - ->setProject($project) - ->trigger(); - } - - }); \ No newline at end of file diff --git a/app/worker.php b/app/worker.php index 483aeb3352..763ab1d914 100644 --- a/app/worker.php +++ b/app/worker.php @@ -279,7 +279,7 @@ Server::setResource('deviceForLocalFiles', function (Document $project) { $pools = $register->get('pools'); $platform = new Appwrite(); -$args = $_SERVER['argv']; +$args = $platform->getEnv('argv'); if (!isset($args[1])) { Console::error('Missing worker name'); diff --git a/composer.lock b/composer.lock index 30d5ed74e0..b5c2f59bcf 100644 --- a/composer.lock +++ b/composer.lock @@ -2163,16 +2163,16 @@ }, { "name": "utopia-php/platform", - "version": "0.5.1", + "version": "0.5.2", "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "3eceef0b6593fe0f7d2efd36d40402a395a4c285" + "reference": "b9feabc79b92dc2b05683a986ad43bce5c1583e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/3eceef0b6593fe0f7d2efd36d40402a395a4c285", - "reference": "3eceef0b6593fe0f7d2efd36d40402a395a4c285", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/b9feabc79b92dc2b05683a986ad43bce5c1583e3", + "reference": "b9feabc79b92dc2b05683a986ad43bce5c1583e3", "shasum": "" }, "require": { @@ -2180,7 +2180,7 @@ "ext-redis": "*", "php": ">=8.0", "utopia-php/cli": "0.15.*", - "utopia-php/framework": "0.*.*" + "utopia-php/framework": "0.33.*" }, "require-dev": { "laravel/pint": "1.2.*", @@ -2206,9 +2206,9 @@ ], "support": { "issues": "https://github.com/utopia-php/platform/issues", - "source": "https://github.com/utopia-php/platform/tree/0.5.1" + "source": "https://github.com/utopia-php/platform/tree/0.5.2" }, - "time": "2023-12-26T16:14:41+00:00" + "time": "2024-05-22T12:50:35+00:00" }, { "name": "utopia-php/pools", @@ -2591,16 +2591,16 @@ }, { "name": "utopia-php/vcs", - "version": "0.6.5", + "version": "0.6.6", "source": { "type": "git", "url": "https://github.com/utopia-php/vcs.git", - "reference": "104e47ea8e38c156ec0e0bd415caa3dcd5046fe2" + "reference": "e538264cfee5e3efdfe1771efba04750cf20b2c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/vcs/zipball/104e47ea8e38c156ec0e0bd415caa3dcd5046fe2", - "reference": "104e47ea8e38c156ec0e0bd415caa3dcd5046fe2", + "url": "https://api.github.com/repos/utopia-php/vcs/zipball/e538264cfee5e3efdfe1771efba04750cf20b2c4", + "reference": "e538264cfee5e3efdfe1771efba04750cf20b2c4", "shasum": "" }, "require": { @@ -2634,9 +2634,9 @@ ], "support": { "issues": "https://github.com/utopia-php/vcs/issues", - "source": "https://github.com/utopia-php/vcs/tree/0.6.5" + "source": "https://github.com/utopia-php/vcs/tree/0.6.6" }, - "time": "2024-01-08T17:11:12+00:00" + "time": "2024-05-17T09:36:30+00:00" }, { "name": "utopia-php/websocket", @@ -2823,16 +2823,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.38.5", + "version": "0.38.6", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "830a46cc8e34ee096a76d4af6f00adf008a7cbf8" + "reference": "d7016d6d72545e84709892faca972eb4bf5bd699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/830a46cc8e34ee096a76d4af6f00adf008a7cbf8", - "reference": "830a46cc8e34ee096a76d4af6f00adf008a7cbf8", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/d7016d6d72545e84709892faca972eb4bf5bd699", + "reference": "d7016d6d72545e84709892faca972eb4bf5bd699", "shasum": "" }, "require": { @@ -2868,9 +2868,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.5" + "source": "https://github.com/appwrite/sdk-generator/tree/0.38.6" }, - "time": "2024-05-17T00:59:59+00:00" + "time": "2024-05-20T18:00:16+00:00" }, { "name": "doctrine/deprecations", @@ -2991,16 +2991,16 @@ }, { "name": "laravel/pint", - "version": "v1.15.3", + "version": "v1.16.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "3600b5d17aff52f6100ea4921849deacbbeb8656" + "reference": "1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/3600b5d17aff52f6100ea4921849deacbbeb8656", - "reference": "3600b5d17aff52f6100ea4921849deacbbeb8656", + "url": "https://api.github.com/repos/laravel/pint/zipball/1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98", + "reference": "1b3a3dc5bc6a81ff52828ba7277621f1d49d6d98", "shasum": "" }, "require": { @@ -3011,11 +3011,11 @@ "php": "^8.1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.54.0", - "illuminate/view": "^10.48.8", - "larastan/larastan": "^2.9.5", - "laravel-zero/framework": "^10.3.0", - "mockery/mockery": "^1.6.11", + "friendsofphp/php-cs-fixer": "^3.57.1", + "illuminate/view": "^10.48.10", + "larastan/larastan": "^2.9.6", + "laravel-zero/framework": "^10.4.0", + "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^1.15.1", "pestphp/pest": "^2.34.7" }, @@ -3053,7 +3053,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-04-30T15:02:26+00:00" + "time": "2024-05-21T18:08:25+00:00" }, { "name": "matthiasmullie/minify", @@ -3469,16 +3469,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.0", + "version": "5.4.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a" + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", "shasum": "" }, "require": { @@ -3527,9 +3527,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" }, - "time": "2024-04-09T21:13:58+00:00" + "time": "2024-05-21T05:55:05+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -5529,5 +5529,5 @@ "platform-overrides": { "php": "8.3" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.2.0" }