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

This commit is contained in:
2026-04-29 01:31:47 +02:00
parent b76edb49b0
commit af1d94a3b6
5 changed files with 75 additions and 24 deletions

View File

@@ -42,6 +42,9 @@ foreach ($fields as $field) {
}
$current = modules()->settings($moduleName);
$intervalTaskStatuses = modules()->intervalTaskStatuses($moduleName);
$setupActions = modules()->hasFunction($moduleName, 'setup_actions')
? (array) module_fn($moduleName, 'setup_actions')
: [];
$defaults = $module['db_defaults'] ?? [];
if (empty($current['db']) && is_array($defaults)) {
$current['db'] = $defaults;
@@ -364,7 +367,26 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$postedTestGroup = (string)($_POST['test_db'] ?? '');
$postedResetGroup = (string)($_POST['reset_db'] ?? '');
if ($postedResetGroup !== '') {
$postedSetupAction = trim((string)($_POST['module_setup_action'] ?? ''));
if ($postedSetupAction !== '') {
if (!modules()->hasFunction($moduleName, 'run_setup_action')) {
$error = 'Diese Setup-Aktion wird vom Modul nicht unterstuetzt.';
} else {
try {
$actionResult = module_fn($moduleName, 'run_setup_action', $postedSetupAction);
$notice = 'Setup-Aktion ausgefuehrt.';
if (is_array($actionResult)) {
if (isset($actionResult['message']) && is_string($actionResult['message']) && trim($actionResult['message']) !== '') {
$notice = trim((string) $actionResult['message']);
} elseif (isset($actionResult['synced_count'])) {
$notice = 'Waehrungskatalog synchronisiert. ' . (int) $actionResult['synced_count'] . ' Waehrungen verarbeitet.';
}
}
} catch (\Throwable $e) {
$error = $e->getMessage();
}
}
} elseif ($postedResetGroup !== '') {
$testGroup = $postedResetGroup;
if (!array_key_exists($postedResetGroup, $dbGroups)) {
$error = 'Unbekannte Datenbank-Konfiguration.';
@@ -497,6 +519,41 @@ $activeDbGroup = $testGroup !== null && array_key_exists($testGroup, $dbGroups)
</section>
<?php endif; ?>
<?php if ($setupActions !== []): ?>
<section class="setup-panel">
<div class="setup-panel__head">
<div>
<span class="pill">Aktionen</span>
<h2>Modulaktionen</h2>
<p class="muted">Seltene Wartungsaktionen koennen direkt hier aus dem Setup ausgefuehrt werden.</p>
</div>
</div>
<div class="setup-grid">
<?php foreach ($setupActions 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 (is_array($moduleStatusPanel)): ?>
<section class="setup-panel setup-panel--flat">
<div class="setup-panel__head">