From ff0c1e0bec915d956bd176b59fd861a8ec408d9d Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Wed, 19 Aug 2026 15:26:54 +0200 Subject: [PATCH 1/4] 0.9.6.18 complete migration after WebDAV source selection --- .../nc_connector_wizard_webdav_flow.inc.php | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/include/nc_connector_wizard_webdav_flow.inc.php b/include/nc_connector_wizard_webdav_flow.inc.php index a6b1cf0..3dc3700 100644 --- a/include/nc_connector_wizard_webdav_flow.inc.php +++ b/include/nc_connector_wizard_webdav_flow.inc.php @@ -160,7 +160,35 @@ function bratonien_tools_nc_wizard_save_sources_dispatch() $state['directory_selection_ready'] = false; bratonien_tools_nc_wizard_store($state); - return array('message'=>'WebDAV-Verzeichnisse wurden übernommen. Die Verbindung ist für den parallelen Testweg vorbereitet.'); + if ((string)($state['editing_mode'] ?? '') === 'migrate') + { + $editing_id = (int)($state['editing_connection_id'] ?? 0); + $connection = $editing_id > 0 ? bratonien_tools_nc_connector_connection($editing_id, true) : null; + if (!$connection || (string)$connection['adapter'] !== 'local') + { + throw new RuntimeException('Die zu migrierende Legacy-Verbindung ist nicht mehr verfügbar.'); + } + + $migration = bratonien_tools_nc_connector_migration_state($connection); + if (empty($migration['ready'])) + { + throw new RuntimeException('Die WebDAV-Migration kann noch nicht abgeschlossen werden. Es fehlen: '.implode(', ', $migration['missing']).'.'); + } + + $credentials = bratonien_tools_nc_connector_scoped_secret($connection); + $state['_api_key_id'] = (string)($credentials['api_key_id'] ?? ''); + $state['_api_key_secret'] = (string)($credentials['api_key_secret'] ?? ''); + $state['api_status'] = 'ok'; + bratonien_tools_nc_wizard_store($state); + + $result = bratonien_tools_nc_connector_create_webdav_placeholder_from_wizard(); + unset($_SESSION['bratonien_nc_wizard']); + return array( + 'message'=>(string)($result['message'] ?? 'WebDAV-Nachfolger wurde angelegt. Die Legacy-Verbindung bleibt als Fallback erhalten.'), + ); + } + + return array('message'=>'WebDAV-Verzeichnisse wurden übernommen. Die Verbindung ist für den nächsten Einrichtungsschritt vorbereitet.'); } function bratonien_tools_nc_wizard_finish_dispatch() From 936a1cf3c4ec4fd098b00506beadcfe1a34c56ee Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Wed, 19 Aug 2026 15:27:39 +0200 Subject: [PATCH 2/4] 0.9.6.18 allow Nextcloud root in WebDAV runtime --- runtime/reconcile-webdav.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/reconcile-webdav.php b/runtime/reconcile-webdav.php index f6c4262..47134fb 100644 --- a/runtime/reconcile-webdav.php +++ b/runtime/reconcile-webdav.php @@ -165,7 +165,6 @@ try if (!is_dir($galleryRoot) && !mkdir($galleryRoot, 0755, true)) fail_webdav_reconcile('WebDAV-Galeriebereich konnte nicht angelegt werden.'); @chmod($galleryRoot, 0755); - // Alte technische Wrapper unter ./galleries duerfen nicht als Piwigo-Alben auftauchen. webdav_remove_generated_tree($legacyDefault, $legacyGalleryRoot); $sourceDir = $publicSourceRoot.'/connection-'.$id; @@ -189,8 +188,9 @@ try { $path = trim((string)($root['webdav_path'] ?? ''), '/'); $display = trim((string)($root['display_name'] ?? '')); - if ($path === '' || $display === '' || preg_match('/[\t\r\n]/', $path.$display)) fail_webdav_reconcile('Eine gespeicherte WebDAV-Wurzel ist ungueltig.'); - $rootLines[] = $path."\t".$display; + $runtimePath = $path === '' ? '/' : $path; + if ($display === '' || preg_match('/[\t\r\n]/', $runtimePath.$display)) fail_webdav_reconcile('Eine gespeicherte WebDAV-Wurzel ist ungueltig.'); + $rootLines[] = $runtimePath."\t".$display; } file_put_contents($rootsPath, implode("\n", $rootLines)."\n", LOCK_EX); @chmod($rootsPath, 0600); From ae815bc077b715fe92973b93a0c4eb2de5f6e8a1 Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Wed, 19 Aug 2026 15:28:41 +0200 Subject: [PATCH 3/4] 0.9.6.18 make selected path lead directly to final migration confirmation --- include/nc_connector_wizard_webdav_flow.inc.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/nc_connector_wizard_webdav_flow.inc.php b/include/nc_connector_wizard_webdav_flow.inc.php index 3dc3700..0ea8403 100644 --- a/include/nc_connector_wizard_webdav_flow.inc.php +++ b/include/nc_connector_wizard_webdav_flow.inc.php @@ -158,7 +158,6 @@ function bratonien_tools_nc_wizard_save_sources_dispatch() $state['technical_source'] = 'WebDAV-Verzeichnisse ausgewählt'; $state['technical_error'] = ''; $state['directory_selection_ready'] = false; - bratonien_tools_nc_wizard_store($state); if ((string)($state['editing_mode'] ?? '') === 'migrate') { @@ -179,15 +178,14 @@ function bratonien_tools_nc_wizard_save_sources_dispatch() $state['_api_key_id'] = (string)($credentials['api_key_id'] ?? ''); $state['_api_key_secret'] = (string)($credentials['api_key_secret'] ?? ''); $state['api_status'] = 'ok'; + $state['api_error'] = ''; + $state['step'] = 4; bratonien_tools_nc_wizard_store($state); - $result = bratonien_tools_nc_connector_create_webdav_placeholder_from_wizard(); - unset($_SESSION['bratonien_nc_wizard']); - return array( - 'message'=>(string)($result['message'] ?? 'WebDAV-Nachfolger wurde angelegt. Die Legacy-Verbindung bleibt als Fallback erhalten.'), - ); + return array('message'=>'WebDAV-Quelle wurde übernommen. Mit „Migration starten“ wird jetzt der WebDAV-Nachfolger angelegt; die Legacy-Verbindung bleibt als Fallback erhalten.'); } + bratonien_tools_nc_wizard_store($state); return array('message'=>'WebDAV-Verzeichnisse wurden übernommen. Die Verbindung ist für den nächsten Einrichtungsschritt vorbereitet.'); } From 3d5e6c82eaa3de24f6f9440022cc4267cff4c8dd Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Wed, 19 Aug 2026 15:29:30 +0200 Subject: [PATCH 4/4] 0.9.6.18 bump version for migration runtime fix --- main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.inc.php b/main.inc.php index cb64986..5f5a60f 100644 --- a/main.inc.php +++ b/main.inc.php @@ -1,7 +1,7 @@