Skip to content

Commit 8be4bea

Browse files
committed
Sync: IDC: Swap DOMAIN_MAPPING constant check to SUNRISE_LOADED
In the WordPress MU Domain Mapping plugin, the DOMAIN_MAPPING constant is only set if we're actively mapping a domain. So, if thisdomain.com points to somesubsite.network.com. This led to the 3rd party domain mapping logic to fail for site where the admin was not using the mapped domain. The SUNRISE_LOADED constant is loaded on every request with the WordPress MU Domain Mapping plugin.
1 parent 7214ce7 commit 8be4bea

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

3rd-party/domain-mapping.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function attempt_to_hook_domain_mapping_plugins() {
5858
* @return bool
5959
*/
6060
function hook_wordpress_mu_domain_mapping() {
61-
if ( ! Jetpack_Constants::is_defined( 'DOMAIN_MAPPING' ) || ! $this->function_exists( 'domain_mapping_siteurl' ) ) {
61+
if ( ! Jetpack_Constants::is_defined( 'SUNRISE_LOADED' ) || ! $this->function_exists( 'domain_mapping_siteurl' ) ) {
6262
return false;
6363
}
6464

tests/php/3rd-party/test_class.jetpack-domain-mapping.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function test_domain_mapping_should_stop_search_after_hooking_once() {
5555
}
5656

5757
function test_domain_mapping_mu_domain_mapping_not_hooked_when_function_not_exists() {
58-
Jetpack_Constants::set_constant( 'DOMAIN_MAPPING', true );
58+
Jetpack_Constants::set_constant( 'SUNRISE_LOADED', true );
5959

6060
$stub = $this->getMockBuilder( 'MockDomainMapping' )
6161
->setMethods( array( 'function_exists' ) )
@@ -74,7 +74,7 @@ function test_domain_mapping_mu_domain_mapping_not_hooked_when_function_not_exis
7474
}
7575

7676
function test_domain_mapping_mu_domain_mapping_hooked_when_function_exists() {
77-
Jetpack_Constants::set_constant( 'DOMAIN_MAPPING', true );
77+
Jetpack_Constants::set_constant( 'SUNRISE_LOADED', true );
7878

7979
$stub = $this->getMockBuilder( 'MockDomainMapping' )
8080
->setMethods( array( 'function_exists' ) )

0 commit comments

Comments
 (0)