| @@ -400,8 +400,9 @@ | ||
| 400 | 400 | return $data; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | function get_update_data($options) { |
| 404 | + global $wp_version; | |
| 404 | 405 | $event_data = array('action' => 'update'); |
| 405 | 406 | if ($options['type'] === 'plugin') { |
| 406 | 407 | $event_data['type'] = 'plugin'; |
| 407 | 408 | if (array_key_exists("plugin", $options)) { |
| @@ -417,8 +418,12 @@ | ||
| 417 | 418 | unset($options['theme']); |
| 418 | 419 | } |
| 419 | 420 | $event_data['themes'] = $this->get_theme_update_data($options['themes']); |
| 420 | 421 | } |
| 422 | + else if ($options['type'] === 'core') { | |
| 423 | + $event_data['type'] = 'core'; | |
| 424 | + $event_data['wp_core'] = array('prev_version' => $wp_version); | |
| 425 | + } | |
| 421 | 426 | return $event_data; |
| 422 | 427 | } |
| 423 | 428 | |
| 424 | 429 | function get_install_data($upgrader, $options) { |
| @@ -436,11 +441,8 @@ | ||
| 436 | 441 | |
| 437 | 442 | function upgrade_handler($upgrader, $data) { |
| 438 | 443 | $event_data = array(); |
| 439 | 444 | if ($data['action'] === 'update') { |
| 440 | - if ('core' === $data['type']) { | |
| 441 | - return; | |
| 442 | - } | |
| 443 | 445 | $event_data = $this->get_update_data($data); |
| 444 | 446 | } else if ($data['action'] === 'install') { |
| 445 | 447 | $event_data = $this->get_install_data($upgrader, $data); |
| 446 | 448 | } |
| @@ -446,16 +448,8 @@ | ||
| 446 | 448 | } |
| 447 | 449 | $this->add_activity($event_data); |
| 448 | 450 | } |
| 449 | 451 | |
| 450 | - function core_upgrade_handler($new_wp_version) { | |
| 451 | - global $wp_version; | |
| 452 | - $event_data = array(); | |
| 453 | - $event_data['type'] = 'core'; | |
| 454 | - $event_data['wp_core'] = array('prev_version' => $wp_version, 'new_version' => $new_wp_version); | |
| 455 | - $this->add_activity($event_data); | |
| 456 | - } | |
| 457 | - | |
| 458 | 452 | /* ADDING ACTION AND LISTENERS FOR SENSING EVENTS. */ |
| 459 | 453 | public function add_actions_and_listeners() { |
| 460 | 454 | /* SENSORS FOR POST AND PAGE CHANGES */ |
| 461 | 455 | add_action('pre_post_update', array($this, 'post_handler')); |
| @@ -501,9 +495,8 @@ | ||
| 501 | 495 | add_action('password_reset', array( $this, 'password_reset_handler'), 10, 2); |
| 502 | 496 | |
| 503 | 497 | /* SENSOR FOR PLUGIN, THEME, WPCORE UPGRADES */ |
| 504 | 498 | add_action('upgrader_process_complete', array($this, 'upgrade_handler'), 10, 2); |
| 505 | - add_action('_core_updated_successfully', array($this, 'core_upgrade_handler'), 10, 1); | |
| 506 | 499 | |
| 507 | 500 | /* SENSORS FOR WOOCOMMERCE EVENTS */ |
| 508 | 501 | add_action('woocommerce_attribute_added', array($this, 'woocommerce_attribute_created_handler'), 10, 2); |
| 509 | 502 | add_action('woocommerce_attribute_updated', array($this, 'woocommerce_attribute_handler'), 10, 1); |