Current state with latest updates
This commit is contained in:
@@ -130,6 +130,7 @@ final class SitemapPublishService
|
||||
$releaseId ??= $this->releases->generateReleaseId();
|
||||
|
||||
$familyManifest = [];
|
||||
$groupManifest = [];
|
||||
$documents = [
|
||||
SitemapCacheService::INDEX_DOCUMENT => $this->releases->documentRelativePath(SitemapCacheService::INDEX_DOCUMENT),
|
||||
];
|
||||
@@ -180,15 +181,43 @@ final class SitemapPublishService
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($this->build->enabledGroupIndexes() as $groupName => $groupFamilies) {
|
||||
foreach ($groupFamilies as $family) {
|
||||
if (! in_array($family, $selectedFamilies, true)) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
$built = $this->build->buildNamed($groupName, true, false);
|
||||
|
||||
if ($built === null) {
|
||||
throw new \RuntimeException('Failed to build sitemap group [' . $groupName . '].');
|
||||
}
|
||||
|
||||
$this->releases->putDocument($releaseId, $groupName, (string) $built['content']);
|
||||
$documents[$groupName] = $this->releases->documentRelativePath($groupName);
|
||||
|
||||
$groupManifest[$groupName] = [
|
||||
'name' => $groupName,
|
||||
'entry_name' => $groupName,
|
||||
'families' => $groupFamilies,
|
||||
'documents' => [$groupName],
|
||||
'url_count' => (int) $built['url_count'],
|
||||
'type' => SitemapTarget::TYPE_INDEX,
|
||||
];
|
||||
}
|
||||
|
||||
$manifest = [
|
||||
'release_id' => $releaseId,
|
||||
'status' => 'built',
|
||||
'built_at' => now()->toAtomString(),
|
||||
'published_at' => null,
|
||||
'families' => $familyManifest,
|
||||
'groups' => $groupManifest,
|
||||
'documents' => $documents,
|
||||
'totals' => [
|
||||
'families' => count($familyManifest),
|
||||
'groups' => count($groupManifest),
|
||||
'documents' => count($documents),
|
||||
'urls' => $totalUrls,
|
||||
],
|
||||
@@ -204,4 +233,4 @@ final class SitemapPublishService
|
||||
|
||||
return $manifest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user