From 3f5f8dc4b425b55679a793d02c57220de17b69cf Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Wed, 19 Aug 2026 16:01:16 +0200 Subject: [PATCH 1/9] 0.9.6.19 pair migration with selected legacy connection --- include/nc_connector_webdav.inc.php | 87 ++++++++++++----------------- 1 file changed, 37 insertions(+), 50 deletions(-) diff --git a/include/nc_connector_webdav.inc.php b/include/nc_connector_webdav.inc.php index e4b5596..4c23270 100644 --- a/include/nc_connector_webdav.inc.php +++ b/include/nc_connector_webdav.inc.php @@ -5,46 +5,24 @@ if (!defined('PHPWG_ROOT_PATH')) } /** - * Return the only existing local connector as migration fallback. + * Link a WebDAV successor with the exact legacy connection selected for migration. */ -function bratonien_tools_nc_connector_single_local_fallback() +function bratonien_tools_nc_connector_pair_migration_fallback($legacy_id, $webdav_id, array &$webdav_config, $now) { - bratonien_tools_nc_connector_ensure_table(); - $table = bratonien_tools_nc_connector_table(); - $result = pwg_query("SELECT id, enabled, takeover_state, config_json FROM `$table` WHERE adapter='local' ORDER BY id"); - $rows = array(); - - while ($row = pwg_db_fetch_assoc($result)) + $legacy_id = (int)$legacy_id; + $webdav_id = (int)$webdav_id; + if ($legacy_id < 1 || $webdav_id < 1 || $legacy_id === $webdav_id) { - $rows[] = $row; - if (count($rows) > 1) return null; + throw new RuntimeException('Die Migrationszuordnung ist ungueltig.'); } - if (count($rows) !== 1) return null; - - $row = $rows[0]; - $config = json_decode((string)$row['config_json'], true); - if (!is_array($config)) $config = array(); - - return array( - 'id'=>(int)$row['id'], - 'enabled'=>(bool)$row['enabled'], - 'takeover_state'=>(string)$row['takeover_state'], - 'config'=>$config, - ); -} - -/** - * Link a WebDAV connection with the single existing local fallback. - */ -function bratonien_tools_nc_connector_pair_migration_fallback($webdav_id, array &$webdav_config, $now) -{ - $legacy = bratonien_tools_nc_connector_single_local_fallback(); - if (!$legacy) return null; - - $legacy_id = (int)$legacy['id']; - if ($legacy_id < 1 || $legacy_id === (int)$webdav_id) return null; + $legacy = bratonien_tools_nc_connector_connection($legacy_id, false); + if (!$legacy || (string)$legacy['adapter'] !== 'local') + { + throw new RuntimeException('Die ausgewaehlte Legacy-Verbindung fuer die Migration ist nicht mehr verfuegbar.'); + } + $legacy_config = isset($legacy['config']) && is_array($legacy['config']) ? $legacy['config'] : array(); $webdav_config['migration'] = array( 'role'=>'webdav-primary-candidate', 'legacy_fallback_connection_id'=>$legacy_id, @@ -52,11 +30,9 @@ function bratonien_tools_nc_connector_pair_migration_fallback($webdav_id, array 'paired_at'=>(string)$now, 'cutover_state'=>'parallel', ); - - $legacy_config = $legacy['config']; $legacy_config['migration'] = array( 'role'=>'legacy-fallback', - 'webdav_successor_connection_id'=>(int)$webdav_id, + 'webdav_successor_connection_id'=>$webdav_id, 'fallback_policy'=>'keep-running', 'paired_at'=>(string)$now, 'cutover_state'=>'parallel', @@ -69,7 +45,7 @@ function bratonien_tools_nc_connector_pair_migration_fallback($webdav_id, array } $table = bratonien_tools_nc_connector_table(); - pwg_query("UPDATE `$table` SET config_json='".pwg_db_real_escape_string($legacy_json)."', updated='".pwg_db_real_escape_string((string)$now)."' WHERE id=".$legacy_id." LIMIT 1"); + pwg_query("UPDATE `$table` SET config_json='".pwg_db_real_escape_string($legacy_json)."', updated='".pwg_db_real_escape_string((string)$now)."' WHERE id=".$legacy_id." AND adapter='local' LIMIT 1"); return $legacy_id; } @@ -77,9 +53,8 @@ function bratonien_tools_nc_connector_pair_migration_fallback($webdav_id, array /** * Create or update a WebDAV-backed connector from the user-facing wizard. * - * Remote connections are updated in place. When the editor was opened for a - * legacy connection, a WebDAV successor is created and the legacy connection - * stays available as fallback. + * Remote connections are updated in place. A legacy connection is paired only + * when the wizard was explicitly opened in migration mode for that connection. */ function bratonien_tools_nc_connector_create_webdav_placeholder_from_wizard() { @@ -87,7 +62,7 @@ function bratonien_tools_nc_connector_create_webdav_placeholder_from_wizard() if (empty($state['scan_ok']) || empty($state['technical_complete'])) { - throw new RuntimeException('Die WebDAV-Verbindung wurde im Assistenten noch nicht vollständig vorbereitet.'); + throw new RuntimeException('Die WebDAV-Verbindung wurde im Assistenten noch nicht vollstaendig vorbereitet.'); } $base_url = rtrim(trim((string)($state['base_url'] ?? '')), '/'); @@ -95,7 +70,7 @@ function bratonien_tools_nc_connector_create_webdav_placeholder_from_wizard() $password = (string)($state['_password'] ?? ''); if ($base_url === '' || $username === '' || $password === '') { - throw new RuntimeException('Für den WebDAV-Zugang fehlen Nextcloud-Adresse oder Zugangsdaten.'); + throw new RuntimeException('Fuer den WebDAV-Zugang fehlen Nextcloud-Adresse oder Zugangsdaten.'); } $selected = isset($state['directory_selected']) && is_array($state['directory_selected']) @@ -104,13 +79,13 @@ function bratonien_tools_nc_connector_create_webdav_placeholder_from_wizard() $selected_ids = isset($state['directory_selected_fileids']) && is_array($state['directory_selected_fileids']) ? $state['directory_selected_fileids'] : array(); - if (!$selected) throw new RuntimeException('Bitte mindestens ein Nextcloud-Verzeichnis auswählen.'); + if (!$selected) throw new RuntimeException('Bitte mindestens ein Nextcloud-Verzeichnis auswaehlen.'); $roots = array(); foreach ($selected as $path) { $fileid = isset($selected_ids[$path]) ? (int)$selected_ids[$path] : 0; - if ($fileid < 1) throw new RuntimeException('Für ein ausgewähltes Nextcloud-Verzeichnis fehlt die eindeutige Datei-ID.'); + if ($fileid < 1) throw new RuntimeException('Fuer ein ausgewaehltes Nextcloud-Verzeichnis fehlt die eindeutige Datei-ID.'); $display_name = $path === '' ? (trim((string)($state['display_name'] ?? '')) !== '' ? trim((string)$state['display_name']) : $username) : basename($path); @@ -139,6 +114,14 @@ function bratonien_tools_nc_connector_create_webdav_placeholder_from_wizard() && (string)$editing_connection['adapter'] === 'remote' && (string)($editing_connection['config']['source_mode'] ?? '') === 'webdav-placeholder' && $editing_mode === 'update'; + $migrating_legacy = $editing_connection + && (string)$editing_connection['adapter'] === 'local' + && $editing_mode === 'migrate'; + + if ($editing_mode === 'migrate' && !$migrating_legacy) + { + throw new RuntimeException('Die fuer die Migration ausgewaehlte Legacy-Verbindung ist nicht mehr verfuegbar.'); + } $config = array( 'origin'=>'native', @@ -202,12 +185,12 @@ function bratonien_tools_nc_connector_create_webdav_placeholder_from_wizard() $config_json = json_encode($config, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); if (!is_string($config_json)) throw new RuntimeException('WebDAV-Konfiguration konnte nicht serialisiert werden.'); - pwg_query("UPDATE `$table` SET name='".pwg_db_real_escape_string($name)."', config_json='".pwg_db_real_escape_string($config_json)."', secret_blob='".pwg_db_real_escape_string($secret_blob)."', updated='".pwg_db_real_escape_string($now)."' WHERE id=".$editing_id." LIMIT 1"); + pwg_query("UPDATE `$table` SET name='".pwg_db_real_escape_string($name)."', config_json='".pwg_db_real_escape_string($config_json)."', secret_blob='".pwg_db_real_escape_string($secret_blob)."', updated='".pwg_db_real_escape_string($now)."' WHERE id=".$editing_id." AND adapter='remote' LIMIT 1"); unset($_SESSION['bratonien_nc_wizard']); return array( 'connection_id'=>$editing_id, - 'message'=>'WebDAV-Verbindung #'.$editing_id.' wurde gespeichert. Der nächste Connector-Lauf verwendet die neuen Einstellungen.', + 'message'=>'WebDAV-Verbindung #'.$editing_id.' wurde gespeichert. Der naechste Connector-Lauf verwendet die neuen Einstellungen.', ); } @@ -226,22 +209,26 @@ function bratonien_tools_nc_connector_create_webdav_placeholder_from_wizard() $id = (int)pwg_db_insert_id(); if ($id < 1) throw new RuntimeException('Die WebDAV-Verbindung konnte nicht eindeutig angelegt werden.'); + $legacy_fallback_id = null; try { $config['state_dir'] = '/var/lib/bratonien-tools/nc-connector/connection-'.$id; $config['status_file'] = $config['state_dir'].'/connector-status.json'; - $legacy_fallback_id = bratonien_tools_nc_connector_pair_migration_fallback($id, $config, $now); + if ($migrating_legacy) + { + $legacy_fallback_id = bratonien_tools_nc_connector_pair_migration_fallback($editing_id, $id, $config, $now); + } $config_json = json_encode($config, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); if (!is_string($config_json)) { throw new RuntimeException('Die WebDAV-Verbindung konnte nach dem Anlegen nicht serialisiert werden.'); } - pwg_query("UPDATE `$table` SET config_json='".pwg_db_real_escape_string($config_json)."' WHERE id=".$id." LIMIT 1"); + pwg_query("UPDATE `$table` SET config_json='".pwg_db_real_escape_string($config_json)."' WHERE id=".$id." AND adapter='remote' LIMIT 1"); } catch (Throwable $e) { - pwg_query("DELETE FROM `$table` WHERE id=".$id." LIMIT 1"); + pwg_query("DELETE FROM `$table` WHERE id=".$id." AND adapter='remote' LIMIT 1"); throw $e; } From 88c787c9563be25233cfde7d1ba96020c6136634 Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Wed, 19 Aug 2026 16:02:02 +0200 Subject: [PATCH 2/9] 0.9.6.19 preserve Nextcloud root selection --- include/nc_connector_edit.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/nc_connector_edit.inc.php b/include/nc_connector_edit.inc.php index 4bacb04..17c261c 100644 --- a/include/nc_connector_edit.inc.php +++ b/include/nc_connector_edit.inc.php @@ -112,7 +112,7 @@ function bratonien_tools_nc_connector_prepare_webdav_wizard_from_connection(arra { $path = trim((string)($root['webdav_path'] ?? ''), '/'); $fileid = (int)($root['fileid'] ?? 0); - if ($path === '' || $fileid < 1) continue; + if ($fileid < 1) continue; $selected[] = $path; $selected_ids[$path] = $fileid; } From 03e92b74a7d529fe0bab6cafaf35b1bc736eb3f1 Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Wed, 19 Aug 2026 16:03:50 +0200 Subject: [PATCH 3/9] 0.9.6.19 expose exact migration fallback to runtime --- runtime/reconcile-webdav.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/runtime/reconcile-webdav.php b/runtime/reconcile-webdav.php index 47134fb..9e093c2 100644 --- a/runtime/reconcile-webdav.php +++ b/runtime/reconcile-webdav.php @@ -134,6 +134,17 @@ try if ($baseUrl === '') fail_webdav_reconcile('Nextcloud-Adresse fehlt.'); if (!$roots) fail_webdav_reconcile('Keine WebDAV-Wurzeln gespeichert.'); + $migration = isset($config['migration']) && is_array($config['migration']) ? $config['migration'] : array(); + $legacyFallbackId = 0; + if ((string)($migration['role'] ?? '') === 'webdav-primary-candidate') + { + $legacyFallbackId = (int)($migration['legacy_fallback_connection_id'] ?? 0); + if ($legacyFallbackId < 1 || $legacyFallbackId === $id) + { + fail_webdav_reconcile('Die gespeicherte Migrationszuordnung zur Legacy-Verbindung ist ungueltig.'); + } + } + $credentials = decrypt_webdav_credentials((string)$row['secret_blob'], $hexKey); $user = trim($credentials['nextcloud_user']); $password = $credentials['nextcloud_password']; @@ -198,6 +209,7 @@ try $lines = array( 'PIWIGO_ROOT='.webdav_shell_value($piwigoRoot), 'CONNECTION_ID='.$id, + 'MIGRATION_LEGACY_CONNECTION_ID='.$legacyFallbackId, 'SOURCE_MODE=webdav-placeholder', 'WEBDAV_BASE_URL='.webdav_shell_value($baseUrl), 'WEBDAV_USER='.webdav_shell_value($user), @@ -223,13 +235,15 @@ try 'mode'=>'parallel-webdav', 'config'=>$configPath, 'piwigo_sync_enabled'=>true, + 'legacy_fallback_connection_id'=>$legacyFallbackId, 'reconciled_at'=>date('Y-m-d H:i:s'), ); $json = json_encode($config, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); - if (is_string($json)) + if (!is_string($json)) fail_webdav_reconcile('WebDAV-Runtime-Konfiguration konnte nicht serialisiert werden.'); + $escaped = $db->real_escape_string($json); + if (!$db->query("UPDATE `{$table}` SET config_json='{$escaped}' WHERE id={$id} AND adapter='remote' LIMIT 1")) { - $escaped = $db->real_escape_string($json); - $db->query("UPDATE `{$table}` SET config_json='{$escaped}' WHERE id={$id} LIMIT 1"); + fail_webdav_reconcile('WebDAV-Runtime-Status konnte nicht gespeichert werden: '.$db->error); } } catch (Throwable $e) From d4e3e7faaba083f3240c5bd7d84da40000280b7d Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Wed, 19 Aug 2026 16:04:27 +0200 Subject: [PATCH 4/9] 0.9.6.19 route WebDAV and legacy per connection --- runtime/run-all.sh | 192 ++++++++++++++++++++++++++++----------------- 1 file changed, 122 insertions(+), 70 deletions(-) diff --git a/runtime/run-all.sh b/runtime/run-all.sh index ddf90a5..c6cd7da 100644 --- a/runtime/run-all.sh +++ b/runtime/run-all.sh @@ -5,6 +5,10 @@ CONFIG_DIR="/etc/bratonien-tools/nc-connector" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" shopt -s nullglob +declare -A webdav_success_for_legacy=() +declare -A webdav_failure_for_legacy=() +declare -A legacy_seen=() + read_config_value() { local key="$1" local file="$2" @@ -17,6 +21,15 @@ read_config_value() { printf '%s' "$value" } +numeric_connection_id() { + local value="${1:-}" + if [[ "$value" =~ ^[0-9]+$ ]]; then + printf '%s' "$value" + else + printf '0' + fi +} + compact_text() { printf '%s\n' "$1" | tail -n 20 | tr '\n' ' ' | sed 's/[[:space:]]\+/ /g; s/^[[:space:]]//; s/[[:space:]]$//' } @@ -133,72 +146,76 @@ done [[ -n "$route_piwigo_root" ]] || route_piwigo_root="/var/www/piwigo" ROUTE_STATUS_FILE="${route_piwigo_root%/}/_data/bratonien-tools/nc-connector-status/route-status.json" -webdav_success=0 -webdav_failed=0 -webdav_failure_detail="" +webdav_success_count=0 +webdav_failure_count=0 +legacy_run_count=0 +legacy_failure_count=0 +fallback_used=0 +unpaired_webdav_failure=0 +summary_parts=() -if [[ ${#webdav_configs[@]} -eq 0 ]]; then - webdav_failed=1 - webdav_failure_detail="Keine WebDAV-Runtime-Verbindung ist konfiguriert. Es existiert aktuell nur die Legacy-Verbindung; deshalb kann WebDAV nicht primaer laufen." - echo "NC Connector: $webdav_failure_detail" >&2 -else - for config in "${webdav_configs[@]}"; do - name="$(basename "$config")" - echo "NC Connector WebDAV primaer: $name" - webdav_output="" - if webdav_output="$(env PIWIGO_CONFIG="$config" bash "$SCRIPT_DIR/sync-webdav.sh" 2>&1)"; then - webdav_success=1 - [[ -z "$webdav_output" ]] || printf '%s\n' "$webdav_output" +for config in "${webdav_configs[@]}"; do + name="$(basename "$config")" + connection_id="$(numeric_connection_id "$(read_config_value CONNECTION_ID "$config")")" + legacy_id="$(numeric_connection_id "$(read_config_value MIGRATION_LEGACY_CONNECTION_ID "$config")")" + + if [[ "$connection_id" -lt 1 ]]; then + echo "NC Connector: $name besitzt keine gueltige WebDAV-Verbindungs-ID." >&2 + webdav_failure_count=$((webdav_failure_count + 1)) + unpaired_webdav_failure=1 + summary_parts+=("$name: ungueltige Verbindungs-ID") + continue + fi + + echo "NC Connector WebDAV #$connection_id: $name" + webdav_output="" + if webdav_output="$(env PIWIGO_CONFIG="$config" bash "$SCRIPT_DIR/sync-webdav.sh" 2>&1)"; then + webdav_success_count=$((webdav_success_count + 1)) + [[ -z "$webdav_output" ]] || printf '%s\n' "$webdav_output" + if [[ "$legacy_id" -gt 0 ]]; then + webdav_success_for_legacy["$legacy_id"]="$connection_id" + summary_parts+=("WebDAV #$connection_id erfolgreich; Legacy #$legacy_id uebersprungen") else - webdav_exit=$? - webdav_failed=1 - [[ -z "$webdav_output" ]] || printf '%s\n' "$webdav_output" >&2 - webdav_failure_detail="$(read_webdav_failure_detail "$config" "$webdav_output")" - webdav_failure_detail="Exit-Code ${webdav_exit}: ${webdav_failure_detail}" - echo "NC Connector: WebDAV-Lauf fehlgeschlagen: $webdav_failure_detail" >&2 - echo "NC Connector: Legacy-Fallback bleibt verfuegbar." >&2 + summary_parts+=("WebDAV #$connection_id erfolgreich") fi - done -fi + else + webdav_exit=$? + webdav_failure_count=$((webdav_failure_count + 1)) + [[ -z "$webdav_output" ]] || printf '%s\n' "$webdav_output" >&2 + webdav_failure_detail="$(read_webdav_failure_detail "$config" "$webdav_output")" + webdav_failure_detail="Exit-Code ${webdav_exit}: ${webdav_failure_detail}" + echo "NC Connector: WebDAV #$connection_id fehlgeschlagen: $webdav_failure_detail" >&2 -if [[ "$webdav_success" -eq 1 ]]; then - write_route_status \ - "webdav" \ - "WebDAV (primaer)" \ - "WebDAV erfolgreich. Legacy-Fallback wurde in diesem Lauf nicht ausgefuehrt." \ - "0" \ - "1" - echo "NC Connector: WebDAV erfolgreich; Legacy-Verbindung wird in diesem Lauf nicht ausgefuehrt." - exit 0 -fi - -if [[ ${#configs[@]} -eq 0 ]]; then - [[ -n "$webdav_failure_detail" ]] || webdav_failure_detail="WebDAV ist fehlgeschlagen; Ursache konnte nicht ermittelt werden." - write_route_status \ - "failed" \ - "FEHLER - kein Datenweg" \ - "WebDAV-Fehler: $webdav_failure_detail Keine Legacy-Fallback-Verbindung vorhanden." \ - "0" \ - "0" - echo "NC Connector: WebDAV ist fehlgeschlagen und es ist keine Legacy-Fallback-Verbindung vorhanden." >&2 - exit 1 -fi - -echo "NC Connector: kein erfolgreicher WebDAV-Lauf; Legacy-Fallback wird ausgefuehrt." -legacy_result=0 + if [[ "$legacy_id" -gt 0 ]]; then + webdav_failure_for_legacy["$legacy_id"]="$webdav_failure_detail" + echo "NC Connector: Nur Legacy-Verbindung #$legacy_id ist fuer diesen WebDAV-Lauf als Fallback vorgesehen." >&2 + else + unpaired_webdav_failure=1 + summary_parts+=("WebDAV #$connection_id fehlgeschlagen ohne Legacy-Fallback") + fi + fi +done for config in "${configs[@]}"; do name="$(basename "$config")" - connection_id="" + connection_id="0" if [[ "$name" =~ ^connection-([0-9]+)\.conf$ ]]; then connection_id="${BASH_REMATCH[1]}" fi + if [[ "$connection_id" -lt 1 ]]; then + echo "NC Connector: $name besitzt keine gueltige Legacy-Verbindungs-ID." >&2 + legacy_failure_count=$((legacy_failure_count + 1)) + summary_parts+=("$name: ungueltige Legacy-Verbindungs-ID") + continue + fi + legacy_seen["$connection_id"]=1 + piwigo_root="$(read_config_value PIWIGO_ROOT "$config")" [[ -n "$piwigo_root" ]] || piwigo_root="/var/www/piwigo" tombstone_dir="${piwigo_root%/}/_data/bratonien-tools/nc-connector-status" - if [[ -n "$connection_id" && -f "$tombstone_dir/deleted-$connection_id" ]]; then + if [[ -f "$tombstone_dir/deleted-$connection_id" ]]; then echo "NC Connector: Verbindung $connection_id wurde geloescht; Laufzeitdateien werden entfernt." rm -f -- "$CONFIG_DIR/connection-$connection_id.conf" \ "$CONFIG_DIR/connection-$connection_id.db-password" \ @@ -209,33 +226,68 @@ for config in "${configs[@]}"; do continue fi - echo "NC Connector Legacy-Fallback: $name" - if ! env PIWIGO_CONFIG="$config" bash "$SCRIPT_DIR/sync.sh"; then - legacy_result=1 + if [[ -n "${webdav_success_for_legacy[$connection_id]:-}" ]]; then + echo "NC Connector: Legacy #$connection_id wird nicht ausgefuehrt, weil der zugeordnete WebDAV-Nachfolger #${webdav_success_for_legacy[$connection_id]} erfolgreich war." + continue + fi + + legacy_run_count=$((legacy_run_count + 1)) + if [[ -n "${webdav_failure_for_legacy[$connection_id]:-}" ]]; then + echo "NC Connector Legacy-Fallback #$connection_id nach WebDAV-Fehler: $name" + fallback_used=1 + else + echo "NC Connector Legacy #$connection_id: $name" + fi + + if env PIWIGO_CONFIG="$config" bash "$SCRIPT_DIR/sync.sh"; then + if [[ -n "${webdav_failure_for_legacy[$connection_id]:-}" ]]; then + summary_parts+=("WebDAV fuer Legacy #$connection_id fehlgeschlagen; Legacy-Fallback erfolgreich") + else + summary_parts+=("Legacy #$connection_id erfolgreich") + fi + else + legacy_failure_count=$((legacy_failure_count + 1)) + summary_parts+=("Legacy #$connection_id fehlgeschlagen") fi done -if [[ "$legacy_result" -eq 0 ]]; then - [[ -n "$webdav_failure_detail" ]] || webdav_failure_detail="WebDAV war nicht erfolgreich; Ursache konnte nicht ermittelt werden." - write_route_status \ - "legacy_fallback" \ - "LEGACY-FALLBACK AKTIV" \ - "WebDAV-Fehler: $webdav_failure_detail Legacy-Fallback wurde erfolgreich ausgefuehrt." \ - "1" \ - "1" - echo "NC Connector: Legacy-Fallback erfolgreich." +for legacy_id in "${!webdav_failure_for_legacy[@]}"; do + if [[ -z "${legacy_seen[$legacy_id]:-}" ]]; then + echo "NC Connector: WebDAV fuer Legacy #$legacy_id ist fehlgeschlagen, aber die zugeordnete Legacy-Runtime fehlt." >&2 + legacy_failure_count=$((legacy_failure_count + 1)) + summary_parts+=("Fallback #$legacy_id fehlt") + fi +done + +summary_detail="$(IFS='; '; printf '%s' "${summary_parts[*]}")" +[[ -n "$summary_detail" ]] || summary_detail="Keine Connector-Route wurde ausgefuehrt." + +if [[ "$unpaired_webdav_failure" -eq 0 && "$legacy_failure_count" -eq 0 ]]; then + if [[ "$fallback_used" -eq 1 ]]; then + route="mixed_fallback" + label="MIGRATION - FALLBACK AKTIV" + elif [[ "$webdav_success_count" -gt 0 && "$legacy_run_count" -gt 0 ]]; then + route="mixed" + label="WebDAV + Legacy" + elif [[ "$webdav_success_count" -gt 0 ]]; then + route="webdav" + label="WebDAV" + else + route="legacy" + label="Legacy" + fi + + write_route_status "$route" "$label" "$summary_detail" "$fallback_used" "1" + echo "NC Connector: alle erforderlichen Verbindungen wurden erfolgreich verarbeitet." exit 0 fi -[[ -n "$webdav_failure_detail" ]] || webdav_failure_detail="WebDAV war nicht erfolgreich; Ursache konnte nicht ermittelt werden." write_route_status \ "failed" \ - "FEHLER - WebDAV und Fallback" \ - "WebDAV-Fehler: $webdav_failure_detail Legacy-Fallback ist ebenfalls fehlgeschlagen." \ - "1" \ + "FEHLER - mindestens eine Verbindung" \ + "$summary_detail" \ + "$fallback_used" \ "0" -if [[ "$webdav_failed" -eq 1 ]]; then - echo "NC Connector: WebDAV und Legacy-Fallback sind fehlgeschlagen." >&2 -fi +echo "NC Connector: mindestens eine erforderliche Verbindung ist fehlgeschlagen." >&2 exit 1 From 1a0f8c61e84bf1f6fc4b7a673cc12d741a3e22d9 Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Wed, 19 Aug 2026 16:05:19 +0200 Subject: [PATCH 5/9] 0.9.6.19 test supported PHP branches and all admin JS --- .github/workflows/lint.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 76e6c52..52b2264 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,8 +5,12 @@ on: pull_request: jobs: - syntax: + php-syntax: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-version: ['8.2', '8.3', '8.4', '8.5'] steps: - name: Repository auschecken uses: actions/checkout@v4 @@ -14,7 +18,7 @@ jobs: - name: PHP installieren uses: shivammathur/setup-php@v2 with: - php-version: '8.2' + php-version: ${{ matrix.php-version }} coverage: none - name: PHP Syntax pruefen @@ -36,6 +40,12 @@ jobs: exit 1 fi + script-syntax: + runs-on: ubuntu-latest + steps: + - name: Repository auschecken + uses: actions/checkout@v4 + - name: Admin JavaScript Syntax pruefen shell: bash run: | @@ -43,6 +53,7 @@ jobs: sed -n '/