Skip to content

Commit

Permalink
Sync: avoid conflicts with other plugins using the filter (#39681)
Browse files Browse the repository at this point in the history
* Sync: avoid conflicts with other plugins using the filter

Fixes #39654

* Provide actual plugin data to filter

See https://github.com/Automattic/jetpack/pull/39681/files#r1793690662

* Update projects/packages/sync/src/modules/class-callables.php

Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>

---------

Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>

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

Upstream-Ref: Automattic/jetpack@f467c5d
  • Loading branch information
jeherve authored and matticbot committed Oct 15, 2024
1 parent ea7e783 commit 5a5b365
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 96 deletions.
60 changes: 30 additions & 30 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,18 @@ private static function is_proxied() {
/**
* Creates instance.
*
* @return \A8C\FSE\Help_Center
* @return void
*/
public static function init() {
$request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';

if ( str_contains( $request_uri, 'wp-content/plugins/gutenberg-core' ) || str_contains( $request_uri, 'preview=true' ) ) {
return;
}

if ( self::$instance === null ) {
self::$instance = new self();
}
return self::$instance;
}

/**
Expand Down
1 change: 1 addition & 0 deletions vendor/automattic/jetpack-sync/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This is an alpha version! The changes listed here are not final.

### Fixed
- Jetpack Sync: Ensure Full Sync is only triggered on backend admin POST requests
- Update plugin action links filter parameter to avoid conflicts with other plugins.

## [3.14.1] - 2024-10-14
### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ public function set_plugin_action_links() {
if ( ! empty( $plugins_lock ) && ( isset( $current_screeen->id ) && 'plugins' !== $current_screeen->id ) ) {
return;
}
$plugins = array_keys( Functions::get_plugins() );
foreach ( $plugins as $plugin_file ) {
$plugins = Functions::get_plugins();
foreach ( $plugins as $plugin_file => $plugin_data ) {
/**
* Plugins often like to unset things but things break if they are not able to.
*/
Expand All @@ -396,13 +396,13 @@ public function set_plugin_action_links() {
'edit' => '',
);
/** This filter is documented in src/wp-admin/includes/class-wp-plugins-list-table.php */
$action_links = apply_filters( 'plugin_action_links', $action_links, $plugin_file, null, 'all' );
$action_links = apply_filters( 'plugin_action_links', $action_links, $plugin_file, $plugin_data, 'all' );
// Verify $action_links is still an array.
if ( ! is_array( $action_links ) ) {
$action_links = array();
}
/** This filter is documented in src/wp-admin/includes/class-wp-plugins-list-table.php */
$action_links = apply_filters( "plugin_action_links_{$plugin_file}", $action_links, $plugin_file, null, 'all' );
$action_links = apply_filters( "plugin_action_links_{$plugin_file}", $action_links, $plugin_file, $plugin_data, 'all' );
// Verify $action_links is still an array to resolve warnings from filters not returning an array.
if ( is_array( $action_links ) ) {
$action_links = array_filter( $action_links );
Expand Down
Loading

0 comments on commit 5a5b365

Please sign in to comment.