Split import revamp from import/export branch#4244
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR splits out the “import” side of the import/export revamp into a smaller, reviewable set of changes. It introduces new Import/Export PHP infrastructure (autoloaded under Redirection\ImportExport) and a new Import UI flow (file / paste / plugin importers), plus supporting parsers/sanitizers and tests.
Changes:
- Add new import/export PHP module (repositories, import runner, format handlers, parsers, sanitizers, plugin importers) and wire it via an Import/Export autoloader.
- Introduce a new Import page UI (paste/file/plugin sources, options, preview/results, API error rendering) and expand API request helpers/types.
- Add unit/integration tests and fixtures covering CSV/JSON parsing/sanitization and import behaviors.
Reviewed changes
Copilot reviewed 85 out of 85 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test-json-parser.php | Unit tests for JSON parser |
| tests/unit/test-import-redirect.php | Unit tests for dedupe/save flow |
| tests/unit/test-import-group.php | Unit tests for group resolution |
| tests/unit/test-csv-sanitizer.php | Unit tests for CSV sanitization |
| tests/unit/test-csv-parser.php | Unit tests for CSV row parsing |
| tests/unit/stubs/functions.php | WP stub helpers for unit tests |
| tests/unit/stubs/functions-http.php | HTTP-related WP stubs |
| tests/unit/stubs/class-test-import-group-item.php | Group stub for imports |
| tests/unit/stubs/class-red-item.php | Redirect item stub |
| tests/unit/stubs/class-red-group.php | Group stub |
| tests/integration/import-export/test-import-csv.php | Integration tests for CSV import |
| tests/integration/import-export/fixtures/semicolon.csv | CSV fixture |
| tests/integration/import-export/fixtures/multiline-ending.csv | CSV fixture (multiline endings) |
| tests/integration/core/test-settings.php | Integration test for portable options |
| tests/api-test.php | Update API test capability handling |
| src/types/schemas/io.ts | Extend IO schema types |
| src/page/import/types.ts | Import page state/types |
| src/page/import/paste-importer.tsx | Paste source importer card |
| src/page/import/index.tsx | Import page composition |
| src/page/import/import-results.tsx | Import/preview results UI |
| src/page/import/import-results.test.tsx | Tests for results UI |
| src/page/import/import-options.tsx | Import options (group/dupes/sections) |
| src/page/home/index.tsx | Menu/title update for Import |
| src/page/export/download.ts | Download/copy helpers for export |
| src/lib/api/errors.ts | Preserve richer API error fields |
| src/lib/api-request/index.ts | Add import/export endpoints/options |
| src/component/welcome-wizard/step-importing.tsx | Wizard import execution step |
| src/component/import-export/importer.tsx | Plugin importer UI card |
| src/component/import-export/importer.test.tsx | Tests for importer card |
| src/component/import-export/import-sniff.test.ts | Tests for sniffing pasted/file content |
| src/component/import-export/card.tsx | Shared IO card component |
| src/component/import-export/api-error.tsx | Import/export API error renderer |
| redirection.php | Register Import/Export autoloader |
| models/options.php | Add portable import/export options filter |
| models/group.php | Add export representation for groups |
| includes/import-export/sanitizer/class-htaccess-sanitizer.php | Sanitize .htaccess rule parts |
| includes/import-export/sanitizer/class-csv-sanitizer.php | CSV formula-injection protection |
| includes/import-export/parser/class-json-parser.php | JSON import parser |
| includes/import-export/parser/class-csv-parser.php | CSV row parser for redirects |
| includes/import-export/importer/class-wordpress-old-slugs.php | Importer: WordPress old slugs |
| includes/import-export/importer/class-slim-seo.php | Importer: Slim SEO |
| includes/import-export/importer/class-simple301.php | Importer: Simple 301 Redirects |
| includes/import-export/importer/class-seopress.php | Importer: SEOPress |
| includes/import-export/importer/class-seo-redirection.php | Importer: SEO Redirection |
| includes/import-export/importer/class-safe-redirect-manager.php | Importer: Safe Redirect Manager |
| includes/import-export/importer/class-redirect-item-mapper.php | Map external plugin data to redirects |
| includes/import-export/importer/class-rank-math.php | Importer: RankMath |
| includes/import-export/importer/class-quick-redirects.php | Importer: Quick Page/Post Redirects |
| includes/import-export/importer/class-pretty-links.php | Importer: Pretty Links |
| includes/import-export/importer/class-plugin.php | Base importer implementation |
| includes/import-export/importer/class-plugin-registry.php | Registry + preview/import dispatch |
| includes/import-export/importer/class-fake-redirection.php | Importer: Fake Redirection |
| includes/import-export/importer/class-eps301-redirects.php | Importer: 301 Redirects |
| includes/import-export/format/class-rss.php | RSS format handler |
| includes/import-export/format/class-nginx.php | Nginx format handler |
| includes/import-export/format/class-csv.php | CSV format handler |
| includes/import-export/format/class-apache.php | Apache/.htaccess format handler |
| includes/import-export/class-redirect-repository.php | Redirect persistence/lookup wrapper |
| includes/import-export/class-redirect-duplicate-matcher.php | Duplicate matching logic |
| includes/import-export/class-import-service.php | File import orchestrator |
| includes/import-export/class-import-redirect.php | Import save + preview counters |
| includes/import-export/class-import-preview-group.php | Dry-run group representation |
| includes/import-export/class-import-group.php | Import group resolver/creator |
| includes/import-export/class-htaccess.php | .htaccess exporter wrapper |
| includes/import-export/class-htaccess-target-builder.php | Build htaccess targets/flags |
| includes/import-export/class-htaccess-rule-builder.php | Build htaccess rules |
| includes/import-export/class-htaccess-encoder.php | Encode/sanitize htaccess content |
| includes/import-export/class-group-repository.php | Group lookup/export wrapper |
| includes/import-export/class-format-handler.php | Base format contract/types |
| includes/import-export/class-format-factory.php | Format handler factory |
| includes/import-export/class-file-reader.php | File read/open helper |
| includes/import-export/class-export-details.php | Shared export metadata |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Keep CoPilot happy
Comment on lines
3
to
8
| on: | ||
| pull_request: | ||
| branches: | ||
| - trunk | ||
| - main | ||
| push: | ||
| branches: | ||
| - trunk | ||
| - main | ||
|
|
Owner
Author
There was a problem hiding this comment.
Repo is using trunk, not main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split branch from #4243 to make it smaller and more reviewable.
The matching export PR is to follow in #4245
Between the two PRs this changes how import/export works: