Files
Gnuboard7/app/Seo/SeoServiceProvider.php
HeuJung face022073 feat(seo): 사이트맵 재생성 진행상황 + 실시간/폴링 UI
관리자 "전체 재생성"을 큐(Full 모드)로 던지고 진행상황을 SEO 탭에서 확인한다.
Reverb ON 이면 방송 채널 구독으로 실시간 갱신, OFF 면 상태 API 폴링으로 폴백한다.

- SitemapProgress 진행상황 스토어(queued→running→writing→completed/failed,
 캐시 TTL 3600, 방송 스로틀) + SitemapManager.getStatus 확장(progress + realtime_enabled)
- GET /api/admin/seo/sitemap/status(core.settings.read) 신규
- 관리자 재생성을 항상 Full 모드로 큐잉 + 진행률 기록, Job 최종 실패 시 progress=failed 고정
- core.admin.seo.sitemap 방송 채널 인증(core.settings.read)
- SEO 탭 진행상황 UI(상태 배지/단계/누적 URL/실시간·폴링 안내) + 폴링 분기
- 재생성 중 누적 URL 표기(replaceAllForContributor 삽입 건수 반환 — count 쿼리 없이 스트림 누적)
- ja 언어팩 진행상황 UI 번역 동기화
2026-07-18 18:22:16 +09:00

58 lines
2.3 KiB
PHP

<?php
namespace App\Seo;
use App\Contracts\Extension\StorageInterface;
use App\Contracts\Repositories\SitemapUrlRepositoryInterface;
use App\Extension\Storage\CoreStorageDriver;
use App\Repositories\SitemapUrlRepository;
use App\Seo\Contracts\SeoCacheManagerInterface;
use App\Seo\Contracts\SeoRendererInterface;
use Illuminate\Support\ServiceProvider;
class SeoServiceProvider extends ServiceProvider
{
/**
* 서비스 컨테이너 바인딩을 등록합니다.
*/
public function register(): void
{
// 인터페이스 → 구현체 바인딩
$this->app->singleton(SeoCacheManagerInterface::class, SeoCacheManager::class);
$this->app->singleton(SeoRendererInterface::class, SeoRenderer::class);
$this->app->singleton(SitemapUrlRepositoryInterface::class, SitemapUrlRepository::class);
// 싱글톤 등록
$this->app->singleton(SeoCacheRegenerator::class);
$this->app->singleton(SeoInvalidationRegistry::class);
$this->app->singleton(BotDetector::class);
$this->app->singleton(ExpressionEvaluator::class);
$this->app->singleton(ComponentHtmlMapper::class);
$this->app->singleton(DataSourceResolver::class);
$this->app->singleton(TemplateRouteResolver::class);
$this->app->singleton(SeoMetaResolver::class);
$this->app->singleton(SitemapGenerator::class);
$this->app->singleton(SeoConfigMerger::class);
$this->app->singleton(SitemapFileStore::class);
$this->app->singleton(SitemapIndexer::class);
$this->app->singleton(SitemapProgress::class);
// Sitemap 파일 입출력은 비공개 디스크(local = storage/app/private, serve=false)를 사용합니다.
// public/storage 심볼릭 링크에 의존하지 않고 컨트롤러 스트리밍으로 서빙합니다.
foreach ([SitemapManager::class, SitemapFileStore::class] as $sitemapConsumer) {
$this->app->when($sitemapConsumer)
->needs(StorageInterface::class)
->give(fn () => new CoreStorageDriver('local'));
}
}
/**
* 서비스 부트스트랩을 수행합니다.
*/
public function boot(): void
{
// SeoMiddleware는 bootstrap/app.php에서 별칭 등록
// routes/web.php에서 라우트 그룹에 부착
}
}