| @@ -32,8 +32,9 @@ | ||
| 32 | 32 | |
| 33 | 33 | // In case a plugin or upgrade has been performed, re-synchronize with the app. |
| 34 | 34 | add_action( 'activated_plugin', array( $this, 'upload_software' ) ); |
| 35 | 35 | add_action( 'deactivated_plugin', array( $this, 'upload_software' ) ); |
| 36 | + add_action( 'deleted_plugin', array( $this, 'upload_software' ) ); | |
| 36 | 37 | add_action( 'upgrader_process_complete', array( $this, 'upload_software' ) ); |
| 37 | 38 | add_action( '_core_updated_successfully', array( &$this, 'upload_software' ) ); |
| 38 | 39 | } |
| 39 | 40 | |
| @@ -46,9 +47,9 @@ | ||
| 46 | 47 | public function upload_software() { |
| 47 | 48 | // Get the software data and hash. |
| 48 | 49 | $data = $this->get_software_data(); |
| 49 | 50 | $hash = sha1( json_encode( $data ) ); |
| 50 | - if ( ! defined( 'DOING_CRON' ) && ! isset( $_POST['webarx_secret'] ) && get_option( 'patchstack_software_data_hash', false ) === $hash ) { | |
| 51 | + if ( ! defined( 'DOING_CRON' ) && ! isset( $_POST['webarx_secret'] ) && get_option( 'patchstack_software_data_hash', false ) === $hash && ! is_admin() ) { | |
| 51 | 52 | return; |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | // Synchronize the software list with the API. |
| @@ -199,8 +200,16 @@ | ||
| 199 | 200 | $plugin_name = empty( $plugin_data['Name'] ) ? '' : $plugin_data['Name']; |
| 200 | 201 | $plugin_version = empty( $plugin_data['Version'] ) ? '' : $plugin_data['Version']; |
| 201 | 202 | |
| 202 | 203 | if ( ! empty( $plugin_name ) && ! empty( $plugin_version ) ) { |
| 204 | + | |
| 205 | + // Determine the active state. | |
| 206 | + if ( isset( $_GET['action'], $_GET['plugin'] ) && $_GET['action'] == 'deactivate' && $_GET['plugin'] == $plugin) { | |
| 207 | + $active = 0; | |
| 208 | + } else { | |
| 209 | + $active = (int) is_plugin_active( $plugin ); | |
| 210 | + } | |
| 211 | + | |
| 203 | 212 | $software_list[] = array( |
| 204 | 213 | 'sw_type' => 'plugin', |
| 205 | 214 | 'sw_name' => $plugin_name, |
| 206 | 215 | 'sw_cur_ver' => $plugin_version, |
| @@ -205,9 +214,9 @@ | ||
| 205 | 214 | 'sw_name' => $plugin_name, |
| 206 | 215 | 'sw_cur_ver' => $plugin_version, |
| 207 | 216 | 'sw_new_ver' => $new_version, |
| 208 | 217 | 'sw_key' => $plugin, |
| 209 | - 'sw_active' => is_plugin_active( $plugin ), | |
| 218 | + 'sw_active' => $active | |
| 210 | 219 | ); |
| 211 | 220 | } |
| 212 | 221 | } |
| 213 | 222 | |