For developers

Legacy import

packages/core/src/Modules/LegacyImport: brings a shop's data over from the previous version's MySQL database (syn_ tables).

  • Contracts\LegacySource gives the old database's connection: Import\LegacyDatabase (MySQL from LegacyImportSettings, the session set to read-only transactions) in a shop, an in-memory SQLite copy in tests.
  • Import\ImportStep (tag legacy-import-step): key(), after() (steps that must run first) and run($legacy, IdMap, StepReport, $dryRun). Import\Importer orders the steps, runs each in a transaction (a dry run is rolled back) and records a legacy_import_runs row with its counts and up to 200 records left behind.
  • Import\IdMap (legacy_import_map): old id → new id by kind (category, brand, product, product_variant, variant), so a second run updates instead of duplicating.
  • Writes go through the owning modules' contracts: Catalog\Contracts\CatalogImport, Inventory\Contracts\StockCounts, Storefront\Contracts\RedirectBook, Stores\Contracts\Locations.
  • Steps: categories, brands, products (after both), redirects (after products), customers, orders (after customers and products). Customers go through Customers\Contracts\CustomerImport, orders through Orders\Contracts\OrderImport (history: no events, stock moves or invoices; orders.source = legacy).
  • Old passwords are unsalted MD5: stored as bcrypt(md5) with customers.password_legacy = 'md5'; Customers\Accounts\Passwords::check() verifies that way and rehashes at the first sign-in (web and API); a reset or change clears the marker.
  • images reads only files inside the configured folder (realpath, basename), the largest copy first, through CatalogImport::image() (content-checked images, copied); a dry run never copies. pages writes drafts through Content\Contracts\PageImport (HTML to Markdown, scripts dropped) and 301s through RedirectBook::toPage().
  • An account found only by e-mail is merged into only when its owner confirmed the address (ImportConflict otherwise, left behind in the run).
  • Import\AddressMatcher maps the old courier county and locality ids to the address register by name (no diacritics, no case); order addresses that do not match keep the old names with id 0. Old text through Import\LegacyText (names decoded, HTML to plain text, lei to bani, slugs kept when valid).

Tests: tests/Feature/LegacyImport/CatalogImportTest.php, CustomersOrdersImportTest.php, ImagesPagesImportTest.php.