vip-go-mu-plugins
vip-go-mu-plugins copied to clipboard
Force all VIP sites to use local domain for Photon
The VIP File Service has Photon capabilities, but is served from the same domain. If the Photon module is enabled, force Jetpack to use the files service instead of the default Photon domains (i*.wp.com) for internal files.
Externally hosted files continue to use the remote Photon service.
Previously, this was only enabled if you had the WPCOM_VIP_USE_JETPACK_PHOTON constant enabled. This enables it for all since we want this behaviour everywhere. We also don't need to wait until #1012 is deployed.
Fixes #1274
Checklist
Please make sure the items below have been covered before requesting a review:
- [ ] This change works and has been tested locally (or has an appropriate fallback).
- [ ] This change works and has been tested on a Go sandbox.
- n/a This change has relevant unit tests (if applicable).
- [ ] This change has relevant documentation additions / updates (if applicable).
Steps to Test
- Check out PR.
- Enable Photon module (
wp jetpack module enable photon) - Ensure
WPCOM_VIP_USE_JETPACK_PHOTONconstant isn't set. - Load a post with a local image and an externally hosted image.
- Verify that the local image is loaded from the site itself and external image from the
i*.wp.comdomain.
Then, enable the WPCOM_VIP_USE_JETPACK_PHOTON constant and verify that the behaviour doesn't change.
Then, retest with the Photon module disabled and verify that all images load from their respective domains.
@mjangda - does it get confusing that A8c_Files::use_jetpack_photon() can return true but the image domain is still the site's domain (not i*.wp.com)?
Hi @mjangda / @nickdaugherty .
Is this still a wanted change?
If so could you please point me to a good direction on how to test this? I tried on my vip go site to setup post with a local image and remote image - https://pschoffer-develop.go-vip.net/2021/08/09/testing-photon/. None of them are sourced from i*.wp.com with or without this change.
But, I guess I am missing a key understanding of what the photon service is :) I did look up that it is part of JP accelerator, but I failed to find the switch to enable it as described in the linked doc.
This is how my JP settings page looks like:

CC @itsTallulah, thought you might have thoughts here :)
Kudos, SonarCloud Quality Gate passed! 
0 Bugs
0 Vulnerabilities
0 Security Hotspots
0 Code Smells
No Coverage information
0.0% Duplication
Codecov Report
Merging #1276 (22a34b1) into develop (2c5d9e7) will not change coverage. The diff coverage is
0.00%.
@@ Coverage Diff @@
## develop #1276 +/- ##
==========================================
Coverage 34.19% 34.19%
Complexity 3554 3554
==========================================
Files 215 215
Lines 13755 13755
==========================================
Hits 4703 4703
Misses 9052 9052
| Impacted Files | Coverage Δ | |
|---|---|---|
| a8c-files.php | 18.40% <0.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
This pull request has been marked stale because it has been open for 60 days with no activity. If there is no activity within 7 days, it will be closed.
This is an automation to keep pull requests manageable and actionable and is not a comment on the quality of this pull request nor on the work done so far. Closed PRs are still valuable to the project and their branches are preserved.
This pull request has been marked stale because it has been open for 60 days with no activity. If there is no activity within 7 days, it will be closed.
This is an automation to keep pull requests manageable and actionable and is not a comment on the quality of this pull request nor on the work done so far. Closed PRs are still valuable to the project and their branches are preserved.