GH#834: fix site-duplicator review-bot findings from PR #825#850
GH#834: fix site-duplicator review-bot findings from PR #825#850superdav42 merged 1 commit intomainfrom
Conversation
Completion Summary
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 44 minutes and 19 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 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 |
- Replace in-place mutation of $args->from_site_id with a separate $template_site_id variable so copy_users() and any other downstream consumers retain a consistent source reference after copy_data() has already run with the original site ID. - Add rewrite_backfilled_postmeta_urls() that applies the same source→target URL replacement MUCD's db_update_data() does, but scoped to the postmeta table. backfill_postmeta() inserts rows after MUCD's rewrite pass; without this step, _menu_item_url custom links and _elementor_* JSON would retain template-site domains. - Tighten test_wu_duplicate_site_action_includes_from_site_id: fail explicitly with the WP_Error message instead of silently skipping all assertions when duplicate_site() returns an error. Resolves #834
1bf6db3 to
e067cf7
Compare
🔨 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: |
🔨 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: |
|
Performance Test Results Performance test results for 447a66f are in 🛎️! Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown. URL:
|
Summary
Address three unresolved CodeRabbit findings from PR #825.
Fix 1 — Don't mutate
$args->from_site_idaftercopy_data()copy_data()andcopy_files()had already run with the original$args->from_site_idwhen thewu_template_idmeta override was applied. Overwriting the property in place meantcopy_users()and any downstream consumers operated on a different source site than the data that was actually cloned, creating an inconsistent clone. The resolved template ID is now kept in a separate$template_site_idvariable used only for the post-copy backfill, kit-integrity check, andwu_duplicate_siteaction payload.Fix 2 — Apply URL rewrite to backfilled postmeta rows
backfill_postmeta()inserts rows afterMUCD_Data::copy_data()has completed itsdb_update_data()pass. Those backfilled rows therefore contain raw template-site URLs (e.g._menu_item_urlcustom links,_elementor_*JSON blobs). A newrewrite_backfilled_postmeta_urls()method mirrors MUCD's two-pass approach (plain URL and JSON-escaped\/variant) on the target's postmeta table, correcting those references. The method is safe to call after MUCD's own rewrite because already-rewritten rows no longer contain the source URL, makingREPLACE()a no-op for them.Fix 3 — Tighten
test_wu_duplicate_site_action_includes_from_site_idThe
if ( ! is_wp_error($result))guard caused the test to silently pass (skipping every assertion about thewu_duplicate_siteaction payload) wheneverduplicate_site()returned aWP_Error. Replaced with an explicit$this->fail()call that surfaces the error message.Files Changed
EDIT: inc/helpers/class-site-duplicator.php— Fix 1 + Fix 2 + newrewrite_backfilled_postmeta_urls()methodEDIT: tests/WP_Ultimo/Helpers/Site_Duplicator_Test.php— Fix 3Runtime Testing
PHPStan level 0: clean (
No errors). PHP syntax: clean. PHPCS: project configuration has pre-existing unresolved sniff-name errors that prevent the full WP ruleset from running — not introduced by this PR.Resolves #834
aidevops.sh v3.8.24 plugin for OpenCode v1.4.3 with claude-sonnet-4-6 spent 7m and 25,232 tokens on this as a headless worker.