From e3538d0e4009de3773c4fa49744b9cdc2148c882 Mon Sep 17 00:00:00 2001 From: Hemachandar Date: Mon, 23 Mar 2026 21:30:53 +0530 Subject: [PATCH] perf: simplify repository authorized checks --- composer.json | 2 +- composer.lock | 19 ++++++++++--------- .../Http/Installations/Repositories/Get.php | 16 +++++++++------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index f4e21222ee..3963058b5f 100644 --- a/composer.json +++ b/composer.json @@ -84,7 +84,7 @@ "utopia-php/storage": "1.0.*", "utopia-php/system": "0.10.*", "utopia-php/telemetry": "0.2.*", - "utopia-php/vcs": "2.*", + "utopia-php/vcs": "3.*", "utopia-php/websocket": "1.0.*", "matomo/device-detector": "6.4.*", "dragonmantank/cron-expression": "3.4.*", diff --git a/composer.lock b/composer.lock index 50b317c811..dd936702ac 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "1404c8821e43b3fe92e06a8ed658ed26", + "content-hash": "c1ca5882bd2c5896cc2f171891da8133", "packages": [ { "name": "adhocore/jwt", @@ -5247,22 +5247,23 @@ }, { "name": "utopia-php/vcs", - "version": "2.0.2", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/utopia-php/vcs.git", - "reference": "5769679308bad498f2777547d48ab332166c4c0b" + "reference": "0efe842d695acb4b184f5306a836169c771fbcea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/vcs/zipball/5769679308bad498f2777547d48ab332166c4c0b", - "reference": "5769679308bad498f2777547d48ab332166c4c0b", + "url": "https://api.github.com/repos/utopia-php/vcs/zipball/0efe842d695acb4b184f5306a836169c771fbcea", + "reference": "0efe842d695acb4b184f5306a836169c771fbcea", "shasum": "" }, "require": { "adhocore/jwt": "^1.1", "php": ">=8.0", - "utopia-php/cache": "1.0.*" + "utopia-php/cache": "1.0.*", + "utopia-php/fetch": "0.5.*" }, "require-dev": { "laravel/pint": "1.*.*", @@ -5289,9 +5290,9 @@ ], "support": { "issues": "https://github.com/utopia-php/vcs/issues", - "source": "https://github.com/utopia-php/vcs/tree/2.0.2" + "source": "https://github.com/utopia-php/vcs/tree/3.0.1" }, - "time": "2026-03-13T15:25:16+00:00" + "time": "2026-03-23T15:58:31+00:00" }, { "name": "utopia-php/websocket", @@ -8489,5 +8490,5 @@ "platform-overrides": { "php": "8.3" }, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.6.0" } diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Get.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Get.php index 9e32ca8276..52b94cd525 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Get.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Get.php @@ -85,14 +85,16 @@ class Get extends Action $repository = $github->getRepository($owner, $repositoryName); - $authorized = false; - try { - $installationRepository = $github->getInstallationRepository($repositoryName); - if (!empty($installationRepository)) { - $authorized = true; + $authorized = $github->hasAccessToAllRepositories(); + if (!$authorized) { + try { + $installationRepository = $github->getInstallationRepository($repositoryName); + if (!empty($installationRepository)) { + $authorized = true; + } + } catch (RepositoryNotFound $e) { + $authorized = false; } - } catch (RepositoryNotFound $e) { - $authorized = false; } $repository['id'] = \strval($repository['id']) ?? '';