You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support exporting from SQLite WordPress sites (#14)
## Summary
Adds a `create_db_connection()` factory that selects the right database
driver – PDO MySQL or `SqliteDriverPDO` adapter that runs the SQL
queries using the MySQL-on-SQLite adapter. It only implements the
methods used by our `MySQLDumpProducer` and will eventually be replaced
by the upstream PDO adapter implementation once it becomes available.
**Other changes:**
- Removes `api.php` that allowed a standalone access to the site export
endpoint. We don't really need that. Exporting a WordPress site depends
on the WordPress runtime.
- `resolve_db_credentials()` skips MySQL credential validation on SQLite
sites
- Preflight reports `db_engine` and checks `pdo_sqlite` instead of
`pdo_mysql`
- MySQL `@@variable` queries in preflight wrapped in their own try/catch
for graceful degradation
- `MySQLDumpProducer` constructor PDO type hint removed (adapter is
duck-typed, PHP 7.4 lacks unions)
- The factory verifies `SQLITE_DRIVER_VERSION >= 2.1.0` (when
`get_connection()` stabilized) and throws a clear error if the plugin is
too old.
## E2E test
The new `import-35-sqlite-export.test.js` provisions a real SQLite
WordPress site: downloads the sqlite-database-integration plugin,
creates the db.php drop-in, writes wp-config.php with
`WP_SQLITE_AST_DRIVER=true`, and runs `wp core install` to populate
tables in the .ht.sqlite file. It then verifies:
1. Preflight reports `db_engine: "sqlite"` with a working connection
2. db-sync produces a valid MySQL dump with CREATE TABLE and INSERT for
all WP tables
3. The dump imports into MySQL and all 10 standard WordPress tables
contain the expected data
## Test plan
- [x] All 268 existing tests pass (`composer test`)
- [x] PHPStan clean (`composer analyze`)
- [x] E2E test passes in CI (SQLite site export → MySQL import
round-trip)
- [x] Verify standard MySQL export unchanged
0 commit comments