Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions sync/class.jetpack-sync-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ public static function get_hosting_provider() {
}
if ( defined( 'MM_BASE_DIR' ) ) {
return 'bh';
}
}
if ( defined( 'IS_PRESSABLE' ) ) {
return 'pressable';
}
}
if ( function_exists( 'is_wpe' ) || function_exists( 'is_wpe_snapshot' ) ) {
return 'wpe';
}
Expand Down Expand Up @@ -225,7 +225,9 @@ public static function get_raw_url( $option_name ) {
? 'WP_HOME'
: 'WP_SITEURL';

if ( Jetpack_Constants::is_defined( $constant ) ) {
// Since we disregard the constant for multisites in ms-default-filters.php,
// let's also use the db value if this is a multisite.
if ( ! is_multisite() && Jetpack_Constants::is_defined( $constant ) ) {
$value = Jetpack_Constants::get_constant( $constant );
} else {
// Let's get the option from the database so that we can bypass filters. This will help
Expand Down
19 changes: 12 additions & 7 deletions tests/php/sync/test_class.jetpack-sync-callables.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function test_sync_always_sync_changes_to_modules_right_away() {
Jetpack::update_active_modules( array( 'stats' ) );

$this->sender->do_sync();

$synced_value = $this->server_replica_storage->get_callable( 'active_modules' );
$this->assertEquals( array( 'stats' ), $synced_value );

Expand Down Expand Up @@ -394,7 +394,7 @@ function test_get_protocol_normalized_url_cleared_on_reset_data() {
}

function test_subdomain_switching_to_www_does_not_cause_sync() {
// a lot of sites accept www.domain.com or just domain.com, and we want to prevent lots of
// a lot of sites accept www.domain.com or just domain.com, and we want to prevent lots of
// switching back and forth, so we force the domain to be the one in the siteurl option
$this->setSyncClientDefaults();
delete_transient( Jetpack_Sync_Module_Callables::CALLABLES_AWAIT_TRANSIENT_NAME );
Expand Down Expand Up @@ -429,7 +429,7 @@ function test_only_syncs_if_is_admin_and_not_cron() {

$this->sender->do_sync();
$this->assertEquals( null, $this->server_replica_storage->get_callable( 'site_url' ) );

Jetpack_Sync_Settings::set_doing_cron( false );
$this->sender->do_sync();
$this->assertEquals( site_url(), $this->server_replica_storage->get_callable( 'site_url' ) );
Expand Down Expand Up @@ -481,7 +481,7 @@ function test_calling_taxonomies_do_not_modify_global() {
}

function test_sanitize_sync_taxonomies_method() {

$sanitized = Jetpack_Sync_Functions::sanitize_taxonomy( (object) array( 'meta_box_cb' => 'post_tags_meta_box' ) );
$this->assertEquals( $sanitized->meta_box_cb, 'post_tags_meta_box' );

Expand Down Expand Up @@ -513,8 +513,13 @@ function test_get_raw_url_by_constant_bypasses_filters() {
add_filter( 'option_home', array( $this, '__return_filtered_url' ) );
add_filter( 'option_siteurl', array( $this, '__return_filtered_url' ) );

$this->assertEquals( 'http://constanturl.com', Jetpack_Sync_Functions::get_raw_url( 'home' ) );
$this->assertEquals( 'http://constanturl.com', Jetpack_Sync_Functions::get_raw_url( 'siteurl' ) );
if ( is_multisite() ) {
$this->assertTrue( $this->__return_filtered_url() !== Jetpack_Sync_Functions::get_raw_url( 'home' ) );
$this->assertTrue( $this->__return_filtered_url() !== Jetpack_Sync_Functions::get_raw_url( 'siteurl' ) );
} else {
$this->assertEquals( 'http://constanturl.com', Jetpack_Sync_Functions::get_raw_url( 'home' ) );
$this->assertEquals( 'http://constanturl.com', Jetpack_Sync_Functions::get_raw_url( 'siteurl' ) );
}

remove_filter( 'option_home', array( $this, '__return_filtered_url' ) );
remove_filter( 'option_siteurl', array( $this, '__return_filtered_url' ) );
Expand Down Expand Up @@ -601,7 +606,7 @@ function test_plugin_action_links_get_synced() {
function __return_filtered_url() {
return 'http://filteredurl.com';
}

function add_www_subdomain_to_siteurl( $url ) {
$parsed_url = parse_url( $url );

Expand Down