Skip to content

feat: add addon sunrise file loader#958

Merged
superdav42 merged 1 commit intomainfrom
feature/addon-sunrise-loader
Apr 27, 2026
Merged

feat: add addon sunrise file loader#958
superdav42 merged 1 commit intomainfrom
feature/addon-sunrise-loader

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

Summary

Adds load_addon_sunrise_files() to Sunrise::init() that auto-discovers and loads sunrise.php files from Ultimate Multisite addon plugins.

Why

Addons like multi-tenancy need to run code at sunrise time (before ms-settings.php resolves the network) to override $current_site for customer networks. Previously this required manually editing the root sunrise.php, which Ultimate Multisite may overwrite on update.

How

  • New protected static function load_addon_sunrise_files() in Sunrise class
  • Scans WP_PLUGIN_DIR/ultimate-multisite-*/sunrise.php via glob()
  • Includes matches in alphabetical order after domain mapping, before ms_loaded
  • No-op when no addon sunrise files exist

Testing

  1. Install ultimate-multisite-multi-tenancy with its new sunrise.php
  2. Create a customer network with isolated DB
  3. Verify customer domain loads from customer DB (not host)
  4. Verify host domain still loads normally

aidevops.sh v3.13.1 plugin for OpenCode v1.3.17 with gemma4:e4b spent 7d and 43,427 tokens on this as a headless worker.

Adds load_addon_sunrise_files() to Sunrise::init() that scans for
plugins/ultimate-multisite-*/sunrise.php files and includes them
after domain mapping but before ms_loaded.

This allows addons (like multi-tenancy) to ship their own sunrise
code without modifying the root sunrise.php, which Ultimate Multisite
may overwrite on update.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

Warning

Rate limit exceeded

@superdav42 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 30 minutes and 3 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 91130ca1-99f5-4627-9e0f-ed5e28d7dcc9

📥 Commits

Reviewing files that changed from the base of the PR and between 9911f4b and 4cef9ba.

📒 Files selected for processing (1)
  • inc/class-sunrise.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/addon-sunrise-loader

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

@github-actions
Copy link
Copy Markdown

Performance Test Results

Performance test results for 9ebfd21 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: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 40 37.80 MB 881.00 ms (+53.50 ms / +6% ) 163.50 ms 1087.50 ms (+37.50 ms / +3% ) 2110.00 ms (+46.00 ms / +2% ) 2023.60 ms (+51.05 ms / +3% ) 87.50 ms (-5.30 ms / -6% )
1 56 49.03 MB 950.00 ms 149.00 ms 1100.50 ms 2110.00 ms 2024.35 ms 81.20 ms

@superdav42 superdav42 merged commit 89de9af into main Apr 27, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant