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-15 02:41:09 +02:00
parent 0b555e7dd4
commit 7157c98dcb
13 changed files with 614 additions and 20 deletions

View File

@@ -13,6 +13,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
modules()->setEnabled($name, $enabled);
$notice = $enabled ? 'Modul aktiviert.' : 'Modul deaktiviert.';
$modules = modules()->all();
} elseif ($name !== '' && $action === 'migrate') {
$applied = modules()->applyPendingMigrations($name);
$notice = count($applied) . ' Migration(en) angewendet.';
$modules = modules()->all();
} else {
$error = 'Ungültige Aktion.';
}
@@ -49,6 +53,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$accessLabel = $hasSpecificAccess
? 'Spezielle Zugriffsrechte'
: ($authRequired ? 'Login erforderlich' : 'Kein Modulschutz');
$migrationStatus = modules()->migrationStatus($module['name']);
$pendingMigrations = $migrationStatus['pending'] ?? [];
$changedMigrations = $migrationStatus['changed'] ?? [];
?>
<div class="card" style="background:var(--panel-2);">
<div style="display:flex; align-items:center; justify-content:space-between; gap:12px;">
@@ -61,8 +68,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
<span class="pill" title="<?= e($accessLabel) ?>" style="<?= $hasSpecificAccess ? 'border-color:#f59e0b; color:#fbbf24;' : '' ?>">
<?= e($accessLabel) ?>
</span>
<?php if ($pendingMigrations !== []): ?>
<span class="pill" style="border-color:var(--accent-orange); color:var(--accent-orange);">
<?= e((string)count($pendingMigrations)) ?> Migration(en)
</span>
<?php elseif (($migrationStatus['available'] ?? 0) > 0): ?>
<span class="pill" style="border-color:var(--accent-green); color:var(--accent-green);">Schema aktuell</span>
<?php endif; ?>
</div>
</div>
<?php if ($changedMigrations !== []): ?>
<div class="muted" style="margin-top:.65rem; font-size:.85rem; color:var(--accent-orange);">
Achtung: <?= e((string)count($changedMigrations)) ?> bereits angewendete Migration(en) wurden veraendert.
</div>
<?php endif; ?>
<?php if ($hasSpecificAccess): ?>
<div class="muted" style="margin-top:.65rem; font-size:.85rem;">
<?php if ($authGroups !== []): ?>
@@ -80,6 +99,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
<a class="nav-link" href="/module/<?= e($module['name']) ?>">Öffnen</a>
<a class="nav-link" href="/modules/setup/<?= e($module['name']) ?>">Setup</a>
<a class="nav-link" href="/modules/access/<?= e($module['name']) ?>">Zugriff</a>
<?php if ($pendingMigrations !== []): ?>
<form method="post" style="margin:0;">
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
<button class="cta-button" name="action" value="migrate">Migrationen anwenden</button>
</form>
<?php endif; ?>
<form method="post" style="margin:0;">
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
<button class="cta-button" name="action" value="disable" style="background:var(--panel); color:var(--text);">Deaktivieren</button>

View File

@@ -11,6 +11,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
modules()->setEnabled($name, $action === 'enable');
$notice = $action === 'enable' ? 'Modul aktiviert.' : 'Modul deaktiviert.';
$modules = modules()->all();
} elseif ($name !== '' && $action === 'migrate') {
$applied = modules()->applyPendingMigrations($name);
$notice = count($applied) . ' Migration(en) angewendet.';
$modules = modules()->all();
} else {
$error = 'Ungültige Aktion.';
}
@@ -48,11 +52,21 @@ foreach ($modules as $m) {
<h3 style="margin-top:1.25rem;">Aktive Module</h3>
<div style="margin-top:.5rem;" class="grid">
<?php foreach ($active as $module): ?>
<?php
$migrationStatus = modules()->migrationStatus($module['name']);
$pendingMigrations = $migrationStatus['pending'] ?? [];
?>
<div class="card" style="background:var(--panel-2);">
<strong><?= e($module['title']) ?></strong>
<div class="muted" style="font-size:.85rem;"><?= e($module['description'] ?? '') ?></div>
<div style="margin-top:.75rem; display:flex; gap:10px;">
<a class="nav-link" href="/module/<?= e($module['name']) ?>">Öffnen</a>
<?php if ($pendingMigrations !== []): ?>
<form method="post" style="margin:0;">
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
<button class="cta-button" name="action" value="migrate">Migrationen anwenden</button>
</form>
<?php endif; ?>
<form method="post" style="margin:0;">
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
<button class="cta-button" name="action" value="disable" style="background:var(--panel); color:var(--text);">Deaktivieren</button>
@@ -65,11 +79,21 @@ foreach ($modules as $m) {
<h3 style="margin-top:1.5rem;">Deaktivierte Module</h3>
<div style="margin-top:.5rem;" class="grid">
<?php foreach ($inactive as $module): ?>
<?php
$migrationStatus = modules()->migrationStatus($module['name']);
$pendingMigrations = $migrationStatus['pending'] ?? [];
?>
<div class="card" style="background:var(--panel-2);">
<strong><?= e($module['title']) ?></strong>
<div class="muted" style="font-size:.85rem;"><?= e($module['description'] ?? '') ?></div>
<div style="margin-top:.75rem; display:flex; gap:10px;">
<a class="nav-link" href="/modules/setup/<?= e($module['name']) ?>">Setup</a>
<?php if ($pendingMigrations !== []): ?>
<form method="post" style="margin:0;">
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
<button class="cta-button" name="action" value="migrate">Migrationen anwenden</button>
</form>
<?php endif; ?>
<form method="post" style="margin:0;">
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
<button class="cta-button" name="action" value="enable">Aktivieren</button>