$dependencies * @return void * * @throws RuntimeException 의존 확장 설치 또는 활성화 실패 시 */ protected function installSelectedDependencies(array $dependencies): void { if (empty($dependencies)) { return; } /** @var ModuleService $moduleService */ $moduleService = app(ModuleService::class); /** @var PluginService $pluginService */ $pluginService = app(PluginService::class); foreach ($dependencies as $dep) { $type = $dep['type'] ?? ''; $identifier = $dep['identifier'] ?? ''; if ($identifier === '') { continue; } try { if ($type === 'module') { $info = $moduleService->getModuleInfo($identifier); $isInstalled = (bool) ($info['is_installed'] ?? false); $isActive = ($info['status'] ?? null) === \App\Enums\ExtensionStatus::Active->value; if ($isActive) { continue; } if (! $isInstalled) { $moduleService->installModule($identifier, VendorMode::Auto); } $moduleService->activateModule($identifier); } elseif ($type === 'plugin') { $info = $pluginService->getPluginInfo($identifier); $isInstalled = (bool) ($info['is_installed'] ?? false); $isActive = ($info['status'] ?? null) === \App\Enums\ExtensionStatus::Active->value; if ($isActive) { continue; } if (! $isInstalled) { $pluginService->installPlugin($identifier, VendorMode::Auto); } $pluginService->activatePlugin($identifier); } } catch (\Throwable $e) { throw new RuntimeException(__('extensions.errors.cascade_dependency_failed', [ 'type' => $type, 'identifier' => $identifier, 'message' => $e->getMessage(), ])); } } } /** * 동반 선택된 번들 언어팩을 설치 + 자동 활성화 합니다 (best-effort). * * @param array $bundledIdentifiers 번들 언어팩 식별자 목록 * @return array 실패 항목 reason 배열 */ protected function installSelectedLanguagePacks(array $bundledIdentifiers): array { if (empty($bundledIdentifiers)) { return []; } /** @var LanguagePackService $service */ $service = app(LanguagePackService::class); $failures = []; foreach ($bundledIdentifiers as $identifier) { try { $service->installFromBundled( $identifier, autoActivate: true, installedBy: auth()->id(), ); } catch (\Throwable $e) { Log::warning('cascade language pack install failed', [ 'identifier' => $identifier, 'error' => $e->getMessage(), ]); $failures[] = [ 'identifier' => $identifier, 'reason' => $e->getMessage(), ]; } } return $failures; } }