From c461697c3178b093d2677ee3ddcb55838822020d Mon Sep 17 00:00:00 2001 From: TimothyBlynJacobs Date: Tue, 28 Jul 2020 04:10:10 +0000 Subject: [PATCH] REST API: Remove assets field from block directory controller. Gutenberg no longer uses the assets field to fetch the assets for the installed block so this field can be dropped from the endpoint. This allows us to reintroduce it at a later point without needing to worry about backward compatibility. See #50732. Built from https://develop.svn.wordpress.org/trunk@48656 git-svn-id: http://core.svn.wordpress.org/trunk@48418 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- ...ass-wp-rest-block-directory-controller.php | 26 ------------------- wp-includes/version.php | 2 +- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php index bc81da184a..4dc0f17fbe 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php @@ -129,7 +129,6 @@ class WP_REST_Block_Directory_Controller extends WP_REST_Controller { 'author_block_count' => intval( $plugin['author_block_count'] ), 'author' => wp_strip_all_tags( $plugin['author'] ), 'icon' => ( isset( $plugin['icons']['1x'] ) ? $plugin['icons']['1x'] : 'block-default' ), - 'assets' => array(), 'last_updated' => gmdate( 'Y-m-d\TH:i:s', strtotime( $plugin['last_updated'] ) ), 'humanized_updated' => sprintf( /* translators: %s: Human-readable time difference. */ @@ -138,21 +137,6 @@ class WP_REST_Block_Directory_Controller extends WP_REST_Controller { ), ); - foreach ( $plugin['block_assets'] as $asset ) { - // Allow for fully qualified URLs in future - if ( 'https' === wp_parse_url( $asset, PHP_URL_SCHEME ) && ! empty( wp_parse_url( $asset, PHP_URL_HOST ) ) ) { - $block['assets'][] = esc_url_raw( - $asset, - array( 'https' ) - ); - } else { - $block['assets'][] = esc_url_raw( - add_query_arg( 'v', strtotime( $block['last_updated'] ), 'https://ps.w.org/' . $plugin['slug'] . $asset ), - array( 'https' ) - ); - } - } - $this->add_additional_fields_to_object( $block, $request ); $response = new WP_REST_Response( $block ); @@ -296,16 +280,6 @@ class WP_REST_Block_Directory_Controller extends WP_REST_Controller { 'type' => 'string', 'context' => array( 'view' ), ), - 'assets' => array( - 'description' => __( 'An object representing the block CSS and JavaScript assets.' ), - 'type' => 'array', - 'context' => array( 'view' ), - 'readonly' => true, - 'items' => array( - 'type' => 'string', - 'format' => 'uri', - ), - ), ), ); diff --git a/wp-includes/version.php b/wp-includes/version.php index bd35983ae9..9820fb78ce 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-beta4-48655'; +$wp_version = '5.5-beta4-48656'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.