$constraint, 'error' => $e->getMessage(), ]); return false; } } /** * 확장의 코어 버전 호환성 검증 * * @param string|null $requiredVersion 요구 버전 제약 * @param string $identifier 확장 식별자 * @param string $type 확장 타입 (module, plugin, template) * @return bool 항상 true (검증 실패 시 예외 발생) * * @throws Exception 버전 미충족 시 */ public static function validateExtension( ?string $requiredVersion, string $identifier, string $type ): bool { if ($requiredVersion === null) { return true; } if (! self::satisfies($requiredVersion)) { throw new Exception(__('extensions.errors.core_version_mismatch', [ 'extension' => $identifier, 'type' => __('extensions.types.'.$type), 'required' => $requiredVersion, 'installed' => self::getCoreVersion(), ])); } return true; } /** * 확장의 코어 버전 호환성 확인 (예외 없음) * * @param string|null $requiredVersion 요구 버전 제약 * @return bool 호환 여부 */ public static function isCompatible(?string $requiredVersion): bool { if ($requiredVersion === null) { return true; } return self::satisfies($requiredVersion); } /** * 버전 검증 캐시 키 생성 * * @param string $type 확장 타입 (modules, plugins, templates) * @return string 캐시 키 */ public static function getCacheKey(string $type): string { return self::CACHE_PREFIX.$type.'.'.self::getCoreVersion(); } /** * 모든 버전 검증 캐시 삭제 */ public static function clearCache(): void { Cache::forget(self::getCacheKey('modules')); Cache::forget(self::getCacheKey('plugins')); Cache::forget(self::getCacheKey('templates')); } /** * 캐시 TTL 반환 * * @return int 캐시 유효 시간 (초) */ public static function getCacheTtl(): int { return self::CACHE_TTL; } }