Skip to content

Commit

Permalink
Lock file maintenance (#40515)
Browse files Browse the repository at this point in the history
* Lock file maintenance
* Address Phan issues due to php-stubs/wordpress-stubs upgrade
  * Some typecasts to account for better Core type delcarations.
  * Suppress `current_user_can_for_blog` → `current_user_can_for_site`
    until we drop 6.6 support.
* Hack around Core SimplePie renaming

  Core upgraded their copy-pasted SimplePie library, which included
  renaming all the classes. While they did provide back-compat aliases, we
  run into a few problems:

  * A method parameter type of `SimplePie_Item` won't accept
    `SimplePie\Item`, while `SimplePie\Item` won't work on WP 6.6.
  * It's really hard to make Phan happy for both the two runs (with 6.7
    stubs and with 6.6 stubs).

  The best I was able to come up with was this:
  * Turn on `enable_class_alias_support`.
  * Alias `Jetpack\SimplePie\<name>` to the appropriate classes, and use
    those aliases everywhere.
    * Have phan load only one of the two alias files, depending on which
  	run it's doing.
  * Merge all the test mocks into one file and load them from
    bootstrap.php.

---------

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Brad Jorsch <brad.jorsch@automattic.com>

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/12261510871

Upstream-Ref: Automattic/jetpack@ceebd52
  • Loading branch information
anomiex authored and matticbot committed Dec 10, 2024
1 parent 144b560 commit 5a16f27
Show file tree
Hide file tree
Showing 53 changed files with 240 additions and 161 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This is an alpha version! The changes listed here are not final.
- Comments: Make list of allowable comment types filterable so custom types can be returned if needed.
- Infinite scroll: remove deprecated code.
- Jetpack AI: Adding tooltips to AI feedback component
- Updated package dependencies.

## 14.2-a.1 - 2024-12-09
### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion _inc/blocks/712.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions _inc/blocks/components.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@

/**
* @license React
* use-sync-external-store-shim.production.min.js
* use-sync-external-store-shim.production.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
Expand Down
2 changes: 1 addition & 1 deletion _inc/blocks/editor-beta.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'lodash', 'moment', 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => '53248d5229fa0c3eac21');
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'lodash', 'moment', 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => '13d80a01e44cc6f4abd0');
2 changes: 1 addition & 1 deletion _inc/blocks/editor-beta.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/blocks/editor-beta.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/blocks/editor-beta.rtl.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/blocks/editor-experimental.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'lodash', 'moment', 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => '8138be90de8e2120cfc1');
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'lodash', 'moment', 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => '3a07aa4a1cfaa8385f5d');
2 changes: 1 addition & 1 deletion _inc/blocks/editor-experimental.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/blocks/editor-experimental.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/blocks/editor-experimental.rtl.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/blocks/editor-no-post-editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('jetpack-connection', 'lodash', 'moment', 'react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets'), 'version' => 'd592d9a676a6a4a7e406');
<?php return array('dependencies' => array('jetpack-connection', 'lodash', 'moment', 'react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets'), 'version' => 'e67a6ff5b1c0f6c3ca3c');
2 changes: 1 addition & 1 deletion _inc/blocks/editor-no-post-editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/blocks/editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'lodash', 'moment', 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => '0ca194aad382fe62ee9e');
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'lodash', 'moment', 'react', 'react-dom', 'react-jsx-runtime', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => '996ef1308a385d3a9379');
2 changes: 1 addition & 1 deletion _inc/blocks/editor.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/blocks/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/blocks/editor.rtl.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/blocks/slideshow/view.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-dom-ready', 'wp-escape-html', 'wp-i18n', 'wp-polyfill'), 'version' => 'eb66b7edd1603163a046');
<?php return array('dependencies' => array('wp-dom-ready', 'wp-escape-html', 'wp-i18n', 'wp-polyfill'), 'version' => 'fa8325cba71797dd4af4');
2 changes: 1 addition & 1 deletion _inc/blocks/slideshow/view.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/build/admin.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'jquery', 'lodash', 'react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => 'abd950c0d8674cb9569d');
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'jquery', 'lodash', 'react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '185f783d10b0077da4ec');
2 changes: 1 addition & 1 deletion _inc/build/admin.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/build/admin.rtl.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/build/carousel/swiper-bundle.min.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '2864c68e8b7d87606467');
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '0602aaf38455f356ca0f');
2 changes: 1 addition & 1 deletion _inc/build/carousel/swiper-bundle.min.js

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions _inc/lib/class-jetpack-podcast-feed-locator.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
<?php
/**
* Extension of the SimplePie_Locator class, to detect podcast feeds
* Extension of the SimplePie\Locator class, to detect podcast feeds
*
* @package automattic/jetpack
*/

