Current state with latest updates
This commit is contained in:
@@ -49,10 +49,10 @@ final class BuildSitemapsCommand extends Command
|
||||
$t = microtime(true);
|
||||
$this->line(' Building sitemap index…');
|
||||
$index = $build->buildIndex(force: true, persist: false, families: $families);
|
||||
$disk->put('sitemap.xml', $index['content']);
|
||||
$disk->put('sitemaps/sitemap.xml', $index['content']);
|
||||
$written++;
|
||||
$this->line(sprintf(
|
||||
' <info>✔</info> sitemap.xml %d entries <comment>%.3fs</comment>',
|
||||
' <info>✔</info> sitemaps/sitemap.xml %d entries <comment>%.3fs</comment>',
|
||||
$index['url_count'],
|
||||
microtime(true) - $t,
|
||||
));
|
||||
@@ -112,6 +112,36 @@ final class BuildSitemapsCommand extends Command
|
||||
));
|
||||
}
|
||||
|
||||
foreach ($build->enabledGroupIndexes() as $groupName => $groupFamilies) {
|
||||
foreach ($groupFamilies as $family) {
|
||||
if (! in_array($family, $families, true)) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
$t = microtime(true);
|
||||
$this->line(sprintf(' Building grouped sitemap %s…', $groupName));
|
||||
|
||||
$built = $build->buildNamed($groupName, force: true, persist: false);
|
||||
|
||||
if ($built === null) {
|
||||
$this->line(sprintf(' <comment>–</comment> %s.xml <fg=red>SKIPPED</> (group builder returned null)', $groupName));
|
||||
$failed++;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$disk->put('sitemaps/' . $groupName . '.xml', $built['content']);
|
||||
$written++;
|
||||
|
||||
$this->line(sprintf(
|
||||
' <info>✔</info> %s %d entries <comment>%.3fs</comment>',
|
||||
$groupName . '.xml',
|
||||
$built['url_count'] ?? 0,
|
||||
microtime(true) - $t,
|
||||
));
|
||||
}
|
||||
|
||||
// ── Summary ───────────────────────────────────────────────────────
|
||||
$this->newLine();
|
||||
$this->info(sprintf(
|
||||
@@ -295,4 +325,4 @@ final class BuildSitemapsCommand extends Command
|
||||
|
||||
return array_values(array_filter($enabled, fn (string $family): bool => in_array($family, $only, true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user