adad
All checks were successful
Deploy / deploy-staging (push) Successful in 5s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-11 00:03:17 +02:00
parent 7c33d60f14
commit faa4c237c8
2 changed files with 79 additions and 18 deletions

View File

@@ -142,16 +142,19 @@ $mm->registerFunction($moduleName, 'setup_actions', static function (): array {
[ [
'name' => 'initialize_schema', 'name' => 'initialize_schema',
'label' => 'Tabellen importieren', 'label' => 'Tabellen importieren',
'section' => 'database',
'help' => 'Legt die Mining-Checker Tabellen an, wenn sie noch nicht vorhanden sind.', 'help' => 'Legt die Mining-Checker Tabellen an, wenn sie noch nicht vorhanden sind.',
], ],
[ [
'name' => 'upgrade_schema', 'name' => 'upgrade_schema',
'label' => 'Tabellen updaten', 'label' => 'Tabellen updaten',
'section' => 'database',
'help' => 'Fuehrt fehlende Tabellen- und Spalten-Upgrades fuer den Mining-Checker aus.', 'help' => 'Fuehrt fehlende Tabellen- und Spalten-Upgrades fuer den Mining-Checker aus.',
], ],
[ [
'name' => 'seed_import', 'name' => 'seed_import',
'label' => 'Seed-Daten importieren', 'label' => 'Seed-Daten importieren',
'section' => 'database',
'help' => 'Importiert die vordefinierten Startdaten fuer das Standardprojekt.', 'help' => 'Importiert die vordefinierten Startdaten fuer das Standardprojekt.',
], ],
]; ];

View File

