From 3af01bc81292facfcbd0ddd81f83b7fda26d9dda Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Sun, 6 Sep 2026 21:10:26 +0200 Subject: [PATCH] Clean removed WebDAV images after Piwigo sync --- runtime/sync-webdav.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/runtime/sync-webdav.sh b/runtime/sync-webdav.sh index a8f21d0..e1e07bb 100644 --- a/runtime/sync-webdav.sh +++ b/runtime/sync-webdav.sh @@ -180,6 +180,23 @@ if [[ "${PIWIGO_SYNC_ENABLED:-0}" == "1" ]]; then exit "$PIWIGO_EXIT" fi + CLEANUP_OUTPUT="" + CLEANUP_EXIT=0 + if CLEANUP_OUTPUT="$(php "$SCRIPT_DIR/repair-webdav-orphans.php" 2>&1)"; then + CLEANUP_EXIT=0 + else + CLEANUP_EXIT=$? + fi + [[ -z "$CLEANUP_OUTPUT" ]] || printf '%s\n' "$CLEANUP_OUTPUT" + if [[ "$CLEANUP_EXIT" -ne 0 ]]; then + DETAIL="Exit-Code: $CLEANUP_EXIT" + if [[ -n "$CLEANUP_OUTPUT" ]]; then + DETAIL+="; Ausgabe: $(printf '%s\n' "$CLEANUP_OUTPUT" | compact_output)" + fi + write_status error "Verwaiste Piwigo-Bilder entfernter WebDAV-Quellen konnten nicht bereinigt werden" "$DETAIL" + exit "$CLEANUP_EXIT" + fi + METADATA_OUTPUT="" METADATA_EXIT=0 if METADATA_OUTPUT="$(php "$SCRIPT_DIR/lib/sync-webdav-metadata.php" \