Skip to content

Commit

Permalink
Merge pull request #1972 from Automattic/update/filter-jp-ssl-check-t…
Browse files Browse the repository at this point in the history
…ransient

Always filter the jetpack_https_test transient to 1
  • Loading branch information
pschoffer authored Feb 5, 2021
2 parents 5380781 + 1f49494 commit 74e12c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test-vip-jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,12 @@ public function test__jetpack_sync_modules__class_exists( $modules, $expected_mo

$this->assertEquals( $expected_modules, $actual_modules );
}

public function test__jetpack_https_test__transient_filter() {
$https_test = apply_filters( 'pre_transient_jetpack_https_test', null );
$https_test_message = apply_filters( 'pre_transient_jetpack_https_test_message', null );

$this->assertEquals( 1, $https_test, 'Value of the jetpack_https_test pre-transient filter is incorrect' );
$this->assertEquals( '', $https_test_message, 'Value of the jetpack_https_test_message pre-transient filter is incorrect' );
}
}
6 changes: 6 additions & 0 deletions vip-jetpack/vip-jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,9 @@ function vip_jetpack_admin_enqueue_scripts() {
// phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
return defined( 'VIP_DISABLE_JETPACK_SYNC_CHECKSUM' ) && VIP_DISABLE_JETPACK_SYNC_CHECKSUM ?: $value;
}, 10, 3 );

/**
* SSL is always supported on VIP, so avoid unnecessary checks
*/
add_filter( 'pre_transient_jetpack_https_test', function() { return 1; } ); // WP doesn't have __return_one (but it does have __return_zero)
add_filter( 'pre_transient_jetpack_https_test_message', '__return_empty_string' );

0 comments on commit 74e12c2

Please sign in to comment.