Files
VITEC-website/migrations/cleanup_broadcast_market_page.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

102 lines
3.8 KiB
PHP

<?php
declare(strict_types=1);
/**
* Ticket 0010-FE Punkt 1: /markets/broadcast-and-telecoms ist eine Mischseite
* (alte Pilotseite): vitec_herosection/Container/text/marketlist-Reste plus
* colPos220-Legacy NEBEN dem 27.10.-Import. Ziel: exakt das Schema der zehn
* anderen Market-Seiten (colPos1: markethero + introparagraph; colPos0:
* marketintro, introparagraph, 2 cards, ctabanner).
*
* Whitelist = die acht Import-Elemente vom 27.10.; ALLES andere auf der
* Seite wird soft-geloescht (deleted=1, wiederherstellbar).
*
* Plain PDO (Muster migrations/check_bg.php).
*
* Usage: php migrations/cleanup_broadcast_market_page.php (inspect)
* php migrations/cleanup_broadcast_market_page.php --apply
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
const PAGE_SLUG = '/markets/broadcast-and-telecoms';
// 11342-11349 = Import 27.10. (inkl. der beiden HIDDEN-Stubs customerlogos/
// usecaselist, die auch die anderen Market-Seiten tragen); 10293 = das alte
// "Explore Broadcast & Telecoms"-Band - der Import hat hier KEINEN eigenen
// Explore-Introparagraph angelegt, das Element bleibt die Ueberschrift
// ueber den Karten (Inspect-Befund 2026-10-28).
const KEEP = [11342, 11343, 11344, 11345, 11346, 11347, 11348, 11349, 10293];
$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]
);
$stmt = $pdo->prepare('SELECT uid FROM pages WHERE deleted = 0 AND slug = ? AND sys_language_uid IN (0,-1)');
$stmt->execute([PAGE_SLUG]);
$pid = (int)$stmt->fetchColumn();
if ($pid === 0) {
exit("Seite " . PAGE_SLUG . " nicht gefunden.\n");
}
echo ($apply ? 'APPLY' : 'INSPECT') . " · Seite #$pid " . PAGE_SLUG . "\n\n";
$stmt = $pdo->prepare(
'SELECT uid, colPos, sorting, CType, header, tx_container_parent, hidden
FROM tt_content WHERE deleted = 0 AND pid = ? ORDER BY colPos, sorting'
);
$stmt->execute([$pid]);
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$delete = [];
printf("%-7s %-7s %-8s %-28s %-9s %-7s %s\n", 'uid', 'colPos', 'parent', 'CType', 'hidden', 'aktion', 'header');
foreach ($rows as $row) {
$keep = in_array((int)$row['uid'], KEEP, true);
if (!$keep) {
$delete[] = (int)$row['uid'];
}
printf("%-7d %-7d %-8d %-28s %-9s %-7s %s\n",
$row['uid'], $row['colPos'], $row['tx_container_parent'], $row['CType'],
$row['hidden'] ? 'hidden' : '-', $keep ? 'KEEP' : 'DELETE', mb_substr((string)$row['header'], 0, 45));
}
echo "\n" . count($rows) . " Element(e), davon " . count($delete) . " zu loeschen, " . (count($rows) - count($delete)) . " bleiben.\n";
$missing = array_diff(KEEP, array_map(static fn(array $r): int => (int)$r['uid'], $rows));
if ($missing !== []) {
echo "WARNUNG: Whitelist-Elemente fehlen auf der Seite: " . implode(', ', $missing) . " - NICHT anwenden, erst klaeren.\n";
exit(1);
}
if (!$apply) {
echo "\nInspect only - mit --apply soft-loeschen.\n";
exit(0);
}
if ($delete === []) {
echo "Nichts zu tun.\n";
exit(0);
}
$in = implode(',', array_fill(0, count($delete), '?'));
$stmt = $pdo->prepare("UPDATE tt_content SET deleted = 1, tstamp = UNIX_TIMESTAMP() WHERE uid IN ($in)");
$stmt->execute($delete);
echo "Soft-geloescht: " . $stmt->rowCount() . " Element(e). Danach: vendor/bin/typo3 cache:flush\n";