diff --git a/include/nc_connector_wizard_webdav_flow.inc.php b/include/nc_connector_wizard_webdav_flow.inc.php index a6b1cf0..0ea8403 100644 --- a/include/nc_connector_wizard_webdav_flow.inc.php +++ b/include/nc_connector_wizard_webdav_flow.inc.php @@ -158,9 +158,35 @@ 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); - 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'; + $state['api_error'] = ''; + $state['step'] = 4; + bratonien_tools_nc_wizard_store($state); + + 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.'); } function bratonien_tools_nc_wizard_finish_dispatch() 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 @@