// Dummy comment to make phpcs happy.
require_once __DIR__ . '/jp-simplepie-alias.php';

/**
* Class Jetpack_Podcast_Feed_Locator
*/
class Jetpack_Podcast_Feed_Locator extends SimplePie_Locator {
class Jetpack_Podcast_Feed_Locator extends Jetpack\SimplePie\Locator {
/**
* Overrides the locator is_feed function to check for
* appropriate podcast elements.
*
* @param SimplePie_File $file The file being checked.
* @param boolean $check_html Adds text/html to the mimetypes checked.
* @param Jetpack\SimplePie\File $file The file being checked.
* @param boolean $check_html Adds text/html to the mimetypes checked.
*/
public function is_feed( $file, $check_html = false ) {
return parent::is_feed( $file, $check_html ) && $this->is_podcast_feed( $file );
Expand All @@ -24,7 +27,7 @@ public function is_feed( $file, $check_html = false ) {
* Checks the contents of the file for elements that make
* it a podcast feed.
*
* @param SimplePie_File $file The file being checked.
* @param Jetpack\SimplePie\File $file The file being checked.
*/
private function is_podcast_feed( $file ) {
// If we can't read the DOM assume it's a podcast feed, we'll work
Expand Down
33 changes: 20 additions & 13 deletions _inc/lib/class-jetpack-podcast-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* @package automattic/jetpack
*/

// Dummy comment to make phpcs happy.
require_once __DIR__ . '/jp-simplepie-alias.php';

/**
* Class Jetpack_Podcast_Helper
*/
Expand Down Expand Up @@ -304,7 +307,7 @@ protected function sanitize_and_decode_text( $str, $strip_all_tags = true ) {
* Loads an RSS feed using `fetch_feed`.
*
* @param boolean $force_refresh Clear the feed cache.
* @return SimplePie|WP_Error The RSS object or error.
* @return Jetpack\SimplePie\SimplePie|WP_Error The RSS object or error.
*/
public function load_feed( $force_refresh = false ) {
// Add action: clear the SimplePie Cache if $force_refresh param is true.
Expand Down Expand Up @@ -353,7 +356,7 @@ public function load_feed( $force_refresh = false ) {
* Note that this action runs after other hooks added by Jetpack have been removed.
*
* @param string $podcast_url URL for the podcast's RSS feed.
* @param SimplePie|WP_Error $rss Either the SimplePie RSS object or an error.
* @param SimplePie\SimplePie|SimplePie|WP_Error $rss Either the SimplePie RSS object or an error.
*
* @since 11.2
*/
Expand Down Expand Up @@ -390,14 +393,16 @@ public function filter_podcast_cache_timeout( $cache_timeout_in_seconds ) {
/**
* Action handler to set our podcast specific feed locator class on the SimplePie object.
*
* @param SimplePie $feed The SimplePie object, passed by reference.
* @param Jetpack\SimplePie\SimplePie $feed The SimplePie object, passed by reference.
*/
public static function set_podcast_locator( &$feed ) {
if ( ! class_exists( 'Jetpack_Podcast_Feed_Locator' ) ) {
require_once JETPACK__PLUGIN_DIR . '/_inc/lib/class-jetpack-podcast-feed-locator.php';
}

$feed->set_locator_class( 'Jetpack_Podcast_Feed_Locator' );
// @todo Once we drop support for WordPress 6.6, drop the class_exists check.
// @phan-suppress-next-line PhanUndeclaredClassReference -- Being tested for. @phan-suppress-current-line UnusedPluginSuppression
$feed->get_registry()->register( class_exists( SimplePie\Locator::class ) ? SimplePie\Locator::class : 'Locator', 'Jetpack_Podcast_Feed_Locator' );
}

/**
Expand All @@ -406,12 +411,14 @@ public static function set_podcast_locator( &$feed ) {
* Note this only resets the cache for the specified url. If the feed locator finds the podcast feed
* within the markup of the that url, that feed itself may still be cached.
*
* @param SimplePie $feed The SimplePie object, passed by reference.
* @param Jetpack\SimplePie\SimplePie $feed The SimplePie object, passed by reference.
* @return void
*/
public static function reset_simplepie_cache( &$feed ) {
// Retrieve the cache object for a feed url. Based on:
// https://github.com/WordPress/WordPress/blob/fd1c2cb4011845ceb7244a062b09b2506082b1c9/wp-includes/class-simplepie.php#L1412.
// @todo This method of getting the cache is deprecated, and there doesn't seem to be a real replacement. `$feed->get_cache()` is private.
// @phan-suppress-next-line PhanUndeclaredClassReference
$cache = $feed->registry->call( 'Cache', 'get_handler', array( $feed->cache_location, call_user_func( $feed->cache_name_function, $feed->feed_url ), 'spc' ) );

if ( method_exists( $cache, 'unlink' ) ) {
Expand All @@ -422,10 +429,10 @@ public static function reset_simplepie_cache( &$feed ) {
/**
* Prepares Episode data to be used by the Podcast Player block.
*
* @param SimplePie_Item $episode SimplePie_Item object, representing a podcast episode.
* @param Jetpack\SimplePie\Item $episode SimplePie Item object, representing a podcast episode.
* @return array
*/
protected function setup_tracks_callback( SimplePie_Item $episode ) {
protected function setup_tracks_callback( Jetpack\SimplePie\Item $episode ) {
$enclosure = $this->get_audio_enclosure( $episode );

// If the audio enclosure is empty then it is not playable.
Expand Down Expand Up @@ -469,11 +476,11 @@ protected function setup_tracks_callback( SimplePie_Item $episode ) {
/**
* Retrieves an episode's image URL, if it's available.
*
* @param SimplePie_Item $episode SimplePie_Item object, representing a podcast episode.
* @param string $itunes_ns The itunes namespace, defaulted to the standard 1.0 version.
* @param Jetpack\SimplePie\Item $episode SimplePie Item object, representing a podcast episode.
* @param string $itunes_ns The itunes namespace, defaulted to the standard 1.0 version.
* @return string|null The image URL or null if not found.
*/
protected function get_episode_image_url( SimplePie_Item $episode, $itunes_ns = 'http://www.itunes.com/dtds/podcast-1.0.dtd' ) {
protected function get_episode_image_url( Jetpack\SimplePie\Item $episode, $itunes_ns = 'http://www.itunes.com/dtds/podcast-1.0.dtd' ) {
$image = $episode->get_item_tags( $itunes_ns, 'image' );
if ( isset( $image[0]['attribs']['']['href'] ) ) {
return $image[0]['attribs']['']['href'];
Expand All @@ -484,10 +491,10 @@ protected function get_episode_image_url( SimplePie_Item $episode, $itunes_ns =
/**
* Retrieves an audio enclosure.
*
* @param SimplePie_Item $episode SimplePie_Item object, representing a podcast episode.
* @return SimplePie_Enclosure|null
* @param Jetpack\SimplePie\Item $episode SimplePie Item object, representing a podcast episode.
* @return Jetpack\SimplePie\Enclosure|null
*/
protected function get_audio_enclosure( SimplePie_Item $episode ) {
protected function get_audio_enclosure( Jetpack\SimplePie\Item $episode ) {
foreach ( (array) $episode->get_enclosures() as $enclosure ) {
if ( str_starts_with( $enclosure->type, 'audio/' ) ) {
return $enclosure;
Expand Down
1 change: 1 addition & 0 deletions _inc/lib/core-api/wpcom-endpoints/subscribers.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public function register_routes() {
* Permission check. Only authors can access this endpoint.
*/
public function readable_permission_check() {
// @phan-suppress-next-line PhanDeprecatedFunction -- @todo Switch to current_user_can_for_site when we drop support for WP 6.6.
if ( ! current_user_can_for_blog( get_current_blog_id(), 'edit_posts' ) ) {
return new WP_Error( 'authorization_required', 'Only users with the permission to edit posts can see the subscriber count.', array( 'status' => 401 ) );
}
Expand Down
17 changes: 17 additions & 0 deletions _inc/lib/jp-simplepie-alias-new.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Class aliases for SimplePie.
*
* Core renamed the classes in 6.7, and for type declarations and such to work right we need to use the correct names.
* This provides aliases for use with WordPress 6.7.
*
* @todo Remove this once we drop support for WordPress 6.6
*
* @package automattic/jetpack
*/

class_alias( SimplePie\SimplePie::class, Jetpack\SimplePie\SimplePie::class );
class_alias( SimplePie\File::class, Jetpack\SimplePie\File::class );
class_alias( SimplePie\Item::class, Jetpack\SimplePie\Item::class );
class_alias( SimplePie\Locator::class, Jetpack\SimplePie\Locator::class );
class_alias( SimplePie\Enclosure::class, Jetpack\SimplePie\Enclosure::class );
17 changes: 17 additions & 0 deletions _inc/lib/jp-simplepie-alias-old.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Class aliases for SimplePie.
*
* Core renamed the classes in 6.7, and for type declarations and such to work right we need to use the correct names.
* This provides aliases for use with WordPress 6.6.
*
* @todo Remove this once we drop support for WordPress 6.6
*
* @package automattic/jetpack
*/

class_alias( SimplePie::class, Jetpack\SimplePie\SimplePie::class );
class_alias( SimplePie_File::class, Jetpack\SimplePie\File::class );
class_alias( SimplePie_Item::class, Jetpack\SimplePie\Item::class );
class_alias( SimplePie_Locator::class, Jetpack\SimplePie\Locator::class );
class_alias( SimplePie_Enclosure::class, Jetpack\SimplePie\Enclosure::class );
23 changes: 23 additions & 0 deletions _inc/lib/jp-simplepie-alias.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* Class aliases for SimplePie.
*
* Core renamed the classes in 6.7, and for type declarations and such to work right we need to use the correct names.
* This selects the correct alias file for the current version of WordPress.
*
* @todo Remove this once we drop support for WordPress 6.6
*
* @package automattic/jetpack
*/

if ( ! defined( 'ABSPATH' ) ) {
return;
}

require_once ABSPATH . '/wp-includes/class-simplepie.php';
// @phan-suppress-next-line PhanUndeclaredClassReference -- Being tested for. @phan-suppress-current-line UnusedPluginSuppression
if ( class_exists( SimplePie\SimplePie::class ) ) {
require_once __DIR__ . '/jp-simplepie-alias-new.php';
} else {
require_once __DIR__ . '/jp-simplepie-alias-old.php';
}
2 changes: 1 addition & 1 deletion class.jetpack-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ public static function register_block_metadata_collection() {
if ( function_exists( 'wp_register_block_metadata_collection' ) && file_exists( $meta_file_path ) ) {
add_filter( 'doing_it_wrong_trigger_error', array( __CLASS__, 'bypass_block_metadata_doing_it_wrong' ), 10, 4 );

// @phan-suppress-next-line PhanUndeclaredFunction -- New in WP 6.7. We're checking if it exists first.
// @phan-suppress-next-line PhanUndeclaredFunction -- New in WP 6.7. We're checking if it exists first. @phan-suppress-current-line UnusedPluginSuppression
wp_register_block_metadata_collection(
JETPACK__PLUGIN_DIR . '_inc/blocks/',
$meta_file_path
Expand Down
2 changes: 1 addition & 1 deletion class.jetpack-network.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function deactivate() {
$sites = get_sites();

foreach ( $sites as $s ) {
switch_to_blog( $s->blog_id );
switch_to_blog( (int) $s->blog_id );
$active_plugins = get_option( 'active_plugins' );

/*
Expand Down
1 change: 1 addition & 0 deletions class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -4502,6 +4502,7 @@ public static function verify_onboarding_token( $token_data, $token, $request_da
if ( is_a( $jp_user, 'WP_User' ) ) {
wp_set_current_user( $jp_user->ID );
$user_can = is_multisite()
// @phan-suppress-next-line PhanDeprecatedFunction -- @todo Switch to current_user_can_for_site when we drop support for WP 6.6.
? current_user_can_for_blog( get_current_blog_id(), 'manage_options' )
: current_user_can( 'manage_options' );
if ( $user_can ) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"automattic/jetpack-device-detection": "^3.0.0",
"automattic/jetpack-error": "^3.0.0",
"automattic/jetpack-forms": "^0.34.4-alpha",
"automattic/jetpack-image-cdn": "^0.7.1",
"automattic/jetpack-image-cdn": "^0.7.2-alpha",
"automattic/jetpack-import": "^0.9.1",
"automattic/jetpack-ip": "^0.4.1",
"automattic/jetpack-jitm": "^4.0.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '0d9b7c1c5507602fae89');
<?php return array('dependencies' => array(), 'version' => '3d6b6c0a2cee025f46f3');
Loading

0 comments on commit 5a16f27

Please sign in to comment.