feat(seo): 사이트맵 증분 저장소 + 리소스 리스너 재배선
사이트맵을 리소스 단위로 영속화(sitemap_urls)해 진정한 증분 갱신과 도메인 재쿼리 없는 파일 재작성을 구현했다. 리소스 공개/비공개/삭제 시 해당 항목만 색인이 갱신되고, 관리자=full·스케줄러=auto·리소스 변경=증분으로 동작한다. - sitemap_urls 마이그레이션 + SitemapUrl 모델. loc(2048) 를 unique 에 직접 넣으면 InnoDB 키 길이를 초과하므로 loc_hash(sha256) 컬럼을 identity 로 사용 - SitemapUrlRepository(멱등 upsert / remove / 스트리밍) + SitemapIndexer (+ 제3자용 sitemap.index.collect_for_resource 필터 훅) - 4 리스너 재배선: 공개→색인 / 비공개·삭제→색인 해제 + 재생성 잡 디바운스 디스패치. 3 기여자가 resource_type/resource_id 를 함께 emit 해 전체·증분 identity 를 일치 - 재생성 모드를 SitemapGenerationMode Backed Enum 으로 통일(Command→Job→Manager) - seo:generate-sitemap 에 --rebuild / --mode 옵션 추가
This commit is contained in:
1 parent
1a6fca0d6b
commit
1629684156
34 files changed
+2027
-23
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Enums\SitemapGenerationMode;
|
||||
use App\Seo\SitemapManager;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
@@ -44,6 +45,13 @@ class GenerateSitemapJob implements ShouldBeUnique, ShouldQueue
|
||||
*/
|
||||
public int $uniqueFor = 900;
|
||||
|
||||
/**
|
||||
* GenerateSitemapJob 생성자
|
||||
*
|
||||
* @param SitemapGenerationMode $mode 재생성 모드 — SitemapManager 로 전달
|
||||
*/
|
||||
public function __construct(public SitemapGenerationMode $mode = SitemapGenerationMode::Auto) {}
|
||||
|
||||
/**
|
||||
* 유니크 락 식별자를 반환합니다.
|
||||
*
|
||||
@@ -75,7 +83,7 @@ class GenerateSitemapJob implements ShouldBeUnique, ShouldQueue
|
||||
*/
|
||||
public function handle(SitemapManager $manager): void
|
||||
{
|
||||
$result = $manager->regenerate();
|
||||
$result = $manager->regenerate($this->mode);
|
||||
|
||||
if (($result['status'] ?? null) === 'disabled') {
|
||||
Log::info('[SEO] Sitemap generation skipped (disabled)');
|
||||
|
||||
Reference in new issue
Block a user