Skip to content

Commit e63798b

Browse files
adamzielclaude
andcommitted
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

23 files changed

+6085
-7
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"require": {
77
"php": ">=7.4",
88
"ext-pdo": "*",
9-
"ext-pdo_mysql": "*"
9+
"ext-pdo_mysql": "*",
10+
"wp-php-toolkit/data-liberation": "^0.4",
11+
"wp-php-toolkit/html": "^0.4"
1012
},
1113
"require-dev": {
1214
"phpunit/phpunit": "^10.0",

composer.lock

Lines changed: 365 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)