VitecMetaHandler: /insights/news?page=2 (und ?category=) bekommt einen selbstreferenzierenden Canonical statt Seite 1 (0100-FE 5.1). PageJsonLdRenderer: auf Produkt-, News- und Story-Detailseiten ersetzt der Datensatz (Titel + URL) die Shell-Seite als letztes Breadcrumb- Element (0108-FE F11). UsecaseListJsonRenderer: cardImage.crops aus den Listen-Karten entfernt, ~20 kB pro Seite mit Testimonial-Band (0102-FE 5). Migration fe_answers_fixes_20261111 (angewendet): Platzhalter 'H1 Header' (/solutions) und 'Featured Product' (Startseite, Lorem ipsum, CTA auf /product) versteckt; Karte 'Government' auf /markets/government; Button in #699 'Explore our solutions'; Story CDC h4 'Product Highlight' -> h3 (0104-FE 4.1). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
114 lines
5.4 KiB
PHP
114 lines
5.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Data points from the frontend answers 0100-FE / 0104-FE / 0108-FE (2026-11-10).
|
|
*
|
|
* 1. /solutions: header element #1 "H1 Header" is an import placeholder -> hidden.
|
|
* 2. Home: #757 vitec_featuredcontent "Featured Product" carries lorem ipsum
|
|
* and links the empty /product shell -> hidden (placeholder).
|
|
* 3. Home: #702 vitec_card "Government" linked /markets/defense-and-security
|
|
* -> /markets/government (where the footer sends "Government").
|
|
* 4. Home: #699 text, button "Learn more" -> "Explore our solutions".
|
|
* 5. Story CDC: <h4>Product Highlight</h4> under an h2 -> <h3>.
|
|
*
|
|
* Dry run: php migrations/fe_answers_fixes_20261111.php
|
|
* Write: php migrations/fe_answers_fixes_20261111.php --apply
|
|
*/
|
|
|
|
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("no project root\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 $apply ? "== APPLY ==\n" : "== DRY RUN (add --apply to write) ==\n";
|
|
$now = time();
|
|
$set = static function (string $table, int $uid, string $field, string $value) use ($pdo, $apply, $now): void {
|
|
if ($apply) { $pdo->prepare("UPDATE $table SET $field = ?, tstamp = ? WHERE uid = ?")->execute([$value, $now, $uid]); }
|
|
};
|
|
$ce = static function (int $uid) use ($pdo): ?array {
|
|
$st = $pdo->prepare("SELECT uid, pid, CType, header, hidden, bodytext, vitec_primary_cta, vitec_cta FROM tt_content WHERE deleted = 0 AND uid = ?");
|
|
$st->execute([$uid]);
|
|
$r = $st->fetch();
|
|
return $r ?: null;
|
|
};
|
|
|
|
echo "\n1./2. Platzhalter-Elemente verstecken\n";
|
|
foreach ([1 => 'H1 Header', 757 => 'Featured Product'] as $uid => $expect) {
|
|
$c = $ce($uid);
|
|
if (!$c) { echo " #$uid fehlt\n"; continue; }
|
|
if ($c['header'] !== $expect) { echo " #$uid hat Header '{$c['header']}' (erwartet '$expect') - uebersprungen\n"; continue; }
|
|
if ((int)$c['hidden'] === 1) { echo " #$uid schon versteckt\n"; continue; }
|
|
echo " #$uid {$c['CType']} \"{$c['header']}\" auf Seite {$c['pid']}: hidden = 1\n";
|
|
$set('tt_content', $uid, 'hidden', '1');
|
|
}
|
|
|
|
echo "\n3. Karte 'Government' (#702)\n";
|
|
$c = $ce(702);
|
|
if ($c && $c['vitec_primary_cta'] === 't3://page?uid=37') {
|
|
echo " #702 CTA t3://page?uid=37 (/markets/defense-and-security) -> t3://page?uid=526 (/markets/government)\n";
|
|
$set('tt_content', 702, 'vitec_primary_cta', 't3://page?uid=526');
|
|
} else {
|
|
echo " #702: CTA ist '" . ($c['vitec_primary_cta'] ?? '?') . "' - uebersprungen\n";
|
|
}
|
|
|
|
echo "\n4. Text #699: Button-Text\n";
|
|
$c = $ce(699);
|
|
if ($c && str_contains((string)$c['bodytext'], '>Learn more</a>')) {
|
|
echo " #699: 'Learn more' -> 'Explore our solutions'\n";
|
|
$set('tt_content', 699, 'bodytext', str_replace('>Learn more</a>', '>Explore our solutions</a>', (string)$c['bodytext']));
|
|
} else {
|
|
echo " #699: kein 'Learn more'-Button gefunden - uebersprungen\n";
|
|
}
|
|
|
|
echo "\n5. Story CDC: h4 'Product Highlight' -> h3\n";
|
|
$pattern = '~<h4(\s[^>]*)?>(\s*Product Highlight\s*)</h4>~i';
|
|
$n = 0;
|
|
foreach ($pdo->query("SELECT c.uid, u.slug, c.bodytext FROM tt_content c LEFT JOIN tx_vitec_domain_model_usecase u ON u.uid = c.tx_vitec_usecase_content WHERE c.deleted = 0 AND c.bodytext LIKE '%Product Highlight%'")->fetchAll() as $r) {
|
|
$new = (string)preg_replace($pattern, '<h3$1>$2</h3>', (string)$r['bodytext'], -1, $count);
|
|
if ($count === 0) { continue; }
|
|
$n++;
|
|
echo " tt_content #{$r['uid']} (Story " . ($r['slug'] ?? '-') . "): $count x h4 -> h3\n";
|
|
$set('tt_content', (int)$r['uid'], 'bodytext', $new);
|
|
}
|
|
// The story text may also live on the record itself.
|
|
$cols = $pdo->query("SHOW COLUMNS FROM tx_vitec_domain_model_usecase")->fetchAll(PDO::FETCH_COLUMN);
|
|
foreach ($cols as $col) {
|
|
if (!in_array($col, ['description', 'teaser', 'subtitle'], true)) { continue; }
|
|
foreach ($pdo->query("SELECT uid, slug, $col AS v FROM tx_vitec_domain_model_usecase WHERE deleted = 0 AND $col LIKE '%Product Highlight%'")->fetchAll() as $r) {
|
|
$new = (string)preg_replace($pattern, '<h3$1>$2</h3>', (string)$r['v'], -1, $count);
|
|
if ($count === 0) { continue; }
|
|
$n++;
|
|
echo " usecase #{$r['uid']} ({$r['slug']}) Feld $col: $count x h4 -> h3\n";
|
|
$set('tx_vitec_domain_model_usecase', (int)$r['uid'], $col, $new);
|
|
}
|
|
}
|
|
// Story sections live in the content-block collection table vitec_items.
|
|
foreach ($pdo->query("SELECT uid, text FROM vitec_items WHERE deleted = 0 AND text LIKE '%Product Highlight%'")->fetchAll() as $r) {
|
|
$new = (string)preg_replace($pattern, '<h3$1>$2</h3>', (string)$r['text'], -1, $count);
|
|
if ($count === 0) { continue; }
|
|
$n++;
|
|
echo " vitec_items #{$r['uid']}: $count x h4 -> h3\n";
|
|
$set('vitec_items', (int)$r['uid'], 'text', $new);
|
|
}
|
|
if ($n === 0) { echo " nichts gefunden (Text liegt woanders)\n"; }
|
|
|
|
echo "\nSSR-Pfade: / /solutions /success-stories/centers-for-disease-control-cdc\n";
|
|
echo $apply ? "FERTIG.\n" : "(Trockenlauf, nichts geschrieben)\n";
|