- new project-neutral extension evo_megamenu_json (Evomedien): a Megamenu plugin holding entries, columns, items, teaser cards and a featured slot as nested records; presentation settings travel with the payload so the front end reads behaviour instead of hard-coding it; published as page.10.fields.megaMenu, driven by the site settings megamenu.contentUid and megamenu.storagePid - vitec:seed-megamenu fills one element from the live structure: 5 entries, 26 columns, 95 items, 4 story cards; items without a page yet are flagged pending so the front end falls back to the column link - vitec:debug-sets prints the resolved site set order - read-only diagnostics: check_megamenu_schema.php, check_typoscript_templates.php - docs: schema updates run via extension:setup (database:updateschema no longer exists in v14), and a JSON Accept header activates headless-mixed, which strips every set-added page field
70 lines
2.5 KiB
PHP
70 lines
2.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Read-only: TypoScript template records and their static includes.
|
|
* A static include that pulls headless in AFTER the site sets resets the
|
|
* whole `page` object and silently drops page-level fields.
|
|
*
|
|
* Usage: php migrations/check_typoscript_templates.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("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]
|
|
);
|
|
|
|
$rows = $pdo->query(
|
|
"SELECT uid, pid, title, root, clear, hidden, deleted, include_static_file, tstamp,
|
|
LENGTH(config) AS config_len, LENGTH(constants) AS const_len
|
|
FROM sys_template ORDER BY pid, sorting"
|
|
)->fetchAll();
|
|
|
|
echo "=== sys_template ===\n";
|
|
foreach ($rows as $r) {
|
|
printf("uid %d | pid %d | %s%s%s%s | geaendert %s\n",
|
|
$r['uid'], $r['pid'], $r['title'],
|
|
$r['root'] ? ' | ROOT' : '',
|
|
$r['hidden'] ? ' | HIDDEN' : '',
|
|
$r['deleted'] ? ' | DELETED' : '',
|
|
date('Y-m-d H:i', (int)$r['tstamp'])
|
|
);
|
|
printf(" clear=%s config=%d Zeichen constants=%d Zeichen\n", $r['clear'], $r['config_len'], $r['const_len']);
|
|
$inc = trim((string)$r['include_static_file']);
|
|
if ($inc !== '') {
|
|
echo " include_static_file:\n";
|
|
foreach (explode(',', $inc) as $i => $one) {
|
|
printf(" %2d. %s\n", $i + 1, trim($one));
|
|
}
|
|
} else {
|
|
echo " include_static_file: (leer)\n";
|
|
}
|
|
}
|
|
|
|
// Anything in the config field that resets page?
|
|
foreach ($rows as $r) {
|
|
if ((int)$r['config_len'] === 0) { continue; }
|
|
$cfg = $pdo->query("SELECT config FROM sys_template WHERE uid = " . (int)$r['uid'])->fetchColumn();
|
|
$hits = [];
|
|
foreach (preg_split('/\R/', (string)$cfg) as $n => $line) {
|
|
if (preg_match('/^\s*page\s*[<=]/', $line) || str_contains($line, 'lib.headlessPage')) {
|
|
$hits[] = ($n + 1) . ': ' . trim($line);
|
|
}
|
|
}
|
|
if ($hits !== []) {
|
|
echo "\n=== page-Zuweisungen im config von uid {$r['uid']} ===\n" . implode("\n", $hits) . "\n";
|
|
}
|
|
}
|