Current state with latest updates

This commit is contained in:
2026-08-23 13:28:34 +02:00
parent 5af95f6533
commit f52879edbb
74 changed files with 5174 additions and 960 deletions
+36 -1
View File
@@ -42,6 +42,23 @@ final class SitemapBuildService
*/
public function buildNamed(string $name, bool $force = false, bool $persist = true): ?array
{
$groupFamilies = $this->groupFamilies($name);
if ($groupFamilies !== null) {
$built = $this->cache->remember(
$name,
fn (): string => $this->renderer->renderIndex($this->index->itemsForFamilies($groupFamilies)),
$force,
$persist,
);
return $built + [
'type' => SitemapTarget::TYPE_INDEX,
'url_count' => count($this->index->itemsForFamilies($groupFamilies)),
'shard_count' => 0,
'name' => $name,
];
}
$target = $this->shards->resolve($this->registry, $name);
if ($target === null) {
@@ -111,6 +128,24 @@ final class SitemapBuildService
));
}
/**
* @return list<string>|null
*/
public function groupFamilies(string $name): ?array
{
$families = $this->index->activeGroupIndexes($this->enabledFamilies())[$name] ?? null;
return is_array($families) && $families !== [] ? $families : null;
}
/**
* @return array<string, list<string>>
*/
public function enabledGroupIndexes(): array
{
return $this->index->activeGroupIndexes($this->enabledFamilies());
}
private function renderTarget(SitemapTarget $target): string
{
if ($target->type === SitemapTarget::TYPE_INDEX) {
@@ -140,4 +175,4 @@ final class SitemapBuildService
return count($target->builder->items());
}
}
}