@@ -75,6 +75,12 @@ $refreshSchedulerState();
$setupActions = modules()->hasFunction($moduleName, 'setup_actions') $setupActions = modules()->hasFunction($moduleName, 'setup_actions')
? (array) module_fn($moduleName, 'setup_actions') ? (array) module_fn($moduleName, 'setup_actions')
: []; : [];
$databaseSectionActions = array_values(array_filter($setupActions, static function (mixed $action): bool {
return is_array($action) && trim((string) ($action['section'] ?? '')) === 'database';
}));
$customSectionActions = array_values(array_filter($setupActions, static function (mixed $action): bool {
return !is_array($action) || trim((string) ($action['section'] ?? '')) !== 'database';
}));
$defaults = $module['db_defaults'] ?? []; $defaults = $module['db_defaults'] ?? [];
if (empty($current['db']) && is_array($defaults)) { if (empty($current['db']) && is_array($defaults)) {
$current['db'] = $defaults; $current['db'] = $defaults;
@@ -137,6 +143,9 @@ foreach ($fields as $field) {
$label = (string)($field['label'] ?? $group); $label = (string)($field['label'] ?? $group);
$label = trim(preg_replace('/\s+DB\s+Driver$/i', ' DB', $label) ?? $label); $label = trim(preg_replace('/\s+DB\s+Driver$/i', ' DB', $label) ?? $label);
if ($group === 'db') {
$label = 'Custom Datenbank';
}
$label = $label !== '' ? $label : $group; $label = $label !== '' ? $label : $group;
$dbGroups[$group] = $label; $dbGroups[$group] = $label;
} }
@@ -155,6 +164,7 @@ foreach ($fields as $field) {
} }
$generalSetupFields = []; $generalSetupFields = [];
$databaseSetupFields = [];
$cronSetupFields = []; $cronSetupFields = [];
$customSetupFields = []; $customSetupFields = [];
foreach ($generalFields as $field) { foreach ($generalFields as $field) {
@@ -163,6 +173,10 @@ foreach ($generalFields as $field) {
$generalSetupFields[] = $field; $generalSetupFields[] = $field;
continue; continue;
} }
if ($fieldName === 'use_separate_db') {
$databaseSetupFields[] = $field;
continue;
}
if ($fieldName === 'schedule_timezone') { if ($fieldName === 'schedule_timezone') {
$cronSetupFields[] = $field; $cronSetupFields[] = $field;
continue; continue;
@@ -740,7 +754,7 @@ $manualGroups = array_values(array_filter($allowedGroups, fn (string $value): bo
$hasDatabaseSection = array_key_exists('database', $setupSectionConfig) $hasDatabaseSection = array_key_exists('database', $setupSectionConfig)
? !empty($setupSectionConfig['database']) ? !empty($setupSectionConfig['database'])
: $dbGroups !== []; : $dbGroups !== [];
$hasCustomSection = $customSetupFields !== [] || $setupActions !== [] || $isFxRatesSetup; $hasCustomSection = $customSetupFields !== [] || $customSectionActions !== [] || $isFxRatesSetup;
$showCustomDbConfig = !empty($current['use_separate_db']) && !in_array(strtolower(trim((string) ($current['use_separate_db'] ?? ''))), ['0', 'false', 'off', 'standard'], true); $showCustomDbConfig = !empty($current['use_separate_db']) && !in_array(strtolower(trim((string) ($current['use_separate_db'] ?? ''))), ['0', 'false', 'off', 'standard'], true);
$allowedSetupSections = ['general', 'access', 'cron']; $allowedSetupSections = ['general', 'access', 'cron'];
if ($hasDatabaseSection) { if ($hasDatabaseSection) {
@@ -1614,7 +1628,42 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
</section> </section>
<?php endif; ?> <?php endif; ?>
<?php if ($currentSection === 'custom' && $setupActions !== []): ?> <?php if ($currentSection === 'database' && $databaseSectionActions !== []): ?>
<section class="setup-panel">
<div class="setup-panel__head">
<div>
<span class="pill">Aktionen</span>
<h2>Datenbankaktionen</h2>
<p class="muted">Tabellenbezogene Wartungsaktionen koennen direkt hier ausgefuehrt werden.</p>
</div>
</div>
<div class="setup-grid">
<?php foreach ($databaseSectionActions as $action): ?>
<?php
$actionName = trim((string)($action['name'] ?? ''));
$actionLabel = trim((string)($action['label'] ?? $actionName));
$actionHelp = trim((string)($action['help'] ?? ''));
if ($actionName === '' || $actionLabel === '') {
continue;
}
?>
<div class="setup-field muted">
<span><?= e($actionLabel) ?></span>
<?php if ($actionHelp !== ''): ?>
<small class="muted"><?= e($actionHelp) ?></small>
<?php endif; ?>
<div class="setup-actions" style="justify-content:flex-start; margin-top:12px;">
<button class="nav-link" type="submit" name="module_setup_action" value="<?= e($actionName) ?>" formnovalidate>
<?= e($actionLabel) ?>
</button>
</div>
</div>
<?php endforeach; ?>
</div>
</section>
<?php endif; ?>
<?php if ($currentSection === 'custom' && $customSectionActions !== []): ?>
<section class="setup-panel"<?= $customSetupFields === [] ? ' id="setup-custom"' : '' ?>> <section class="setup-panel"<?= $customSetupFields === [] ? ' id="setup-custom"' : '' ?>>
<div class="setup-panel__head"> <div class="setup-panel__head">
<div> <div>
@@ -1624,7 +1673,7 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
</div> </div>
</div> </div>
<div class="setup-grid"> <div class="setup-grid">
<?php foreach ($setupActions as $action): ?> <?php foreach ($customSectionActions as $action): ?>
<?php <?php
$actionName = trim((string)($action['name'] ?? '')); $actionName = trim((string)($action['name'] ?? ''));
$actionLabel = trim((string)($action['label'] ?? $actionName)); $actionLabel = trim((string)($action['label'] ?? $actionName));
@@ -1675,7 +1724,7 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
<?php endif; ?> <?php endif; ?>
<?php if ($currentSection === 'database' && $dbGroups !== []): ?> <?php if ($currentSection === 'database' && $dbGroups !== []): ?>
<section class="setup-panel"<?= $generalSetupFields === [] ? ' id="setup-general"' : '' ?>> <section class="setup-panel"<?= $databaseSetupFields === [] ? ' id="setup-general"' : '' ?>>
<div class="setup-panel__head"> <div class="setup-panel__head">
<div> <div>
<span class="pill">Datenbanken</span> <span class="pill">Datenbanken</span>
@@ -1683,19 +1732,28 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
<p class="muted">Standard nutzt die Nexus-Datenbank. Custom blendet eigene Verbindungsdaten und den DB-Test ein.</p> <p class="muted">Standard nutzt die Nexus-Datenbank. Custom blendet eigene Verbindungsdaten und den DB-Test ein.</p>
</div> </div>
</div> </div>
<div class="setup-tabs" aria-label="Datenbankbereiche" data-setup-db-root <?= $showCustomDbConfig ? '' : 'hidden' ?>> <?php if ($databaseSetupFields !== []): ?>
<?php foreach ($dbGroups as $group => $label): ?> <div class="setup-grid" style="margin-bottom:16px;">
<button <?php foreach ($databaseSetupFields as $field): ?>
class="nav-link setup-tab<?= $group === $activeDbGroup ? ' is-active' : '' ?>" <?php $renderField($field); ?>
type="button" <?php endforeach; ?>
data-setup-tab-target="setup-db-<?= e($group) ?>" </div>
aria-controls="setup-db-<?= e($group) ?>" <?php endif; ?>
aria-selected="<?= $group === $activeDbGroup ? 'true' : 'false' ?>" <?php if (count($dbGroups) > 1): ?>
> <div class="setup-tabs" aria-label="Datenbankbereiche" data-setup-db-root <?= $showCustomDbConfig ? '' : 'hidden' ?>>
<?= e($label) ?> <?php foreach ($dbGroups as $group => $label): ?>
</button> <button
<?php endforeach; ?> class="nav-link setup-tab<?= $group === $activeDbGroup ? ' is-active' : '' ?>"
</div> type="button"
data-setup-tab-target="setup-db-<?= e($group) ?>"
aria-controls="setup-db-<?= e($group) ?>"
aria-selected="<?= $group === $activeDbGroup ? 'true' : 'false' ?>"
>
<?= e($label) ?>
</button>
<?php endforeach; ?>
</div>
<?php endif; ?>
<div class="setup-db-panels" data-setup-db-panels <?= $showCustomDbConfig ? '' : 'hidden' ?>> <div class="setup-db-panels" data-setup-db-panels <?= $showCustomDbConfig ? '' : 'hidden' ?>>
<?php foreach ($dbGroups as $group => $label): ?> <?php foreach ($dbGroups as $group => $label): ?>
<?php <?php
@@ -1706,7 +1764,7 @@ $GLOBALS['layout_header_context'] = 'Setup / ' . ($sectionTitles[$currentSection
$panelHint = $dbConfigHint($group, $panelConfig, $panelDefaults); $panelHint = $dbConfigHint($group, $panelConfig, $panelDefaults);
$defaultDescription = $describeDbDefaults($panelDefaults); $defaultDescription = $describeDbDefaults($panelDefaults);
?> ?>
<section class="setup-db-panel" id="setup-db-<?= e($group) ?>" <?= $group === $activeDbGroup ? '' : 'hidden' ?>> <section class="setup-db-panel" id="setup-db-<?= e($group) ?>" <?= (count($dbGroups) === 1 || $group === $activeDbGroup) ? '' : 'hidden' ?>>
<div class="setup-panel__head"> <div class="setup-panel__head">
<div> <div>
<span class="pill"><?= e($label) ?></span> <span class="pill"><?= e($label) ?></span>