fix(extension): 확장 수명주기 캐시 무효화 순서 회귀 및 실패 사유 전달

route:cache 는 새 앱을 부팅해 라우트를 수집하고, 그 부팅의 확장 라우트 프로바이더는
DB 가 아니라 캐시된 활성 확장 목록을 읽는다. 그래서 rebuild 가
invalidate*StatusCache 보다 앞서면 방금 바뀐 상태가 빠진 채 라우트가 박제되고,
라우트 캐시에는 스캔 폴백이 없어 오류도 로그도 없이 404 가 된다. 무효화를 굽기 직전이
아니라 DB 상태 쓰기 직후로 올려, 같은 목록을 읽는 훅 매핑 캐시까지 함께 바로잡았다.
update 경로는 Updating 전이 직후에 비우면 그 창의 오토로드 갱신이 확장을 비활성으로
판정하므로, 상태 복원 직후에 비운 뒤 훅 캐시를 다시 굽는다.

플러그인 라우트 프로바이더에는 활성 게이트가 없어 비활성 플러그인의 API 가 계속
응답했다. 화면·메뉴만 사라지고 기능은 살아 있는 상태였다. 모듈과 같은 기준을 적용했다.

실패 사유가 하위 계층에서 버려져 관리자 화면에 :error 자리표시자가 그대로 노출되던
문제도 고쳤다. 반환 경로를 깨지 않도록 배열 키 reason 과 뒤에 붙인 선택적 out
파라미터로 사유를 실어 올리고, 확장이 수명주기 훅에서 사유를 남길 수 있는 통로를
추가했다. 설치 경로의 광역 RuntimeException catch 는 도메인 예외로 좁혀 원본 키와
파라미터를 응답에 싣는다 — 상태코드 422 는 유지해 사용자 계약을 함께 바꾸지 않는다.
언어팩 화면은 프로덕션에서 예외 원문을 싣지 않는 것이 확정된 계약이므로, 자리를
일반 문구로 채우는 대신 치환 자리 자체를 제거했다. 원문은 종전대로 errors 통로를
거쳐 디버그 모드에서 도달한다.
This commit is contained in:
HeuJung committed 2026-08-21 17:09:30 +09:00
1 parent 565f6c0117
commit 03cbb99196
35 files changed
+1362 -239

No files matched your search

+19 -6
View File
@@ -242,6 +242,7 @@ class ModuleService
* @param string $moduleName 설치할 모듈명
* @param VendorMode $vendorMode Vendor 설치 모드
* @param bool $force Updating/Failed 등 진행 중 상태도 무시하고 강제 설치 여부
* @param string|null $failureReason 실패 시 사유가 담기는 out 파라미터 (성공 시 null)
* @return array|null 설치된 모듈 정보 또는 null
*
* @throws ValidationException 모듈 설치 실패 시
@@ -250,12 +251,15 @@ class ModuleService
string $moduleName,
VendorMode $vendorMode = VendorMode::Auto,
bool $force = false,
?string &$failureReason = null,
): ?array {
$failureReason = null;
HookManager::doAction('core.modules.before_install', $moduleName);
try {
$this->moduleManager->loadModules();
$result = $this->moduleManager->installModule($moduleName, null, $vendorMode, $force);
$result = $this->moduleManager->installModule($moduleName, null, $vendorMode, $force, $failureReason);
if ($result) {
// 설치 후 모듈 정보 반환
@@ -307,7 +311,9 @@ class ModuleService
];
}
return ['success' => false];
// 실패 사유(reason)를 그대로 전달한다 — 여기서 떨어뜨리면 관리자 화면의
// 실패 문구에 원인 자리가 비어 자리표시자가 그대로 노출된다.
return $result;
} catch (\Exception $e) {
throw ValidationException::withMessages([
'module_name' => [__('modules.activation_failed', ['error' => $e->getMessage()])],
@@ -359,12 +365,15 @@ class ModuleService
*
* @param string $moduleName 제거할 모듈명
* @param bool $deleteData 모듈 데이터(테이블) 삭제 여부
* @param string|null $failureReason 실패 시 사유가 담기는 out 파라미터 (성공 시 null)
* @return bool 제거 성공 여부
*
* @throws ValidationException 모듈 제거 실패 시
*/
public function uninstallModule(string $moduleName, bool $deleteData = false): bool
public function uninstallModule(string $moduleName, bool $deleteData = false, ?string &$failureReason = null): bool
{
$failureReason = null;
HookManager::doAction('core.modules.before_uninstall', $moduleName, $deleteData);
try {
@@ -372,7 +381,7 @@ class ModuleService
$this->moduleManager->loadModules();
$moduleInfo = $this->moduleManager->getModuleInfo($moduleName);
$result = $this->moduleManager->uninstallModule($moduleName, $deleteData);
$result = $this->moduleManager->uninstallModule($moduleName, $deleteData, null, $failureReason);
if ($result) {
$module = $this->moduleRepository->findByName($moduleName);
@@ -867,10 +876,14 @@ class ModuleService
private function executeModuleInstall(string $identifier): array
{
$this->moduleManager->loadModules();
$result = $this->moduleManager->installModule($identifier);
$result = $this->moduleManager->installModule($identifier, null, VendorMode::Auto, false, $failureReason);
if (! $result) {
throw new ModuleOperationException('modules.errors.install_failed');
// 사유를 실어 올리지 않으면 'modules.errors.install_failed' 의 치환 자리가
// 비어 관리자 화면에 리터럴 ':error' 가 그대로 노출된다.
throw new ModuleOperationException('modules.errors.install_failed', [
'error' => $failureReason ?? __('modules.errors.unknown_error'),
]);
}
return $this->moduleManager->getModuleInfo($identifier);