PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
← All changes | jetpack_vendor/automattic/jetpack-sync/src/modules/class-stats.php +8 -14 13.2.4 → 16.3-a.5 View file →
@@ -8,8 +8,12 @@
8 8 namespace Automattic\Jetpack\Sync\Modules;
9 9
10 10 use Automattic\Jetpack\Heartbeat;
11 11
12 +if ( ! defined( 'ABSPATH' ) ) {
13 + exit( 0 );
14 +}
15 +
12 16 /**
13 17 * Class to handle sync for stats.
14 18 */
15 19 class Stats extends Module {
@@ -28,32 +32,22 @@
28 32 * Initialize stats action listeners.
29 33 *
30 34 * @access public
31 35 *
32 - * @param callable $callback Action handler callable.
36 + * @param callable $callback Unused - required for parent class compatibility.
33 37 */
34 - public function init_listeners( $callback ) {
38 + public function init_listeners( $callback ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
35 39 add_action( 'jetpack_heartbeat', array( $this, 'sync_site_stats' ), 20 );
36 - add_action( 'jetpack_sync_heartbeat_stats', $callback );
37 40 }
38 41
39 42 /**
40 - * This namespaces the action that we sync.
41 - * So that we can differentiate it from future actions.
43 + * Send Heartbeat stats immediately.
42 44 *
43 45 * @access public
44 46 */
45 47 public function sync_site_stats() {
46 - do_action( 'jetpack_sync_heartbeat_stats' );
47 - }
48 48
49 - /**
50 - * Initialize the module in the sender.
51 - *
52 - * @access public
53 - */
54 - public function init_before_send() {
55 - add_filter( 'jetpack_sync_before_send_jetpack_sync_heartbeat_stats', array( $this, 'add_stats' ) );
49 + $this->send_action( 'jetpack_sync_heartbeat_stats', $this->add_stats() );
56 50 }
57 51
58 52 /**
59 53 * Retrieve the stats data for the site.