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
@@ -29,15 +29,7 @@ final class SitemapValidationService
? array_values(array_filter($onlyFamilies, fn (string $family): bool => $this->registry->get($family) !== null))
: $this->build->enabledFamilies();
$expectedIndexLocs = array_map(
static fn (SitemapIndexItem $item): string => $item->loc,
array_values(array_filter(
$this->index->items(),
fn (SitemapIndexItem $item): bool => $this->isFamilySelected($families, $item->loc),
)),
);
$indexBuild = $this->build->buildIndex(true, false);
$indexBuild = $this->build->buildIndex(true, false, $families);
$indexErrors = [];
$indexXml = $this->loadXml($indexBuild['content']);
@@ -45,6 +37,7 @@ final class SitemapValidationService
$indexErrors[] = 'The main sitemap index XML could not be parsed.';
}
$expectedIndexLocs = $this->extractLocsFromContent((string) $indexBuild['content'], 'sitemap');
$actualIndexLocs = $indexXml ? $this->extractLocs($indexXml, 'sitemap') : [];
if ($indexXml !== null && $actualIndexLocs !== $expectedIndexLocs) {
$indexErrors[] = 'Main sitemap index child references do not match the expected shard-aware manifest.';
@@ -214,15 +207,14 @@ final class SitemapValidationService
return $locs;
}
private function isFamilySelected(array $families, string $loc): bool
/**
* @return list<string>
*/
private function extractLocsFromContent(string $content, string $nodeName): array
{
foreach ($families as $family) {
if (str_contains($loc, '/sitemaps/' . $family . '.xml') || str_contains($loc, '/sitemaps/' . $family . '-')) {
return true;
}
}
$document = $this->loadXml($content);
return false;
return $document === null ? [] : $this->extractLocs($document, $nodeName);
}
private function urlError(string $family, string $loc): ?string
@@ -283,4 +275,4 @@ final class SitemapValidationService
return $user === null ? 'Non-public user URL emitted' : null;
}
}
}