Files
VITEC-website/migrations/fix_graphics_grid.php
T
orascheandClaude Fable 5 77661bf0b6 Datapath stories, grid repairs, menu v2 pure, hero placeholders, fec test
Batch of 2026-10-28/29 plus 2026-11-03:

- NEW vitec:import-datapath-stories: 22 story packages from the agency
  dump (docx + Links/ assets) as usecase records with content, quotes,
  images, customer logos, download cards; --repair-quotes normalizes
  attribution lines; asset backfill for existing stories
- /products grid incident repaired (fix_products_grid, fix_graphics_grid,
  check_grid_page): containers unhidden, 46 duplicate cards soft-deleted,
  section order restored; BuildProductPortfolio and
  ImportProductCategoryPages now GUARD against re-runs on pages that
  already carry vitec_cols_% containers
- ' double-encoding fixed: render-pipeline importers write literal
  apostrophes (ENT_NOQUOTES), fix_double_entities literalizes existing rows
- ticket quick wins (ticket_quickwins_20261028), broadcast market page
  cleanup, AttachCardImages market-card handling, SubmarketWorkbook
  META REPAIR, story content/video fixes (fix_story_*)
- ProvideProductCatalog: transitional v1 fields removed (categories
  uid/link, legacyGroupFields, item products teaser) - pure v2 shape
  (ticket 0024-FE); search renderer keeps its teaser
- BuildProductOverviews: heroes get the numbered placeholder background
  (placeholders/pages/<uid>-01.png, wide grey fallback) - backfill on
  existing pages with empty hero_bgimage, attached at creation for new
  pages; existing references always win (ticket 0026-FE); 40 placeholder
  PNGs shipped to fileadmin (not tracked)
- AttachPageMedia: --depth=3 with sysfolders as pass-through parents for
  the overview pages' -08 menu tiles
- NEW migrations/fec_isolation_test.sh: two-user live test proving
  fe_comment ticket isolation (backend verified tight, cross-user
  sighting traced to the FE page-JSON cache, ticket 0027-BE)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-03 18:29:56 +01:00

89 lines
3.3 KiB
PHP

<?php
declare(strict_types=1);
/**
* Ticket 0014-FE, Folge-Befund: pid 569 (/products/graphics-and-multi-display)
* nach dem IQS4-Kategorie-Re-Import. Container und ihre Kinder sind intakt,
* aber: 8 Duplikat-Karten top-level in colPos0 (11853-11860) und die Grids
* stehen falsch relativ zu ihren Intros (11840 vor 11629, 11841 vor 11632).
*
* Reparatur: Duplikate soft-loeschen, colPos0 in Sektions-Folge neu sortieren.
*
* Usage: php migrations/fix_graphics_grid.php (inspect)
* php migrations/fix_graphics_grid.php --apply
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
const PID = 569;
const DUPLICATES = [11853, 11854, 11855, 11856, 11857, 11858, 11859, 11860];
// Intro -> Grid(s): Why VITEC -> 11838 (3 Benefit-Karten) + 11839 (1),
// Finder-Intro + Comparison-Text, Products-Intro -> 11840 (IGC + IQS4),
// Solutions-Intro -> 11841 (2 Solution-Karten)
const ORDER = [11620, 11621, 11622, 11838, 11839, 11627, 11628, 11629, 11840, 11632, 11841];
$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 ($apply ? 'APPLY' : 'INSPECT') . " · pid " . PID . "\n\n";
$rows = $pdo->query('SELECT uid, CType, colPos, LEFT(header,40) h FROM tt_content WHERE deleted = 0 AND pid = ' . PID)->fetchAll();
$byUid = [];
foreach ($rows as $row) {
$byUid[(int)$row['uid']] = $row;
}
foreach (array_merge(ORDER, DUPLICATES) as $uid) {
if (!isset($byUid[$uid])) {
exit("ABBRUCH: uid $uid fehlt auf der Seite - erst klaeren.\n");
}
}
$tail = [];
foreach ($pdo->query('SELECT uid, CType, LEFT(header,40) h FROM tt_content WHERE deleted = 0 AND pid = ' . PID . ' AND colPos = 0 ORDER BY sorting, uid') as $row) {
$uid = (int)$row['uid'];
if (!in_array($uid, ORDER, true) && !in_array($uid, DUPLICATES, true)) {
$tail[] = $uid;
echo "tail: #$uid {$row['CType']} \"{$row['h']}\"\n";
}
}
echo "\n1) " . count(DUPLICATES) . " Duplikat-Karten soft-loeschen: " . implode(',', DUPLICATES) . "\n";
echo "2) colPos0 neu sortieren:\n";
$sequence = array_merge(ORDER, $tail);
foreach ($sequence as $i => $uid) {
$r = $byUid[$uid];
printf(" %3d. #%-6d %-22s %s\n", $i + 1, $uid, $r['CType'], $r['h']);
}
if (!$apply) {
echo "\nInspect only - mit --apply schreiben.\n";
exit(0);
}
$pdo->exec('UPDATE tt_content SET deleted = 1, tstamp = UNIX_TIMESTAMP() WHERE uid IN (' . implode(',', DUPLICATES) . ')');
$sorting = 0;
$stmt = $pdo->prepare('UPDATE tt_content SET sorting = ?, tstamp = UNIX_TIMESTAMP() WHERE uid = ?');
foreach ($sequence as $uid) {
$sorting += 256;
$stmt->execute([$sorting, $uid]);
}
echo "\nGeschrieben. Danach: vendor/bin/typo3 cache:flush\n";