fix: support main site export imports#1540
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe PR lets the network Sites list export the main site, keeps promotion limited to subsites, includes the main site in bulk exports, and scopes import search-replace operations to tables detected in the imported SQL file. Tests cover the updated actions, bulk export, and SQL parsing. ChangesSite Export and Import Scoping
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/WP_Ultimo/Site_Exporter_Test.php (1)
239-246: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the repo’s
wu_create_*()fixture helper here.Line 241 bypasses the test-data setup convention by creating the subsite with the raw factory. Please switch this to the appropriate
wu_create_*()helper so the fixture matches the repository’s multisite test setup rules. As per coding guidelines,tests/**/*.php: "Usewu_create_*()helper functions to set up test data."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/WP_Ultimo/Site_Exporter_Test.php` around lines 239 - 246, The multisite test setup in test_wp_sites_row_actions_include_subsite_export_and_promotion is bypassing the repository’s fixture convention by using the raw blog factory. Replace the direct self::factory()->blog->create() call with the appropriate wu_create_*() helper used for creating subsites in tests, keeping the rest of the assertions in add_wp_sites_row_actions unchanged.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@inc/site-exporter/mu-migration/includes/commands/class-mu-migration-import.php`:
- Around line 824-839: The get_imported_table_names helper currently reads the
full SQL dump with file_get_contents(), which can exhaust memory on large
exports and also match table-like tokens inside INSERT data. Refactor
get_imported_table_names to scan the file stream incrementally, similar to
replace_db_prefix(), and extract table names only from statement starts using
the existing CREATE TABLE / INSERT INTO / LOCK TABLES patterns anchored near the
beginning of each statement. Keep the return shape the same and preserve
deduplication via array_unique.
---
Nitpick comments:
In `@tests/WP_Ultimo/Site_Exporter_Test.php`:
- Around line 239-246: The multisite test setup in
test_wp_sites_row_actions_include_subsite_export_and_promotion is bypassing the
repository’s fixture convention by using the raw blog factory. Replace the
direct self::factory()->blog->create() call with the appropriate wu_create_*()
helper used for creating subsites in tests, keeping the rest of the assertions
in add_wp_sites_row_actions unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 53c9d01f-6de2-47fa-8f3b-c15e1de82747
📒 Files selected for processing (3)
inc/site-exporter/class-site-exporter.phpinc/site-exporter/mu-migration/includes/commands/class-mu-migration-import.phptests/WP_Ultimo/Site_Exporter_Test.php
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
|
CLAIM_RELEASED reason=worker_complete runner=superdav42 ts=2026-06-25T17:15:35Z aidevops_version=3.22.1 opencode_version=1.17.9 |
Summary
Verification
aidevops.sh v3.22.1 plugin for OpenCode v1.17.9 with gpt-5.5 Merged via PR #1540 to main. |
Summary
Verification
vendor/bin/phpunit --filter 'Site_Exporter_Test|Site_Exporter_Round_Trip_Test|Site_Exporter_Import_Move_Test'vendor/bin/phpcs inc/site-exporter/class-site-exporter.php inc/site-exporter/mu-migration/includes/commands/class-mu-migration-import.php tests/WP_Ultimo/Site_Exporter_Test.phpvendor/bin/phpstan analyse inc/site-exporter/class-site-exporter.php inc/site-exporter/mu-migration/includes/commands/class-mu-migration-import.php tests/WP_Ultimo/Site_Exporter_Test.php/tmp/opencode/um-single-site-export.zip, imported into dev multisite as blog ID 60, and verifiedSingle Export Verificationpage/tmp/opencode/um-main-site-export.zip, reimported after scoped search-replace fix as blog ID 62, verifiedMain Site Export Verificationpage, and confirmed existing network site URLs stayed intactaidevops.sh v3.22.1 plugin for OpenCode v1.17.9 with gpt-5.5
Summary by CodeRabbit
New Features
Bug Fixes
Tests