Repository navigation
Post Prune 1.0.0-beta5
Pre-releaseBeta: Erst auf einem Testboard oder mit Backup + Trockenlauf einsetzen. · Use it on a test board first, or with a backup + dry run.
Deutsch
Update von 1.0.0-beta4 (oder älter)
Wie bisher. Ab 1.0.0-beta3 ist phpBB 3.3.3 oder neuer nötig (1.0.0-beta1 lief noch ab 3.3.0); ein älteres Board zuerst aktualisieren.
- Backup von Datenbank und
files/. - Die neuen Dateien hochladen und
ext/uflagmey/postprune/überschreiben. - ACP → Anpassen → Erweiterungen verwalten: „Post Prune“ deaktivieren und wieder aktivieren. Nicht „Arbeitsdaten löschen“ wählen, das entfernt alle Einstellungen.
Schritt 3 legt zwei neue Spalten für die Löschregel an. Alle Einstellungen und markierten Themen bleiben erhalten; neue Einstellungen starten so, dass sich nichts ändert (Geltungsbereich „Ganzes Forum“, Löschregel „Nach Alter“). Ohne Schritt 3 geht nichts kaputt: Die Extension arbeitet wie die Vorversion weiter, nur die neuen Funktionen fehlen; sobald der Cache geleert ist, weist das ACP auf den fehlenden Schritt hin.
Nach dem Zurückspielen eines Datenbank-Backups immer den Cache leeren (ACP → Allgemein → „Cache leeren“), erst dann die Erweiterung deaktivieren/aktivieren.
Änderungen seit 1.0.0-beta4
- Neue Löschregel „Nach Anzahl“ für markierte Themen: Je Thema bleiben nur die neuesten X freigegebenen Beiträge stehen, ältere werden gelöscht (z. B. ein Sammelthema, das nur die letzten 100 Beiträge behalten soll). Hat ein Thema weniger als X freigegebene Beiträge, wird darin nichts gelöscht. Mit „Ersten Beitrag eines Themas behalten“ bleibt der erste Beitrag zusätzlich stehen, er zählt nicht mit.
- Vorschau „Trockenlauf jetzt berechnen“ im Forum-Formular: zählt sofort, wie viele Beiträge ein Trockenlauf löschen würde (mit Datum des ältesten und des jüngsten zu löschenden Beitrags), und zwar mit den Werten im Formular, auch vor dem Speichern. So lassen sich Werte ausprobieren (z. B. 100 oder 50 behalten), ohne jedes Mal zu speichern. Weichen die Werte vom gespeicherten Stand ab, ist das Ergebnis als „noch nicht gespeichert“ markiert; gelöscht wird nur mit gespeicherten Werten. Ungültige Werte ergeben dieselbe Fehlermeldung wie beim Speichern. Es wird nichts gelöscht und nichts protokolliert; funktioniert in jedem Modus, auch bei „Aus“. Ohne JavaScript lädt die Seite neu und rechnet mit dem gespeicherten Stand; ungespeicherte Änderungen im Formular gehen dabei verloren.
- „Gespeichert für „“: …“: Eine Zeile im Post-Prune-Block zeigt immer den in der Datenbank gespeicherten Stand, dazu der Hinweis, dass Änderungen erst mit „Absenden“ gespeichert werden.
- Fehlerbehebung ACP: Wurde das Forum-Formular ohne die Post-Prune-Felder abgeschickt (z. B. geöffnet, während die Erweiterung deaktiviert war), setzte die Extension ihre Einstellungen auf die Standardwerte zurück. Jetzt bleibt der gespeicherte Stand erhalten.
- README: Abschnitte zur Anzahl-Regel, zur Vorschau (Werte ausprobieren vor dem Speichern) und zum manuellen Auslösen (
cron:run, Web-Cron-Adresse), neue Stolpersteine, Abschnitt „Getestet mit“.
Post Prune löscht in ausgewählten Foren oder in ausgewählten Themen einzelne Beiträge samt Dateianhängen automatisch und endgültig: nach Alter (älter als N Tage) oder in markierten Themen nach Anzahl (nur die neuesten X bleiben). Anlass war eine Anfrage auf phpBB.de (t=248190).
- Pro Forum einstellbar: Aus / Trockenlauf / Aktiv, Geltungsbereich (ganzes Forum oder nur markierte Themen), Löschregel (nach Alter oder nach Anzahl), „Ersten Beitrag eines Themas behalten“, wichtige Themen und Bekanntmachungen ausnehmen, Beitragszähler reduzieren (Standard: nein).
- Gelöscht wird nur über die phpBB-Kernfunktion
delete_posts(): Anhänge samt Dateien, Suchindex, Meldungen und Benachrichtigungen werden mit entfernt, Themen, Foren und Statistik synchronisiert. - Standardmäßig höchstens 200 Beiträge pro Cron-Lauf, ein Rückstand wird in Portionen abgearbeitet.
- Die Löschung ist unwiderruflich. Empfehlung: erst Backup, dann Werte mit der Vorschau ausprobieren, dann Trockenlauf (Ergebnis im Administrations-Protokoll), dann Aktiv.
Installation: postprune-1.0.0-beta5.zip unten herunterladen, entpacken, den Ordner uflagmey/postprune/ nach ext/ hochladen und im ACP aktivieren. Nicht „Source code (zip)“ bzw. „Code → Download ZIP“ verwenden. Das ist der Quellcode mit falscher Ordnerstruktur.
Voraussetzungen und Tests: phpBB 3.3.3 oder neuer (3.3.x), PHP 7.2 oder neuer.
- Getestet mit phpBB 3.3.17 und 3.3.19; Datenbanken MySQL/MariaDB, PostgreSQL, SQLite (MS SQL Server und Oracle nicht getestet).
- PHP 8.3, 8.4 und 8.5, jeweils mit phpBB 3.3.17 und 3.3.19: getestet, keine Meldungen der Extension im PHP-Fehlerlog. phpBB 3.3 selbst unterstützt offiziell PHP bis 8.3; unter 8.4/8.5 schreibt der phpBB-Kern Deprecation-Hinweise ins PHP-Fehlerlog (nicht die Extension).
- PHP 7.2 bis 8.2: nur statisch geprüft (PHPCompatibility), nicht in Laufzeit-Tests.
English
Updating from 1.0.0-beta4 (or older)
Same as before. Since 1.0.0-beta3, phpBB 3.3.3 or newer is required (1.0.0-beta1 still ran on 3.3.0 and later); update an older board first.
- Backup of database and
files/. - Upload the new files, overwriting
ext/uflagmey/postprune/. - ACP → Customise → Manage extensions: disable and enable “Post Prune” again. Do not choose “Delete data”, that removes all settings.
Step 3 adds two new columns for the deletion rule. All settings and marked topics are kept; new settings start so that nothing changes (scope “Whole forum”, deletion rule “By age”). Skipping step 3 breaks nothing: the extension keeps working like the previous version, only the new features are missing; once the cache is purged, the ACP points out the missing step.
After restoring a database backup always purge the cache (ACP → General → “Purge the cache”), and only then disable/enable the extension.
Changes since 1.0.0-beta4
- New deletion rule “By number” for marked topics: per topic only the newest X approved posts stay, older ones are deleted (e.g. a collection topic that should keep only the last 100 posts). A topic with fewer than X approved posts loses nothing. With “Keep first post of each topic” the first post additionally stays; it does not count.
- Preview “Calculate dry run now” in the forum form: counts right away how many posts a dry run would delete (with the date of the oldest and of the newest post to be deleted), with the values in the form, even before saving. Values can be tried out this way (e.g. keep 100 or 50) without saving each time. If the values differ from the saved state, the result is marked “not saved yet”; only saved values are used for deleting. Invalid values give the same error message as saving. Nothing is deleted and nothing is logged; works in every mode, including “Off”. Without JavaScript the page reloads and uses the saved settings; unsaved changes in the form are lost.
- “Saved for “”: …”: a line in the Post Prune block always shows the state stored in the database, plus a note that changes are only saved with “Submit”.
- ACP bug fix: if the forum form was submitted without the Post Prune fields (e.g. opened while the extension was disabled), the extension reset its settings to the defaults. The stored values are now kept.
- README: sections on the number rule, the preview (trying out values before saving) and manual runs (
cron:run, web cron URL), new pitfalls, a “Tested with” section.
Post Prune automatically and permanently deletes individual posts, including their attachments, in selected forums or selected topics: by age (older than N days) or, in marked topics, by number (only the newest X stay). It started as a request on phpBB.de (t=248190).
- Per forum: Off / Dry run / Active, scope (whole forum or marked topics only), deletion rule (by age or by number), “Keep first post of each topic”, skip stickies and announcements, reduce post counts (default: no).
- Deletion only through phpBB's core function
delete_posts(): attachments and their files, search index, reports and notifications are removed too; topics, forums and statistics are synchronised. - By default at most 200 posts per cron run; a backlog is worked off in batches.
- Deletion cannot be undone. Recommended: backup first, then try out values with the preview, then dry run (result in the admin log), then Active.
Installation: download postprune-1.0.0-beta5.zip below, unpack it, upload the folder uflagmey/postprune/ to ext/ and enable it in the ACP. Do not use “Source code (zip)” or “Code → Download ZIP”: that is the source code with the wrong folder layout.
Requirements and tests: phpBB 3.3.3 or newer (3.3.x), PHP 7.2 or newer.
- Tested with phpBB 3.3.17 and 3.3.19; databases MySQL/MariaDB, PostgreSQL, SQLite (MS SQL Server and Oracle not tested).
- PHP 8.3, 8.4 and 8.5, each with phpBB 3.3.17 and 3.3.19: tested, no messages from the extension in the PHP error log. phpBB 3.3 itself officially supports PHP up to 8.3; on 8.4/8.5 the phpBB core writes deprecation notices to the PHP error log (not the extension).
- PHP 7.2 to 8.2: checked statically only (PHPCompatibility), not in runtime tests.
postprune-1.0.0-beta5.zip SHA-256: ae881e7351c824f90432c251605b3ab46ac28643e7432e885892c82845cc5e55