diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2018-06-08 10:09:24 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2018-06-08 10:09:24 -0400 |
commit | a6b006c0f1ef757f23375f7906193370337d8bd7 (patch) | |
tree | 4467c6423b2c54e6ef8c3e79241a833fb17833a5 /plugins/jetpack/sync/class.jetpack-sync-module-plugins.php | |
parent | Update akismet 4.0.7 (diff) | |
download | blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.tar.gz blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.tar.bz2 blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.zip |
Update jetpack 6.2
Diffstat (limited to 'plugins/jetpack/sync/class.jetpack-sync-module-plugins.php')
-rw-r--r-- | plugins/jetpack/sync/class.jetpack-sync-module-plugins.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/jetpack/sync/class.jetpack-sync-module-plugins.php b/plugins/jetpack/sync/class.jetpack-sync-module-plugins.php index a7b75209..8efbf35e 100644 --- a/plugins/jetpack/sync/class.jetpack-sync-module-plugins.php +++ b/plugins/jetpack/sync/class.jetpack-sync-module-plugins.php @@ -4,6 +4,7 @@ class Jetpack_Sync_Module_Plugins extends Jetpack_Sync_Module { private $action_handler; private $plugin_info = array(); + private $plugins = array(); public function name() { return 'plugins'; @@ -16,6 +17,7 @@ class Jetpack_Sync_Module_Plugins extends Jetpack_Sync_Module { add_action( 'activated_plugin', $callable, 10, 2 ); add_action( 'deactivated_plugin', $callable, 10, 2 ); add_action( 'delete_plugin', array( $this, 'delete_plugin') ); + add_filter( 'upgrader_pre_install', array( $this, 'populate_plugins' ), 10, 1 ); add_action( 'upgrader_process_complete', array( $this, 'on_upgrader_completion' ), 10, 2 ); add_action( 'jetpack_plugin_installed', $callable, 10, 1 ); add_action( 'jetpack_plugin_update_failed', $callable, 10, 4 ); @@ -30,7 +32,10 @@ class Jetpack_Sync_Module_Plugins extends Jetpack_Sync_Module { add_filter( 'jetpack_sync_before_send_deactivated_plugin', array( $this, 'expand_plugin_data' ) ); //Note that we don't simply 'expand_plugin_data' on the 'delete_plugin' action here because the plugin file is deleted when that action finishes } - + public function populate_plugins( $response ) { + $this->plugins = get_plugins(); + return $response; + } public function on_upgrader_completion( $upgrader, $details ) { if ( ! isset( $details['type'] ) ) { return; @@ -114,8 +119,12 @@ class Jetpack_Sync_Module_Plugins extends Jetpack_Sync_Module { } private function get_plugin_info( $slug ) { - $plugins = get_plugins(); - return isset( $plugins[ $slug ] ) ? array_merge( array( 'slug' => $slug), $plugins[ $slug ] ): array( 'slug' => $slug ); + $plugins = get_plugins(); // Get the most up to date info + if ( isset( $plugins[ $slug ] ) ) { + return array_merge( array( 'slug' => $slug ), $plugins[ $slug ] ); + }; + // Try grabbing the info from before the update + return isset( $this->plugins[ $slug ] ) ? array_merge( array( 'slug' => $slug ), $this->plugins[ $slug ] ): array( 'slug' => $slug ); } private function get_errors( $skin ) { @@ -217,7 +226,7 @@ class Jetpack_Sync_Module_Plugins extends Jetpack_Sync_Module { if ( false === $file_pointer ) { return; } - + fclose( $file_pointer ); /** * This action is documented already in this file */ |