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 <[email protected]>

---------

Co-authored-by: Brad Jorsch <[email protected]>
  • Loading branch information
2 people authored and gogdzl committed Oct 25, 2024
1 parent 7e0dcdf commit 9957f93
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 4 deletions.
4 changes: 4 additions & 0 deletions projects/packages/sync/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Update plugin action links filter parameter to avoid conflicts with other plugins.
8 changes: 4 additions & 4 deletions projects/packages/sync/src/modules/class-callables.php
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


5 changes: 5 additions & 0 deletions projects/plugins/backup/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


5 changes: 5 additions & 0 deletions projects/plugins/boost/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: compat

Plugin action links filters: update parameter to avoid any conflicts with other plugins.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


5 changes: 5 additions & 0 deletions projects/plugins/protect/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


5 changes: 5 additions & 0 deletions projects/plugins/search/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


5 changes: 5 additions & 0 deletions projects/plugins/social/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


5 changes: 5 additions & 0 deletions projects/plugins/wpcomsh/changelog/fix-sync-filter-null-array
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Sync: update filter parameter to avoid conflicts with other plugins.


0 comments on commit 9957f93

Please sign in to comment.