| @@ -32,9 +32,8 @@ | ||
| 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' ) ); | |
| 37 | 36 | add_action( 'upgrader_process_complete', array( $this, 'upload_software' ) ); |
| 38 | 37 | add_action( '_core_updated_successfully', array( &$this, 'upload_software' ) ); |
| 39 | 38 | } |
| 40 | 39 | |
| @@ -47,9 +46,9 @@ | ||
| 47 | 46 | public function upload_software() { |
| 48 | 47 | // Get the software data and hash. |
| 49 | 48 | $data = $this->get_software_data(); |
| 50 | 49 | $hash = sha1( json_encode( $data ) ); |
| 51 | - if ( ! defined( 'DOING_CRON' ) && ! isset( $_POST['webarx_secret'] ) && get_option( 'patchstack_software_data_hash', false ) === $hash && ! is_admin() ) { | |
| 50 | + if ( ! isset( $_POST['webarx_secret'] ) && get_option( 'patchstack_software_data_hash', false ) === $hash ) { | |
| 52 | 51 | return; |
| 53 | 52 | } |
| 54 | 53 | |
| 55 | 54 | // Synchronize the software list with the API. |
| @@ -77,9 +76,9 @@ | ||
| 77 | 76 | * @return void |
| 78 | 77 | */ |
| 79 | 78 | public function upload_firewall_logs() { |
| 80 | 79 | global $wpdb; |
| 81 | - $lastid = get_option( 'patchstack_firewall_log_lastid', 0 ); | |
| 80 | + $lastid = get_option( 'patchstack_firewall_log_lastid', 0, true ); | |
| 82 | 81 | $items = $wpdb->get_results( $wpdb->prepare( 'SELECT ip, log_date, request_uri, user_agent, fid, method, post_data FROM ' . $wpdb->prefix . 'patchstack_firewall_log WHERE id > %d ORDER BY id', $lastid ) ); |
| 83 | 82 | |
| 84 | 83 | // No need to synchronize if there are no new logs present. |
| 85 | 84 | if ( $wpdb->num_rows == 0 ) { |
| @@ -200,16 +199,8 @@ | ||
| 200 | 199 | $plugin_name = empty( $plugin_data['Name'] ) ? '' : $plugin_data['Name']; |
| 201 | 200 | $plugin_version = empty( $plugin_data['Version'] ) ? '' : $plugin_data['Version']; |
| 202 | 201 | |
| 203 | 202 | 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 | - | |
| 212 | 203 | $software_list[] = array( |
| 213 | 204 | 'sw_type' => 'plugin', |
| 214 | 205 | 'sw_name' => $plugin_name, |
| 215 | 206 | 'sw_cur_ver' => $plugin_version, |
| @@ -214,9 +205,9 @@ | ||
| 214 | 205 | 'sw_name' => $plugin_name, |
| 215 | 206 | 'sw_cur_ver' => $plugin_version, |
| 216 | 207 | 'sw_new_ver' => $new_version, |
| 217 | 208 | 'sw_key' => $plugin, |
| 218 | - 'sw_active' => $active | |
| 209 | + 'sw_active' => is_plugin_active( $plugin ), | |
| 219 | 210 | ); |
| 220 | 211 | } |
| 221 | 212 | } |
| 222 | 213 | |