Commit e63798b
Add URL rewriting for imported SQL data
Adds a `db-apply` command that reads `db.sql`, rewrites URLs in decoded
base64 string values using wp-php-toolkit structured processors (no regex),
and executes statements against a target MySQL database with cursor-based
resumability.
Key components:
- Base64ValueScanner: extracts FROM_BASE64('...') values from SQL
- ContentClassifier: detects serialized PHP (skip), JSON, or text/HTML
- SqlValueUrlRewriter: rewrites URLs via BlockMarkupUrlProcessor/URLInTextProcessor
- SqlStatementRewriter: orchestrates per-statement rewriting
- DomainCollector: discovers HTTP/HTTPS domains during db-sync download
Domain discovery runs inline during db-sync, saving results to
.import-domains.json. The db-apply command uses WP_MySQL_Naive_Query_Stream
(vendored from WordPress/sqlite-database-integration#264) for streaming
SQL execution with periodic state checkpoints.
72 unit tests covering all components. E2E test scaffolding included.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 4e9ab39 commit e63798b
File tree
23 files changed
+6085
-7
lines changed- importer
- lib
- mysql-query-stream
- tests
- UrlRewriting
- e2e
- tests
23 files changed
+6085
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments