Skip to content

fix: purge Divi uploads cache on clone#1403

Merged
superdav42 merged 1 commit into
mainfrom
fix/divi-cache-refresh
Jun 11, 2026
Merged

fix: purge Divi uploads cache on clone#1403
superdav42 merged 1 commit into
mainfrom
fix/divi-cache-refresh

Conversation

@superdav42

@superdav42 superdav42 commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Extend Divi clone cache purge to include Divi's uploads-directory fallback cache root (wp_upload_dir()['basedir']/et-cache).
  • Keep the existing standard wp-content/et-cache/{network_id}/{blog_id} and legacy wp-content/et-cache/{blog_id} purge paths.
  • Preserve safety checks by validating each candidate directory against its own cache root before recursive deletion.
  • Add a multisite regression test proving only the cloned site's uploads fallback cache is removed.

Verification

  • vendor/bin/phpunit --filter General_Compat_Test — OK, 4 tests / 7 assertions.
  • vendor/bin/phpcs inc/compat/class-general-compat.php tests/WP_Ultimo/General_Compat_Test.php — OK.
  • vendor/bin/phpstan analyse inc/compat/class-general-compat.php tests/WP_Ultimo/General_Compat_Test.php — OK.
  • Local reproduction with customer-provided /home/dave/Divi.zip (Divi 4.27.6): created Divi template site, cloned via Site_Duplicator::duplicate_site(), verified cloned page regenerates the required .et_pb_section_0 / .et_pb_image_0 CSS rules.
  • Direct hook simulation: pre-created stale files in both wp-content/et-cache/1/{blog_id} and uploads/sites/{blog_id}/et-cache; do_action('wu_duplicate_site', ['from_site_id' => 58, 'site_id' => 60]) removed both cloned-site cache directories.

aidevops.sh v3.20.53 plugin for OpenCode v1.17.3 with gpt-5.5

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved Divi static CSS cache clearing in multisite environments to properly isolate cache deletion to the target site and prevent cross-site conflicts
    • Enhanced cache directory detection to support multiple storage locations, including uploads directory fallback when standard cache locations are not writable

@superdav42 superdav42 added origin:interactive Created by interactive user session status:in-review PR open, awaiting review/merge labels Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 48b651b8-071f-4c5c-87c3-98ab38e74a68

📥 Commits

Reviewing files that changed from the base of the PR and between d58b751 and adcf908.

📒 Files selected for processing (2)
  • inc/compat/class-general-compat.php
  • tests/WP_Ultimo/General_Compat_Test.php

📝 Walkthrough

Walkthrough

This PR enhances Divi static CSS cache clearing to discover and delete caches across multiple locations (network-scoped paths, legacy paths, and uploads-based fallbacks) while maintaining per-site isolation. The core methods now exchange structured location data and use explicit safety roots, validated by a new multisite test.

Changes

Divi Cache Purge Improvements

Layer / File(s) Summary
Cache discovery and deletion infrastructure
inc/compat/class-general-compat.php
Cache directory discovery returns structured {root, dir} pairs for network-scoped (WP_CONTENT_DIR/et-cache/{network_id}/{blog_id}), legacy (WP_CONTENT_DIR/et-cache/{blog_id}), and uploads-based (wp_upload_dir()['basedir']/et-cache) paths with deduplication. Deletion method signature updated to accept explicit $cache_root parameter for safety-constrained operations.
Cache clearing orchestration
inc/compat/class-general-compat.php
Clear method updated to loop over structured cache entries with both dir and root values, passing both to the deletion helper.
Multisite isolation test
tests/WP_Ultimo/General_Compat_Test.php
New test verifies uploads-based et-cache deletion is scoped to the specified site only, not affecting other sites in the network.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

review-feedback-scanned, status:in-review, origin:interactive

Poem

🐰 A rabbit hops through cache paths deep,
Where Divi's secrets safely sleep.
Networks nested, uploads found—
Each site's own cache, tight and sound!
et-cache blooms in roots anew,
Multisite magic, clean and true! 🌱

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: purge Divi uploads cache on clone' directly summarizes the main change: extending Divi cache purge to include the uploads-directory fallback cache root when cloning a site.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/divi-cache-refresh

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

🔨 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!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42 superdav42 merged commit 1d52b3c into main Jun 11, 2026
11 checks passed
@superdav42 superdav42 added the review-feedback-scanned Merged PR already scanned for quality feedback label Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

origin:interactive Created by interactive user session review-feedback-scanned Merged PR already scanned for quality feedback status:in-review PR open, awaiting review/merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant