fix(core,board,ecommerce,page,gdpr,basic): 깊은 OFFSET 목록 조회 개선 및 raw/테이블명 전수 정리
목록이 뒤쪽 페이지로 갈수록 느려지는 원인은 건너뛰는 행의 넓은 컬럼까지 읽는 것이었다. 지연 조인(inner 는 키 컬럼만, outer 는 이번 페이지 행만 전체 컬럼)과 정렬 컬럼 해석을 코어 공통 트레이트로 두고 코어 8 + 확장 6 저장소에 적용했다. 감사 지적 처리: - 그룹 쿼리의 총 건수 오산 — count 는 groupBy 를 벗기지 않아 첫 그룹의 행 수를 총 건수로 돌려준다. getCountForPagination 으로 교정. - audit 전수 스캔이 버퍼 한계로 한 번도 동작하지 않던 결함과, 확장 경로를 놓치던 정규식 5건을 함께 고쳤다. 그동안 번들 확장의 위반이 보이지 않았다. raw 20건을 빌더 표현으로 치환하고 하드코딩 테이블명 16건을 모델 유래로 바꿨다. 이 과정에서 마이페이지 「내가 댓글 단 글」 검색이 조인 별칭 충돌로 SQL 오류를 내던 결함이 해소됐다. 재발 차단용 룰 2종을 신설하고, 컬럼 프루닝 룰을 error 로 승격했다 (전역 위반 0건 — warning 으로 두면 "0 error" 판정을 통과하며 무음으로 재누적된다). 정렬 허용 목록은 FormRequest 게이트를 덮어야 한다. 좁으면 검증을 통과한 정렬이 422 도 로그도 없이 기본값으로 되돌아간다(스케줄 실행 이력의 종료시각·소요시간 정렬이 그랬다). 호출처를 스캔해 매핑 완전성까지 검사하는 계약 테스트로 전수 강제한다. 해외 배송지 결함도 함께 고쳤다 — 조회는 city/state/postal_code 로 내려주고 폼은 intl_* 로 제출하는 비대칭 때문에, 수정 시 입력칸이 비어 보이고 저장하면 기존 값이 유실됐다. 쿠폰 수정의 유효기간 미검증과 1인당 사용 제한 부분 수정 차단도 함께 수정.
This commit is contained in:
1 parent
95ffdf9eed
commit
be9befe023
81 files changed
+5799
-457
No files matched your search
@@ -4,7 +4,7 @@
|
||||
형식은 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/)를 따르며,
|
||||
[Semantic Versioning](https://semver.org/lang/ko/)을 준수합니다.
|
||||
|
||||
## [1.0.2] - 2026-07-27
|
||||
## [1.0.2] - 2026-07-30
|
||||
|
||||
### Added
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
- 거부 시 안내 문구를 「동의하지 않고 계속합니다」로 바로잡았습니다 (이전에는 「동의가 저장되었습니다」로 잘못 표시).
|
||||
- 관리자 환경설정의 「쿠키 배너 노출」 안내 문구를 실제 동작에 맞게 바로잡았습니다 — 이 토글은 배너와 자동 차단만 제어하며, 마이페이지 「쿠키 동의 관리」 카드는 동의·철회 이력이 있는 회원에게 이 토글과 무관하게 항상 노출됩니다.
|
||||
- 사이트 언어를 바꾼 뒤 쿠키 동의를 저장하면 차단 해제·재차단이 즉시 반영되지 않던 문제를 수정했습니다. 페이지를 새로 고쳐야 반영되던 증상입니다.
|
||||
- 관리자 「GDPR 동의 이력」 목록이 뒤쪽 페이지로 갈수록 느려지던 문제를 개선했습니다. 이력이 많이 쌓인 사이트에서 특히 체감됩니다. (#74 @jiwonpapa 님께서 제보해주셨습니다.)
|
||||
- 정책 버전 이력 목록에서 화면에 쓰지 않는 발행 시점 스냅샷 본문을 더 이상 함께 읽지 않습니다. 목록 조회가 가벼워집니다. (#74 @jiwonpapa 님께서 제보해주셨습니다.)
|
||||
- 코어 최소 요구 버전을 7.0.6 으로 상향했습니다. 이 플러그인을 업데이트하기 전에 코어를 먼저 최신으로 업데이트하세요.
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"en": "GDPR-ready plugin: cookie consent banner, auto-blocking, consent history, and mypage consent withdrawal."
|
||||
},
|
||||
"license": "MIT",
|
||||
"g7_version": ">=7.0.5",
|
||||
"g7_version": ">=7.0.6",
|
||||
"dependencies": {
|
||||
"modules": {},
|
||||
"plugins": {}
|
||||
|
||||
@@ -28,7 +28,7 @@ class GdprPolicyVersionRepository implements GdprPolicyVersionRepositoryInterfac
|
||||
*
|
||||
* createdBy 관계를 eager load 하여 admin snapshot 모달의 발행자 표시에 활용.
|
||||
*
|
||||
* @param int $version 조회할 정책 버전 정수
|
||||
* @param int $version 조회할 정책 버전 정수
|
||||
* @return GdprPolicyVersion|null 해당 버전 row 가 없으면 null
|
||||
*/
|
||||
public function getByVersion(int $version): ?GdprPolicyVersion
|
||||
@@ -54,7 +54,7 @@ class GdprPolicyVersionRepository implements GdprPolicyVersionRepositoryInterfac
|
||||
/**
|
||||
* 관리자 화면용 페이지네이션 조회 (version DESC).
|
||||
*
|
||||
* @param int $perPage 페이지당 행 수 (1~100 사이로 clamp)
|
||||
* @param int $perPage 페이지당 행 수 (1~100 사이로 clamp)
|
||||
* @return LengthAwarePaginator
|
||||
*/
|
||||
public function paginate(int $perPage): LengthAwarePaginator
|
||||
@@ -62,13 +62,19 @@ class GdprPolicyVersionRepository implements GdprPolicyVersionRepositoryInterfac
|
||||
return GdprPolicyVersion::query()
|
||||
->with('createdBy')
|
||||
->orderByDesc('version')
|
||||
->paginate(max(1, min(100, $perPage)));
|
||||
// audit:allow repository-paginate-column-pruning reason: 발행 이력은 정책 변경 시에만
|
||||
// 늘어나는 정의성 테이블이라 깊은 OFFSET 이 성립하지 않는다. 넓은 컬럼(snapshot JSON)은
|
||||
// 아래 컬럼 목록에서 제외했고, 본문은 상세 조회(getByVersion)에서만 읽는다.
|
||||
->paginate(
|
||||
max(1, min(100, $perPage)),
|
||||
['id', 'version', 'change_type', 'memo', 'created_by', 'created_at'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 새 정책 버전 행을 생성합니다.
|
||||
*
|
||||
* @param array $data ['version', 'change_type', 'memo', 'snapshot', 'created_by']
|
||||
* @param array $data ['version', 'change_type', 'memo', 'snapshot', 'created_by']
|
||||
* @return GdprPolicyVersion
|
||||
*/
|
||||
public function create(array $data): GdprPolicyVersion
|
||||
|
||||
+38
-9
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Plugins\Sirsoft\Gdpr\Repositories;
|
||||
|
||||
use App\Repositories\Concerns\PaginatesWithDeferredJoin;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Plugins\Sirsoft\Gdpr\Models\GdprUserConsentHistory;
|
||||
@@ -12,10 +13,31 @@ use Plugins\Sirsoft\Gdpr\Repositories\Contracts\GdprUserConsentHistoryRepository
|
||||
*/
|
||||
class GdprUserConsentHistoryRepository implements GdprUserConsentHistoryRepositoryInterface
|
||||
{
|
||||
use PaginatesWithDeferredJoin;
|
||||
|
||||
/**
|
||||
* 관리자 목록이 실제로 표시하는 컬럼 (GdprConsentLogResource 와 1:1).
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
private const LIST_COLUMNS = [
|
||||
'id',
|
||||
'user_id',
|
||||
'session_id',
|
||||
'consent_key',
|
||||
'action',
|
||||
'source',
|
||||
'policy_version',
|
||||
'categories',
|
||||
'ip_address',
|
||||
'user_agent',
|
||||
'created_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* 동의 이력 레코드를 생성합니다.
|
||||
*
|
||||
* @param array $data 이력 데이터
|
||||
* @param array $data 이력 데이터
|
||||
* @return GdprUserConsentHistory
|
||||
*/
|
||||
public function record(array $data): GdprUserConsentHistory
|
||||
@@ -32,10 +54,8 @@ class GdprUserConsentHistoryRepository implements GdprUserConsentHistoryReposito
|
||||
*/
|
||||
public function paginateForAdmin(array $filters, int $perPage): LengthAwarePaginator
|
||||
{
|
||||
$query = GdprUserConsentHistory::query()
|
||||
->with('user')
|
||||
->orderByDesc('created_at')
|
||||
->orderByDesc('id');
|
||||
// 정렬/관계는 지연 조인이 담당한다 (inner 는 키 컬럼만 조회)
|
||||
$query = GdprUserConsentHistory::query();
|
||||
|
||||
if (! empty($filters['email'])) {
|
||||
$email = (string) $filters['email'];
|
||||
@@ -63,13 +83,22 @@ class GdprUserConsentHistoryRepository implements GdprUserConsentHistoryReposito
|
||||
$query->whereIn('source', $filters['sources']);
|
||||
}
|
||||
|
||||
return $query->paginate(max(1, min(100, $perPage)));
|
||||
// 동의 이력은 방문자의 동의 변경마다 한 행씩 쌓여 상한이 없다. 뒤쪽 페이지에서
|
||||
// OFFSET 이 커져도 넓은 컬럼(categories JSON / user_agent)을 읽는 행 수가 페이지
|
||||
// 크기로 고정되도록 지연 조인을 쓴다.
|
||||
return $this->paginateWithDeferredJoin(
|
||||
query: $query,
|
||||
columns: self::LIST_COLUMNS,
|
||||
sort: [['column' => 'created_at', 'direction' => 'desc']],
|
||||
perPage: max(1, min(100, $perPage)),
|
||||
relations: ['user'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 ID로 동의 이력을 조회합니다 (최신순).
|
||||
*
|
||||
* @param int $userId 사용자 ID
|
||||
* @param int $userId 사용자 ID
|
||||
* @return Collection<int, GdprUserConsentHistory>
|
||||
*/
|
||||
public function getByUserId(int $userId): Collection
|
||||
@@ -83,7 +112,7 @@ class GdprUserConsentHistoryRepository implements GdprUserConsentHistoryReposito
|
||||
/**
|
||||
* 게스트 세션 ID로 동의 이력을 조회합니다 (최신순).
|
||||
*
|
||||
* @param string $sessionId 게스트 세션 ID
|
||||
* @param string $sessionId 게스트 세션 ID
|
||||
* @return Collection<int, GdprUserConsentHistory>
|
||||
*/
|
||||
public function getBySessionId(string $sessionId): Collection
|
||||
@@ -97,7 +126,7 @@ class GdprUserConsentHistoryRepository implements GdprUserConsentHistoryReposito
|
||||
/**
|
||||
* 사용자 식별 정보를 NULL로 익명화합니다 (사용자 완전 삭제 시 감사 추적용).
|
||||
*
|
||||
* @param int $userId 사용자 ID
|
||||
* @param int $userId 사용자 ID
|
||||
* @return int 영향받은 행 수
|
||||
*/
|
||||
public function anonymizeForUser(int $userId): int
|
||||
|
||||
Reference in new issue
Block a user