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
This commit is contained in:
23
migrations/check_dup_solution_pages.php
Normal file
23
migrations/check_dup_solution_pages.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/** Read-only: show the duplicate solution page branches (2026-09-04). */
|
||||
$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 root\n"); }
|
||||
$s = require $root . '/config/system/settings.php';
|
||||
$db = $s['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]);
|
||||
$uids = [481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500];
|
||||
$rows = $pdo->query('SELECT uid, pid, title, slug, hidden, crdate, sorting FROM pages WHERE uid IN (' . implode(',', $uids) . ') ORDER BY pid, sorting')->fetchAll();
|
||||
$parents = [];
|
||||
foreach ($rows as $r) { $parents[(int)$r['pid']] = true; }
|
||||
foreach (array_keys($parents) as $pid) {
|
||||
$p = $pdo->query("SELECT uid, pid, title, slug, hidden, crdate FROM pages WHERE uid = $pid")->fetch();
|
||||
printf("ELTERN %d | pid %d | %s | /%s | %s| angelegt %s\n", $p['uid'], $p['pid'], $p['title'], trim((string)$p['slug'],'/'), $p['hidden'] ? 'HIDDEN ' : '', date('Y-m-d H:i', (int)$p['crdate']));
|
||||
// Kinderzahl + Inhalt vorhanden?
|
||||
foreach ($rows as $r) {
|
||||
if ((int)$r['pid'] !== (int)$p['uid']) { continue; }
|
||||
$ce = (int)$pdo->query('SELECT COUNT(*) FROM tt_content WHERE deleted = 0 AND pid = ' . (int)$r['uid'])->fetchColumn();
|
||||
printf(" %d | %-42s | /%s | %s| %d CE | angelegt %s\n", $r['uid'], $r['title'], trim((string)$r['slug'],'/'), $r['hidden'] ? 'HIDDEN ' : '', $ce, date('Y-m-d H:i', (int)$r['crdate']));
|
||||
}
|
||||
}
|
||||
50
migrations/check_solutions.php
Normal file
50
migrations/check_solutions.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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";
|
||||
Reference in New Issue
Block a user