Engagament rename; redirects installed, CLI-queued and backfilled
- new generic vitec:rename-page --page=<uid|slug> --title="...": renames a page, recalculates its own slug from the parent slug plus the new title and cascades every descendant slug - the gap a backend rename leaves open. Used to fix the "Engagament" page (#465): title, own slug and five child slugs in one run, verified live (zero occurrences left in the JSON) - SubsolutionWorkbookImporter::norm() tolerates the engagament spelling: the 39 delivered workbook metas carry the old page title, re-imports keep matching (verified) - typo3/cms-redirects installed - it had NEVER been installed, so every "redirect follows" of the 10-23 renames was wishful thinking and all old URLs answered 404. Backend slug changes now auto-create redirects - EXT:redirects' auto-creation does not fire for CLI DataHandler runs, so vitec:rename-page, vitec:normalize-slugs and vitec:align-market-pages now queue their 301 sys_redirect rows themselves in the same DataHandler run - new one-off vitec:backfill-redirects: the 28 paths vacated on 2026-10-23/26, reconstructed from the command protocols, guarded against existing redirects and live slugs; applied and verified. Note the headless semantics: a redirect arrives as the JSON envelope {"redirectUrl": ..., "statusCode": 301} with HTTP 200 - the front end must act on redirectUrl (briefing updated) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b1357a6ffe
commit
6b0b2a3511
7 files changed
+940
-489
No files matched your search
@@ -117,6 +117,7 @@ final class NormalizeSlugsCommand extends Command
|
||||
$taken[$expected] = true;
|
||||
if ((string)$child['slug'] !== $expected) {
|
||||
$datamap['pages'][(int)$child['uid']]['slug'] = $expected;
|
||||
$this->queueRedirect($datamap, (string)$child['slug'], (int)$child['uid']);
|
||||
$changes++;
|
||||
$output->writeln(sprintf(' ~ "%s" (uid %d) %s -> %s', (string)$child['title'], (int)$child['uid'], (string)$child['slug'], $expected));
|
||||
}
|
||||
@@ -124,6 +125,27 @@ final class NormalizeSlugsCommand extends Command
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Queues the 301 for a vacated slug in the same DataHandler run -
|
||||
* EXT:redirects' automatic creation does not fire for CLI DataHandler
|
||||
* runs (found 2026-10-26: every renamed URL answered 404).
|
||||
*
|
||||
* @param array<string,array<int|string,array<string,mixed>>> $datamap
|
||||
*/
|
||||
private function queueRedirect(array &$datamap, string $oldSlug, int $pageUid): void
|
||||
{
|
||||
$oldSlug = rtrim($oldSlug, '/');
|
||||
if ($oldSlug === '') {
|
||||
return;
|
||||
}
|
||||
$datamap['sys_redirect']['NEWR' . substr(md5($oldSlug), 0, 10)] = [
|
||||
'pid' => 0,
|
||||
'source_host' => '*',
|
||||
'source_path' => $oldSlug,
|
||||
'target' => 't3://page?uid=' . $pageUid,
|
||||
'target_statuscode' => 301,
|
||||
];
|
||||
}
|
||||
private function slugify(string $value, string $style): string
|
||||
{
|
||||
$value = mb_strtolower(trim($value));
|
||||
|
||||
Reference in new issue
Block a user