Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m0s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m11s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m7s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 2m52s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 3m2s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 2m31s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 2m27s
CI / Build-Artefakte aktuell (pull_request) Successful in 53s
- Formular-Plugin: Baukasten mit 13 Feldtypen, Bedingungen, Vorbelegung aus dem Profil, Datei-Uploads (geschützt), anonyme Formulare, „nur einmal“, Einsendeschluss, Sichtbarkeit, Löschfrist; Einsendungen im Backend und per Mail (optional ohne Angaben, Kopie an die Person); Rechte je Formular und Rolle für Ansehen/Export und Löschen; CSV für Excel; Pagebuilder-Block - WordPress-Import (Plugin): WXR-Datei einlesen, Kategorien/Personen zuordnen, Beiträge mit Status, Datum, Beitragsbild und Bildern im Text übernehmen, optional Seiten mit Hierarchie; in Portionen, wiederholbar ohne Doppelungen - E-Mail-Versand im Admin (SMTP, verschlüsseltes Passwort, Test-Mail) - Speichertest unabhängig vom Verbrauch der Test-Suite Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
32 lines
785 B
PHP
32 lines
785 B
PHP
<?php
|
|
|
|
namespace Inhaus\Plugins\Forms;
|
|
|
|
use Inhaus\Plugins\Forms\Models\Form;
|
|
|
|
/**
|
|
* Löscht Einsendungen, deren Aufbewahrungsfrist abgelaufen ist (Einstellung je Formular).
|
|
*/
|
|
class Retention
|
|
{
|
|
public function purge(): int
|
|
{
|
|
$deleted = 0;
|
|
|
|
foreach (Form::query()->get() as $form) {
|
|
$days = (int) $form->setting('retention_days', 0);
|
|
|
|
if ($days <= 0) {
|
|
continue;
|
|
}
|
|
|
|
$form->submissions()->with('files')->where('created_at', '<', now()->subDays($days))
|
|
->chunkById(100, function ($submissions) use (&$deleted) {
|
|
$submissions->each->delete();
|
|
$deleted += $submissions->count();
|
|
});
|
|
}
|
|
|
|
return $deleted;
|
|
}
|
|
}
|