- 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
52 lines
1.9 KiB
PHP
52 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Read-only: is the evo_megamenu_json schema in place?
|
|
* Checks the four menu tables and the inline column on tt_content.
|
|
*
|
|
* Usage: php migrations/check_megamenu_schema.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]
|
|
);
|
|
|
|
$tables = [
|
|
'tx_evomegamenujson_entry',
|
|
'tx_evomegamenujson_column',
|
|
'tx_evomegamenujson_item',
|
|
'tx_evomegamenujson_teaser',
|
|
];
|
|
$missing = 0;
|
|
foreach ($tables as $table) {
|
|
$exists = (bool)$pdo->query("SHOW TABLES LIKE " . $pdo->quote($table))->fetchColumn();
|
|
$count = $exists ? (int)$pdo->query("SELECT COUNT(*) FROM `$table`")->fetchColumn() : 0;
|
|
printf("%-32s %s%s\n", $table, $exists ? 'OK' : 'FEHLT', $exists ? " ($count Datensaetze)" : '');
|
|
$missing += $exists ? 0 : 1;
|
|
}
|
|
|
|
$col = $pdo->query("SHOW COLUMNS FROM tt_content LIKE 'tx_evomegamenujson_entries'")->fetch();
|
|
printf("%-32s %s\n", 'tt_content.tx_..._entries', $col ? 'OK' : 'FEHLT');
|
|
$missing += $col ? 0 : 1;
|
|
|
|
$ce = (int)$pdo->query("SELECT COUNT(*) FROM tt_content WHERE deleted = 0 AND CType = 'evomegamenujson_megamenu'")->fetchColumn();
|
|
printf("%-32s %d\n", 'Megamenu-Elemente angelegt', $ce);
|
|
|
|
echo "\n" . ($missing === 0
|
|
? "Schema vollstaendig - Plugin kann angelegt werden.\n"
|
|
: "$missing Objekt(e) fehlen - Schema-Update noetig.\n");
|