Content pages: Insights / Support / Contact branches from the workbooks
- new vitec:build-content-pages (dry-run by default, --branch filter,
--publish): fills all 21 content-page workbooks (Insights 7, Support 9,
Contact 5, agency status "Draft for review") with embedded copy -
the workbooks' instruction rows are deliberately not imported; two
DataHandler passes (pages first, element links need real uids),
explicit page sorting and element sequencing
- /insights became a hero page (layout 1) with six navigation cards;
the news plugin moved onto the new /insights/news (layout 12); the
standalone /events page moved under /insights (slug /insights/events,
layout 19, redirect queued - note below)
- NEW /support branch (layout 11) with eight layout-16 subpages:
HelpDesk login (external link + vitec_helpdeskform for access
requests), support plans (Silver/Gold/Platinum cards), training plus
the Aetria/VSN course pages, commissioning, supported devices,
materials compliance (no dedicated form yet - routes to /contact)
- /contact became a hero page with six route cards; the form container
(vitec_contactform) moved onto the new /contact/contact-form; new
/contact/request-a-demo (vitec_demoform), /contact/locations
(vitec_locationlist; three Datapath offices as HIDDEN location
records pending confirmation) and /contact/showrooms (16 venues)
- unverifiable sections (sustainability claims, careers vacancies)
are hidden editorial shells; full page-properties set everywhere
- applied with --publish and verified live (all 21 routes, forms,
lists, moved plugins). Known follow-ups: /events answers 307 - an
auto-created redirect row shadows the command's 301
(migrations/fix_events_redirect.php shows and repairs it); the
"Get Support" meta-nav page still points at /components-showcase;
two CTA targets (support-plans datasheet, careers vacancies) are
editorial
- Datapath stories stay parked ("do not infer records" per the
Success Stories workbook) - documented, questions queued for Joe
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c4ec979f78
commit
3b3ef470b0
2 files changed
+992
No files matched your search
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Diagnose + repair: the /events redirect answers 307 instead of 301 after
|
||||
* vitec:build-content-pages (2026-10-27). Suspicion: EXT:redirects
|
||||
* auto-created a second sys_redirect row for the slug change (TYPO3 default
|
||||
* 307) that shadows the command's own 301 row.
|
||||
*
|
||||
* Plain PDO against config/system/settings.php (pattern migrations/check_bg.php).
|
||||
*
|
||||
* Usage: php migrations/fix_events_redirect.php (show rows)
|
||||
* php migrations/fix_events_redirect.php --apply (keep ONE 301, delete the rest)
|
||||
*/
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '1');
|
||||
|
||||
$apply = in_array('--apply', $argv, true);
|
||||
|
||||
$root = null;
|
||||
$dir = __DIR__;
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
if (is_file($dir . '/config/system/settings.php')) {
|
||||
$root = $dir;
|
||||
break;
|
||||
}
|
||||
$dir = dirname($dir);
|
||||
}
|
||||
if ($root === null) {
|
||||
exit("Could not locate project root above " . __DIR__ . "\n");
|
||||
}
|
||||
|
||||
$settings = require $root . '/config/system/settings.php';
|
||||
$db = $settings['DB']['Connections']['Default'];
|
||||
$pdo = new PDO(
|
||||
sprintf('mysql:host=%s;port=%s;dbname=%s;charset=utf8mb4', $db['host'] ?? 'localhost', $db['port'] ?? 3306, $db['dbname'] ?? ''),
|
||||
$db['user'] ?? '',
|
||||
$db['password'] ?? '',
|
||||
[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC]
|
||||
);
|
||||
|
||||
echo "=== sys_redirect rows for /events (and children) ===\n";
|
||||
$rows = $pdo->query(
|
||||
"SELECT uid, deleted, source_host, source_path, target, target_statuscode, createdon, creation_type
|
||||
FROM sys_redirect WHERE source_path LIKE '/events%' ORDER BY uid"
|
||||
)->fetchAll();
|
||||
foreach ($rows as $r) {
|
||||
echo sprintf(" #%-5d del=%d %s %s -> %s [%d] creation_type=%s created=%s\n",
|
||||
$r['uid'], $r['deleted'], $r['source_host'], $r['source_path'], $r['target'],
|
||||
$r['target_statuscode'], (string)($r['creation_type'] ?? '?'),
|
||||
date('Y-m-d H:i', (int)$r['createdon']));
|
||||
}
|
||||
if ($rows === []) {
|
||||
exit(" none - nothing to fix.\n");
|
||||
}
|
||||
|
||||
$live = array_values(array_filter($rows, fn(array $r): bool => (int)$r['deleted'] === 0 && $r['source_path'] === '/events'));
|
||||
if (count($live) === 0) {
|
||||
exit("\nNo live /events row - check manually.\n");
|
||||
}
|
||||
|
||||
// keep the command's own row (source_host '*', target t3://page) as 301,
|
||||
// delete every other live /events row
|
||||
$keep = null;
|
||||
foreach ($live as $r) {
|
||||
if ($r['source_host'] === '*' && str_starts_with((string)$r['target'], 't3://page')) {
|
||||
$keep = $r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$keep ??= $live[0];
|
||||
|
||||
echo "\nPlan: keep #{$keep['uid']} (force 301), delete " . (count($live) - 1) . " other live row(s)\n";
|
||||
if (!$apply) {
|
||||
exit("DRY RUN - add --apply to write.\n");
|
||||
}
|
||||
|
||||
$pdo->prepare('UPDATE sys_redirect SET target_statuscode = 301 WHERE uid = ?')->execute([(int)$keep['uid']]);
|
||||
foreach ($live as $r) {
|
||||
if ((int)$r['uid'] !== (int)$keep['uid']) {
|
||||
$pdo->prepare('UPDATE sys_redirect SET deleted = 1 WHERE uid = ?')->execute([(int)$r['uid']]);
|
||||
echo " deleted #{$r['uid']}\n";
|
||||
}
|
||||
}
|
||||
echo "Done. Flush the cache (redirects are cached), then re-test /events.\n";
|
||||
Reference in new issue
Block a user