diff --git a/app/Core/Events/EventDispatcher.php b/app/Core/Events/EventDispatcher.php index b67748111..c9d68f4ae 100644 --- a/app/Core/Events/EventDispatcher.php +++ b/app/Core/Events/EventDispatcher.php @@ -581,7 +581,7 @@ public static function add_event_listener( public static function addEventListener($event, $listener, $priority = 10, $source = 'leantime') { - return self::add_event_listener($event, $listener, $priority, $source); + self::add_event_listener($event, $listener, $priority, $source); } public static function add_filter_listener( diff --git a/app/Domain/Api/Services/Api.php b/app/Domain/Api/Services/Api.php index 9bb3955bb..e2cf3d0d6 100644 --- a/app/Domain/Api/Services/Api.php +++ b/app/Domain/Api/Services/Api.php @@ -12,26 +12,36 @@ use Leantime\Domain\Users\Repositories\Users as UserRepository; use RangeException; +/** + * + */ class Api { use DispatchesEvents; + /** + * @var ApiRepository + */ private ApiRepository $apiRepository; + /** + * @var UserRepository + */ private UserRepository $userRepo; - private Auth $authService; + /** + * @var array|null + */ private ?array $error = null; /** * @api */ - public function __construct(ApiRepository $apiRepository, UserRepository $userRepo, Auth $authService) + public function __construct(ApiRepository $apiRepository, UserRepository $userRepo) { $this->apiRepository = $apiRepository; $this->userRepo = $userRepo; - $this->authService = $authService; } /** @@ -71,6 +81,16 @@ public function getAPIKeyUser(string $apiKey): bool|array return false; } + /** + * @param array $user + * @param bool $isExternalAuth + * @return void + * @throws BindingResolutionException + * + * Note: This is deliberately a duplicate of the authService setSession method to not have to load the authService + * which will run db connections when we are not ready yet. + * TODO: Move session management into a dedicated service + */ public function setApiUserSession(array $user, bool $isExternalAuth = false) { @@ -207,8 +227,6 @@ public function jsonResponse(int $id, ?array $result): void /** * Check the manifest for the asset and serve if found. * - * - * * @api */ public function getCaseCorrectPathFromManifest(string $filepath): string|false @@ -229,6 +247,9 @@ public function getCaseCorrectPathFromManifest(string $filepath): string|false return $basePath.array_search($referenceValue, $correctManifest); } + /** + * @return true + */ public function healthCheck() { return true; diff --git a/app/Domain/CsvImport/register.php b/app/Domain/CsvImport/register.php index 6585556c1..4b523acad 100644 --- a/app/Domain/CsvImport/register.php +++ b/app/Domain/CsvImport/register.php @@ -6,5 +6,11 @@ // Register event listener EventDispatcher::add_filter_listener( 'leantime.domain.connector.services.providers.loadProviders.providerList', - new AddCSVImportProvider + function(mixed $payload) { + + $provider = app()->make(\Leantime\Domain\CsvImport\Services\CsvImport::class); + $payload[$provider->id] = $provider; + + return $payload; + } ); diff --git a/makefile b/makefile index 82f7de964..934715ff4 100644 --- a/makefile +++ b/makefile @@ -151,7 +151,8 @@ clear-cache: rm -rf ./bootstrap/cache/*.php rm -rf ./storage/framework/composerPaths.php rm -rf ./storage/framework/viewPaths.php - rm -rf ./storage/framework/cache/*.php + rm -rf ./storage/framework/cache/**/* + rm -rf ./storage/framework/sessions/**/* rm -rf ./storage/framework/views/*.php .PHONY: install-deps build-js build package clean run-dev