dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxUpdateMigrationBootstrap_contract_test.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5$root = dirname(__DIR__, 4);
6$errors = array();
8
9foreach (glob($root . '/dbx/modules/*/migrations/*.migration.php') ?: array() as $migrationFile) {
10 $migration = include $migrationFile;
11 if (!is_array($migration)) {
12 $errors[] = 'Ungültige Migration: ' . $migrationFile;
13 continue;
14 }
15 foreach ((array)($migration['affected_dd'] ?? array()) as $ddRef) {
16 $parts = explode('|', (string)$ddRef, 2);
17 if (count($parts) !== 2) {
18 $errors[] = 'Ungültige DD-Referenz: ' . (string)$ddRef;
19 continue;
20 }
21 [$module, $dd] = $parts;
22 $ddFile = $root . '/dbx/modules/' . $module . '/dd/' . $dd . '.dd.php';
23 if (!is_file($ddFile)) {
24 continue;
25 }
26 $table = (static function (string $file): array {
27 $table = array();
28 $fields = array();
29 $indexes = array();
30 include $file;
31 return is_array($table) ? $table : array();
32 })($ddFile);
33 $server = trim((string)($table['server'] ?? ''));
34 if (preg_match('/\.(?:db3|sqlite|sqlite3)$/i', $server) !== 1) {
35 continue;
36 }
37 $checked++;
38 if (!str_starts_with($server, $module . '|')) {
39 $errors[] = $ddRef . ' verwendet keinen releasefest qualifizierten SQLite-Server: ' . $server;
40 }
41 }
42}
43
44if ($checked === 0) {
45 $errors[] = 'Kein migrationsbetroffener SQLite-DD-Server geprüft.';
46}
47if ($errors !== array()) {
48 fwrite(STDERR, "FAIL\n- " . implode("\n- ", $errors) . "\n");
49 exit(1);
50}
51
52echo 'OK migration bootstrap uses release-stable SQLite server references (' . $checked . ")\n";
$table['server']
Definition .dd.php:6
$indexes[]
Definition .dd.php:167
exit
Definition index.php:146