Files
VITEC-website/migrations/check_solutions.php
Oliver Rasche e9eaa62d89 Align solutions to the sitemap's 39 Generic Solutions; map detail pages
- vitec:align-solutions: declarative target = the 39 Generic Solutions in 8
  group categories under the Solution root (sheet is binding, group typo
  Engagament->Engagement fixed). Two legacy records renamed onto their sheet
  names instead of deleted (keeps the only editorial teaser/description),
  slugs generated for all, market categories stripped from solutions, the
  ~82 market-specific records soft-deleted (markets link editorially)
- vitec:map-solution-pages: writes matching page uids into detail_page
  (unique matches, fill-only); disambiguates the duplicated page branches
  by slug suffix and prunes the 10 empty duplicate pages
- read-only diagnostics: check_solutions.php, check_dup_solution_pages.php
2026-09-04 15:30:27 +02:00

51 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
/**
* Read-only: dump every solution record (tx_vitec_domain_model_solution) -
* for the comparison against the "Generic Solutions" tab of the merged
* sitemap (2026-09-04).
*
* Usage: php migrations/check_solutions.php
*/
$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]
);
$rows = $pdo->query(
"SELECT uid, title, slug, hidden, detail_page, teaser <> '' AS has_teaser, description <> '' AS has_description
FROM tx_vitec_domain_model_solution WHERE deleted = 0 ORDER BY title"
)->fetchAll();
echo "=== solutions (uid | title | slug | flags) ===\n";
foreach ($rows as $row) {
printf("%3d | %-55s | %-45s | %s%s%s%s\n",
$row['uid'], $row['title'], $row['slug'],
$row['hidden'] ? 'HIDDEN ' : '',
$row['detail_page'] ? ('detail_page=' . $row['detail_page'] . ' ') : '',
$row['has_teaser'] ? 'teaser ' : '',
$row['has_description'] ? 'desc' : ''
);
}
echo count($rows) . " solutions total\n";