Skip to content

Commit 7695b72

Browse files
authored
Merge pull request #1665 from WordPress/release/3.6.0
Merge 3.6.0 release back into `trunk`
2 parents 04a2e5a + 7cc9c76 commit 7695b72

File tree

20 files changed

+99
-70
lines changed

20 files changed

+99
-70
lines changed

plugins/embed-optimizer/readme.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu
6767

6868
== Changelog ==
6969

70-
= n.e.x.t =
71-
72-
**Enhancements**
73-
74-
* Serve unminified scripts when `SCRIPT_DEBUG` is enabled. ([1643](https://github.com/WordPress/performance/pull/1643))
75-
7670
= 0.3.0 =
7771

7872
**Enhancements**

plugins/image-prioritizer/readme.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ The [plugin source code](https://github.com/WordPress/performance/tree/trunk/plu
6262

6363
== Changelog ==
6464

65-
= n.e.x.t =
66-
67-
**Enhancements**
68-
69-
* Serve unminified scripts when `SCRIPT_DEBUG` is enabled. ([1643](https://github.com/WordPress/performance/pull/1643))
70-
7165
= 0.2.0 =
7266

7367
**Enhancements**

plugins/optimization-detective/detection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* a post available for cache purging. As seen in {@see od_can_optimize_response()}, when such a post ID is not
3232
* available for cache purging then it returns false, as it also does in another case like if is_404().
3333
*
34-
* @since n.e.x.t
34+
* @since 0.8.0
3535
* @access private
3636
*
3737
* @return int|null Post ID or null if none found.

plugins/optimization-detective/load.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: Provides an API for leveraging real user metrics to detect optimizations to apply on the frontend to improve page performance.
66
* Requires at least: 6.5
77
* Requires PHP: 7.2
8-
* Version: 0.7.0
8+
* Version: 0.8.0
99
* Author: WordPress Performance Team
1010
* Author URI: https://make.wordpress.org/performance/
1111
* License: GPLv2 or later
@@ -70,7 +70,7 @@ static function ( string $global_var_name, string $version, Closure $load ): voi
7070
}
7171
)(
7272
'optimization_detective_pending_plugin',
73-
'0.7.0',
73+
'0.8.0',
7474
static function ( string $version ): void {
7575
if ( defined( 'OPTIMIZATION_DETECTIVE_VERSION' ) ) {
7676
return;

plugins/optimization-detective/optimization.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function od_can_optimize_response(): bool {
123123
current_user_can( 'customize' ) ||
124124
// Page caching plugins can only reliably be told to invalidate a cached page when a post is available to trigger
125125
// the relevant actions on.
126-
null !== od_get_cache_purge_post_id()
126+
null === od_get_cache_purge_post_id()
127127
);
128128

129129
/**

plugins/optimization-detective/readme.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

266266
== Changelog ==
267267

268-
= n.e.x.t =
268+
= 0.8.0 =
269269

270270
**Enhancements**
271271

272272
* Serve unminified scripts when `SCRIPT_DEBUG` is enabled. ([1643](https://github.com/WordPress/performance/pull/1643))
273+
* Bump web-vitals from 4.2.3 to 4.2.4. ([1628](https://github.com/WordPress/performance/pull/1628))
274+
275+
**Bug Fixes**
276+
277+
* 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))
278+
* 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))
279+
* 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))
280+
* Fix phpstan errors. ([1627](https://github.com/WordPress/performance/pull/1627))
273281

274282
= 0.7.0 =
275283

plugins/optimization-detective/storage/data.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function od_get_url_metrics_slug( array $query_vars ): string {
145145
*
146146
* This is used in the REST API to authenticate the storage of new URL Metrics from a given URL.
147147
*
148-
* @since n.e.x.t
148+
* @since 0.8.0
149149
* @access private
150150
*
151151
* @see od_verify_url_metrics_storage_hmac()
@@ -165,7 +165,7 @@ function od_get_url_metrics_storage_hmac( string $slug, string $url, ?int $cache
165165
/**
166166
* Verifies HMAC for storing URL Metrics for a specific slug.
167167
*
168-
* @since n.e.x.t
168+
* @since 0.8.0
169169
* @access private
170170
*
171171
* @see od_get_url_metrics_storage_hmac()

plugins/optimization-detective/storage/rest-api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function od_register_endpoint(): void {
101101
* not account for the URL port (although there is a to-do comment committed in core to address this). Additionally,
102102
* the `is_allowed_http_origin()` function in core for some reason returns a string rather than a boolean.
103103
*
104-
* @since n.e.x.t
104+
* @since 0.8.0
105105
* @access private
106106
*
107107
* @see is_allowed_http_origin()
@@ -249,7 +249,7 @@ function od_handle_rest_request( WP_REST_Request $request ) {
249249
* This is intended to flush any page cache for the URL after the new URL Metric was submitted so that the optimizations
250250
* which depend on that URL Metric can start to take effect.
251251
*
252-
* @since n.e.x.t
252+
* @since 0.8.0
253253
* @access private
254254
*
255255
* @param int $cache_purge_post_id Cache purge post ID.

plugins/optimization-detective/tests/test-optimization.php

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,27 +185,35 @@ public function test_od_maybe_add_template_output_buffer_filter_with_query_var_t
185185
*/
186186
public function data_provider_test_od_can_optimize_response(): array {
187187
return array(
188-
'homepage' => array(
188+
'home_as_anonymous' => array(
189189
'set_up' => function (): void {
190190
$this->go_to( home_url( '/' ) );
191191
},
192192
'expected' => true,
193193
),
194-
'homepage_filtered' => array(
194+
'home_filtered_as_anonymous' => array(
195195
'set_up' => function (): void {
196196
$this->go_to( home_url( '/' ) );
197197
add_filter( 'od_can_optimize_response', '__return_false' );
198198
},
199199
'expected' => false,
200200
),
201-
'search' => array(
201+
'singular_as_anonymous' => array(
202+
'set_up' => function (): void {
203+
$posts = get_posts();
204+
$this->assertInstanceOf( WP_Post::class, $posts[0] );
205+
$this->go_to( get_permalink( $posts[0] ) );
206+
},
207+
'expected' => true,
208+
),
209+
'search_as_anonymous' => array(
202210
'set_up' => function (): void {
203211
self::factory()->post->create( array( 'post_title' => 'Hello' ) );
204212
$this->go_to( home_url( '?s=Hello' ) );
205213
},
206214
'expected' => false,
207215
),
208-
'customizer_preview' => array(
216+
'home_customizer_preview_as_anonymous' => array(
209217
'set_up' => function (): void {
210218
$this->go_to( home_url( '/' ) );
211219
global $wp_customize;
@@ -215,21 +223,28 @@ public function data_provider_test_od_can_optimize_response(): array {
215223
},
216224
'expected' => false,
217225
),
218-
'post_request' => array(
226+
'home_post_request_as_anonymous' => array(
219227
'set_up' => function (): void {
220228
$this->go_to( home_url( '/' ) );
221229
$_SERVER['REQUEST_METHOD'] = 'POST';
222230
},
223231
'expected' => false,
224232
),
225-
'subscriber_user' => array(
233+
'home_as_subscriber' => array(
226234
'set_up' => function (): void {
227235
wp_set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) );
228236
$this->go_to( home_url( '/' ) );
229237
},
230238
'expected' => true,
231239
),
232-
'admin_user' => array(
240+
'empty_author_page_as_anonymous' => array(
241+
'set_up' => function (): void {
242+
$user_id = self::factory()->user->create( array( 'role' => 'author' ) );
243+
$this->go_to( get_author_posts_url( $user_id ) );
244+
},
245+
'expected' => false,
246+
),
247+
'home_as_admin' => array(
233248
'set_up' => function (): void {
234249
wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
235250
$this->go_to( home_url( '/' ) );
@@ -243,10 +258,12 @@ public function data_provider_test_od_can_optimize_response(): array {
243258
* Test od_can_optimize_response().
244259
*
245260
* @covers ::od_can_optimize_response
261+
* @covers ::od_get_cache_purge_post_id
246262
*
247263
* @dataProvider data_provider_test_od_can_optimize_response
248264
*/
249265
public function test_od_can_optimize_response( Closure $set_up, bool $expected ): void {
266+
self::factory()->post->create(); // Make sure there is at least one post in the DB.
250267
$set_up();
251268
$this->assertSame( $expected, od_can_optimize_response() );
252269
}

plugins/performance-lab/includes/admin/rest-api.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* REST API integration for the plugin.
44
*
55
* @package performance-lab
6-
* @since n.e.x.t
6+
* @since 3.6.0
77
*/
88

99
if ( ! defined( 'ABSPATH' ) ) {
@@ -13,7 +13,7 @@
1313
/**
1414
* Namespace for performance-lab REST API.
1515
*
16-
* @since n.e.x.t
16+
* @since 3.6.0
1717
* @var string
1818
*/
1919
const PERFLAB_REST_API_NAMESPACE = 'performance-lab/v1';
@@ -24,7 +24,7 @@
2424
* Note the `:activate` art of the endpoint follows Google's guidance in AIP-136 for the use of the POST method in a way
2525
* that does not strictly follow the standard usage.
2626
*
27-
* @since n.e.x.t
27+
* @since 3.6.0
2828
* @link https://google.aip.dev/136
2929
* @var string
3030
*/
@@ -33,15 +33,15 @@
3333
/**
3434
* Route for fetching plugin/feature information.
3535
*
36-
* @since n.e.x.t
36+
* @since 3.6.0
3737
* @var string
3838
*/
3939
const PERFLAB_FEATURES_INFORMATION_ROUTE = '/features/(?P<slug>[a-z0-9_-]+)';
4040

4141
/**
4242
* Registers endpoint for performance-lab REST API.
4343
*
44-
* @since n.e.x.t
44+
* @since 3.6.0
4545
* @access private
4646
*/
4747
function perflab_register_endpoint(): void {
@@ -102,7 +102,7 @@ function perflab_register_endpoint(): void {
102102
* Note that an enum is not being used because additional PHP files have to be required to access the necessary functions,
103103
* and this would not be ideal to do at rest_api_init.
104104
*
105-
* @since n.e.x.t
105+
* @since 3.6.0
106106
* @access private
107107
*
108108
* @param string $slug Plugin slug.
@@ -118,7 +118,7 @@ function perflab_validate_slug_endpoint_arg( string $slug ): bool {
118118
/**
119119
* Handles REST API request to activate plugin/feature.
120120
*
121-
* @since n.e.x.t
121+
* @since 3.6.0
122122
* @access private
123123
*
124124
* @phpstan-param WP_REST_Request<array<string, mixed>> $request
@@ -163,7 +163,7 @@ function perflab_handle_feature_activation( WP_REST_Request $request ) {
163163
/**
164164
* Handles REST API request to get plugin/feature information.
165165
*
166-
* @since n.e.x.t
166+
* @since 3.6.0
167167
* @access private
168168
*
169169
* @phpstan-param WP_REST_Request<array<string, mixed>> $request

0 commit comments

Comments
 (0)