-
Notifications
You must be signed in to change notification settings - Fork 797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync: IDC: Add get_raw_url method to Jetpack_Sync_Functions #5852
Conversation
In the latest commit, I've added a first pass at support for Donncha's and WPMU Dev's domain mapping plugins. But, it's untested at the moment. |
db62c72
to
3890883
Compare
cc @simonwheatley @joshbetz for some input on how this would work for VIP sites that use domain mapping. |
self::normalize_www_in_url( 'home', 'home_url' ) | ||
); | ||
if ( | ||
Jetpack_Constants::is_defined( 'JETPACK_SYNC_USE_RAW_URL' ) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any advantages if we flag this via Sync setting? so we can tweak it if needed via the sync settings endpoint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems like a good change. 👍
$value = Jetpack_Sync_Options::get_option( $option_name ); | ||
} | ||
|
||
if ( is_ssl() ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't checking for is_ssl going to cause issues? shouldn't we stick to what's on the option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it would cause issues since we have the ssl normalization logic now. But, if we stick with this raw approach, then I think we can get rid of the ssl normalization. So, I think I agree with you that we could probably get rid of this. 😉
Currently on VIP Go we change the domains for single sites by changing the Another domain mapping plugin to check out is https://github.com/humanmade/Mercator (note they're currently moving the UI and SSO into separate plugins: humanmade/Mercator#77 and humanmade/Mercator#79). |
Thanks for the input. 🙇
This being the case, using this raw approach (and not applying filters) should work fine then. We should probably test on a test VIP GO site before 4.6 though, just to make sure.
@kraftbj had mentioned that one to me, and it was on my radar as an option. I think once we get this in, it should be fairly easy to roll in support for Mercator and perhaps one or two others that we decide to fully support. |
46386fc
to
52c02a6
Compare
I just rebased against master to clear out the merge conflict. |
I pushed a commit so that we begin syncing the raw URL by default. Users should be able to opt-out of this by |
3e30cce
to
64d93f9
Compare
2c0a78e
to
e54dbeb
Compare
8a19915
to
af86a56
Compare
a2dff44
to
1824c78
Compare
This PR is testing a lot better now. I've tested the following scenarios:
We still need to test the case of cloning a site from A to B, production to localhost for example, and we should test against WPMU dev's plugin again since it's been several months since we last tested. @lezama @roccotripaldi @dereksmart - can I get your help with this at the beginning of this next week? There are 2-3 open issues that should benefit from this? |
'home_url', | ||
self::normalize_www_in_url( 'home', 'home_url' ) | ||
); | ||
$url = self::get_raw_or_filtered_url( 'home', 'home_url' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could pass the constant name here and simplify get_raw_url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested yet, but the code looks great.
$hooked = call_user_func( array( $this, self::$test_methods[ $i ] ) ); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool!
Latest commit makes a couple of changes to the IDC logic uses the same URLs that are sent in sync. |
1e4a204
to
f798850
Compare
@@ -145,7 +145,7 @@ public function maybe_sync_callables() { | |||
return; | |||
} | |||
|
|||
$callable_checksums = (array) get_option( self::CALLABLES_CHECKSUM_OPTION_NAME, array() ); | |||
$callable_checksums = (array) Jetpack_Options::get_raw_option( self::CALLABLES_CHECKSUM_OPTION_NAME, array() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this causing some misbehaviours?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From memory, I noticed that the callables weren't syncing as often as I expected them to. Once I made this change, it cleared up.
3166c36
to
1e4a204
Compare
I think it's safe enough to merge, let's keep an eye on all the IDC/Sync things while in beta 😱 |
For sites that use domain mapping and multi language, it can be quite hard to sync uniform URLs back to WP.com, which can cause the site to be put in IDC.
To address this, I'd like to start syncing the unfiltered values for
home
andsiteurl
. This will introduced some jankiness where we sync the non-mapped domain for domain mapped sites. But, we can then address that by adding support for the top multi language and domain mapping plugins.I've added support for Donncha's and WPMU Dev's domain mapping plugins. But, it's untested at the moment.
To test:
Note: it could take several minutes the URLs to be synced each time you change.