Skip to content

Commit

Permalink
Merge pull request #1665 from WordPress/release/3.6.0
Browse files Browse the repository at this point in the history
Merge 3.6.0 release back into `trunk`
  • Loading branch information
felixarntz authored Nov 18, 2024
2 parents 04a2e5a + 7cc9c76 commit 7695b72
Show file tree
Hide file tree
Showing 20 changed files with 99 additions and 70 deletions.
6 changes: 0 additions & 6 deletions plugins/embed-optimizer/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu

== Changelog ==

= n.e.x.t =

**Enhancements**

* Serve unminified scripts when `SCRIPT_DEBUG` is enabled. ([1643](https://github.com/WordPress/performance/pull/1643))

= 0.3.0 =

**Enhancements**
Expand Down
6 changes: 0 additions & 6 deletions plugins/image-prioritizer/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu

== Changelog ==

= n.e.x.t =

**Enhancements**

* Serve unminified scripts when `SCRIPT_DEBUG` is enabled. ([1643](https://github.com/WordPress/performance/pull/1643))

= 0.2.0 =

**Enhancements**
Expand Down
2 changes: 1 addition & 1 deletion plugins/optimization-detective/detection.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* a post available for cache purging. As seen in {@see od_can_optimize_response()}, when such a post ID is not
* available for cache purging then it returns false, as it also does in another case like if is_404().
*
* @since n.e.x.t
* @since 0.8.0
* @access private
*
* @return int|null Post ID or null if none found.
Expand Down
4 changes: 2 additions & 2 deletions plugins/optimization-detective/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Provides an API for leveraging real user metrics to detect optimizations to apply on the frontend to improve page performance.
* Requires at least: 6.5
* Requires PHP: 7.2
* Version: 0.7.0
* Version: 0.8.0
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* License: GPLv2 or later
Expand Down Expand Up @@ -70,7 +70,7 @@ static function ( string $global_var_name, string $version, Closure $load ): voi
}
)(
'optimization_detective_pending_plugin',
'0.7.0',
'0.8.0',
static function ( string $version ): void {
if ( defined( 'OPTIMIZATION_DETECTIVE_VERSION' ) ) {
return;
Expand Down
2 changes: 1 addition & 1 deletion plugins/optimization-detective/optimization.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function od_can_optimize_response(): bool {
current_user_can( 'customize' ) ||
// Page caching plugins can only reliably be told to invalidate a cached page when a post is available to trigger
// the relevant actions on.
null !== od_get_cache_purge_post_id()
null === od_get_cache_purge_post_id()
);

/**
Expand Down
12 changes: 10 additions & 2 deletions plugins/optimization-detective/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributors: wordpressdotorg
Tested up to: 6.7
Stable tag: 0.7.0
Stable tag: 0.8.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: performance, optimization, rum
Expand Down Expand Up @@ -265,11 +265,19 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu

== Changelog ==

= n.e.x.t =
= 0.8.0 =

**Enhancements**

* Serve unminified scripts when `SCRIPT_DEBUG` is enabled. ([1643](https://github.com/WordPress/performance/pull/1643))
* Bump web-vitals from 4.2.3 to 4.2.4. ([1628](https://github.com/WordPress/performance/pull/1628))

**Bug Fixes**

* Eliminate the detection time window which prevented URL Metrics from being gathered when page caching is present. ([1640](https://github.com/WordPress/performance/pull/1640))
* Revise the use of nonces in requests to store a URL Metric and block cross-origin requests. ([1637](https://github.com/WordPress/performance/pull/1637))
* Send post ID of queried object or first post in loop in URL Metric storage request to schedule page cache validation. ([1641](https://github.com/WordPress/performance/pull/1641))
* Fix phpstan errors. ([1627](https://github.com/WordPress/performance/pull/1627))

= 0.7.0 =

Expand Down
4 changes: 2 additions & 2 deletions plugins/optimization-detective/storage/data.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function od_get_url_metrics_slug( array $query_vars ): string {
*
* This is used in the REST API to authenticate the storage of new URL Metrics from a given URL.
*
* @since n.e.x.t
* @since 0.8.0
* @access private
*
* @see od_verify_url_metrics_storage_hmac()
Expand All @@ -165,7 +165,7 @@ function od_get_url_metrics_storage_hmac( string $slug, string $url, ?int $cache
/**
* Verifies HMAC for storing URL Metrics for a specific slug.
*
* @since n.e.x.t
* @since 0.8.0
* @access private
*
* @see od_get_url_metrics_storage_hmac()
Expand Down
4 changes: 2 additions & 2 deletions plugins/optimization-detective/storage/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function od_register_endpoint(): void {
* not account for the URL port (although there is a to-do comment committed in core to address this). Additionally,
* the `is_allowed_http_origin()` function in core for some reason returns a string rather than a boolean.
*
* @since n.e.x.t
* @since 0.8.0
* @access private
*
* @see is_allowed_http_origin()
Expand Down Expand Up @@ -249,7 +249,7 @@ function od_handle_rest_request( WP_REST_Request $request ) {
* This is intended to flush any page cache for the URL after the new URL Metric was submitted so that the optimizations
* which depend on that URL Metric can start to take effect.
*
* @since n.e.x.t
* @since 0.8.0
* @access private
*
* @param int $cache_purge_post_id Cache purge post ID.
Expand Down
31 changes: 24 additions & 7 deletions plugins/optimization-detective/tests/test-optimization.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,27 +185,35 @@ public function test_od_maybe_add_template_output_buffer_filter_with_query_var_t
*/
public function data_provider_test_od_can_optimize_response(): array {
return array(
'homepage' => array(
'home_as_anonymous' => array(
'set_up' => function (): void {
$this->go_to( home_url( '/' ) );
},
'expected' => true,
),
'homepage_filtered' => array(
'home_filtered_as_anonymous' => array(
'set_up' => function (): void {
$this->go_to( home_url( '/' ) );
add_filter( 'od_can_optimize_response', '__return_false' );
},
'expected' => false,
),
'search' => array(
'singular_as_anonymous' => array(
'set_up' => function (): void {
$posts = get_posts();
$this->assertInstanceOf( WP_Post::class, $posts[0] );
$this->go_to( get_permalink( $posts[0] ) );
},
'expected' => true,
),
'search_as_anonymous' => array(
'set_up' => function (): void {
self::factory()->post->create( array( 'post_title' => 'Hello' ) );
$this->go_to( home_url( '?s=Hello' ) );
},
'expected' => false,
),
'customizer_preview' => array(
'home_customizer_preview_as_anonymous' => array(
'set_up' => function (): void {
$this->go_to( home_url( '/' ) );
global $wp_customize;
Expand All @@ -215,21 +223,28 @@ public function data_provider_test_od_can_optimize_response(): array {
},
'expected' => false,
),
'post_request' => array(
'home_post_request_as_anonymous' => array(
'set_up' => function (): void {
$this->go_to( home_url( '/' ) );
$_SERVER['REQUEST_METHOD'] = 'POST';
},
'expected' => false,
),
'subscriber_user' => array(
'home_as_subscriber' => array(
'set_up' => function (): void {
wp_set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) );
$this->go_to( home_url( '/' ) );
},
'expected' => true,
),
'admin_user' => array(
'empty_author_page_as_anonymous' => array(
'set_up' => function (): void {
$user_id = self::factory()->user->create( array( 'role' => 'author' ) );
$this->go_to( get_author_posts_url( $user_id ) );
},
'expected' => false,
),
'home_as_admin' => array(
'set_up' => function (): void {
wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
$this->go_to( home_url( '/' ) );
Expand All @@ -243,10 +258,12 @@ public function data_provider_test_od_can_optimize_response(): array {
* Test od_can_optimize_response().
*
* @covers ::od_can_optimize_response
* @covers ::od_get_cache_purge_post_id
*
* @dataProvider data_provider_test_od_can_optimize_response
*/
public function test_od_can_optimize_response( Closure $set_up, bool $expected ): void {
self::factory()->post->create(); // Make sure there is at least one post in the DB.
$set_up();
$this->assertSame( $expected, od_can_optimize_response() );
}
Expand Down
16 changes: 8 additions & 8 deletions plugins/performance-lab/includes/admin/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* REST API integration for the plugin.
*
* @package performance-lab
* @since n.e.x.t
* @since 3.6.0
*/

if ( ! defined( 'ABSPATH' ) ) {
Expand All @@ -13,7 +13,7 @@
/**
* Namespace for performance-lab REST API.
*
* @since n.e.x.t
* @since 3.6.0
* @var string
*/
const PERFLAB_REST_API_NAMESPACE = 'performance-lab/v1';
Expand All @@ -24,7 +24,7 @@
* Note the `:activate` art of the endpoint follows Google's guidance in AIP-136 for the use of the POST method in a way
* that does not strictly follow the standard usage.
*
* @since n.e.x.t
* @since 3.6.0
* @link https://google.aip.dev/136
* @var string
*/
Expand All @@ -33,15 +33,15 @@
/**
* Route for fetching plugin/feature information.
*
* @since n.e.x.t
* @since 3.6.0
* @var string
*/
const PERFLAB_FEATURES_INFORMATION_ROUTE = '/features/(?P<slug>[a-z0-9_-]+)';

/**
* Registers endpoint for performance-lab REST API.
*
* @since n.e.x.t
* @since 3.6.0
* @access private
*/
function perflab_register_endpoint(): void {
Expand Down Expand Up @@ -102,7 +102,7 @@ function perflab_register_endpoint(): void {
* Note that an enum is not being used because additional PHP files have to be required to access the necessary functions,
* and this would not be ideal to do at rest_api_init.
*
* @since n.e.x.t
* @since 3.6.0
* @access private
*
* @param string $slug Plugin slug.
Expand All @@ -118,7 +118,7 @@ function perflab_validate_slug_endpoint_arg( string $slug ): bool {
/**
* Handles REST API request to activate plugin/feature.
*
* @since n.e.x.t
* @since 3.6.0
* @access private
*
* @phpstan-param WP_REST_Request<array<string, mixed>> $request
Expand Down Expand Up @@ -163,7 +163,7 @@ function perflab_handle_feature_activation( WP_REST_Request $request ) {
/**
* Handles REST API request to get plugin/feature information.
*
* @since n.e.x.t
* @since 3.6.0
* @access private
*
* @phpstan-param WP_REST_Request<array<string, mixed>> $request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Helper function to detect and test AVIF header information.
*
* @package performance-lab
* @since n.e.x.t
* @since 3.6.0
*/

if ( ! defined( 'ABSPATH' ) ) {
Expand All @@ -13,7 +13,7 @@
/**
* Callback for avif_headers test.
*
* @since n.e.x.t
* @since 3.6.0
*
* @return array{label: string, status: string, badge: array{label: string, color: string}, description: string, actions: string, test: string} Result.
*/
Expand Down Expand Up @@ -57,7 +57,7 @@ function avif_headers_check_avif_headers_test(): array {
/**
* Checks if AVIF headers are enabled.
*
* @since n.e.x.t
* @since 3.6.0
*
* @return bool True if AVIF headers are enabled, false otherwise.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Hook callbacks used for AVIF Headers.
*
* @package performance-lab
* @since n.e.x.t
* @since 3.6.0
*/

if ( ! defined( 'ABSPATH' ) ) {
Expand All @@ -13,7 +13,7 @@
/**
* Adds tests to site health.
*
* @since n.e.x.t
* @since 3.6.0
*
* @param array{direct: array<string, array{label: string, test: string}>} $tests Site Health Tests.
* @return array{direct: array<string, array{label: string, test: string}>} Amended tests.
Expand Down
4 changes: 2 additions & 2 deletions plugins/performance-lab/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Performance plugin from the WordPress Performance Team, which is a collection of standalone performance features.
* Requires at least: 6.5
* Requires PHP: 7.2
* Version: 3.5.1
* Version: 3.6.0
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* License: GPLv2 or later
Expand All @@ -19,7 +19,7 @@
exit; // Exit if accessed directly.
}

define( 'PERFLAB_VERSION', '3.5.1' );
define( 'PERFLAB_VERSION', '3.6.0' );
define( 'PERFLAB_MAIN_FILE', __FILE__ );
define( 'PERFLAB_PLUGIN_DIR_PATH', plugin_dir_path( PERFLAB_MAIN_FILE ) );
define( 'PERFLAB_SCREEN', 'performance-lab' );
Expand Down
14 changes: 13 additions & 1 deletion plugins/performance-lab/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributors: wordpressdotorg
Tested up to: 6.7
Stable tag: 3.5.1
Stable tag: 3.6.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: performance, site health, measurement, optimization, diagnostics
Expand Down Expand Up @@ -71,6 +71,18 @@ Contributions are always welcome! Learn more about how to get involved in the [C

== Changelog ==

= 3.6.0 =

**Enhancements**

* Use AJAX for activating features / plugins in Performance Lab. ([1646](https://github.com/WordPress/performance/pull/1646))
* Introduce AVIF header health check. ([1612](https://github.com/WordPress/performance/pull/1612))
* Install and activate Optimization Detective when the Embed Optimizer feature is activated from the Performance screen. ([1644](https://github.com/WordPress/performance/pull/1644))

**Bug Fixes**

* Fix uses of 'Plugin not found' string. ([1651](https://github.com/WordPress/performance/pull/1651))

= 3.5.1 =

**Bug Fixes**
Expand Down
6 changes: 0 additions & 6 deletions plugins/web-worker-offloading/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu

== Changelog ==

= n.e.x.t =

**Enhancements**

* Serve unminified scripts when `SCRIPT_DEBUG` is enabled. ([1643](https://github.com/WordPress/performance/pull/1643))

= 0.1.1 =

**Enhancements**
Expand Down
Loading

0 comments on commit 7695b72

Please sign in to comment.