@@ 38-56 (lines=19) @@ | ||
35 | * @since 2.3.3 |
|
36 | * @return Jetpack_Heartbeat |
|
37 | */ |
|
38 | private function __construct() { |
|
39 | if ( ! Jetpack::is_active() ) { |
|
40 | return; |
|
41 | } |
|
42 | ||
43 | // Schedule the task |
|
44 | add_action( $this->cron_name, array( $this, 'cron_exec' ) ); |
|
45 | ||
46 | if ( ! wp_next_scheduled( $this->cron_name ) ) { |
|
47 | // Deal with the old pre-3.0 weekly one. |
|
48 | if ( $timestamp = wp_next_scheduled( 'jetpack_heartbeat' ) ) { |
|
49 | wp_unschedule_event( $timestamp, 'jetpack_heartbeat' ); |
|
50 | } |
|
51 | ||
52 | wp_schedule_event( time(), 'daily', $this->cron_name ); |
|
53 | } |
|
54 | ||
55 | add_filter( 'jetpack_xmlrpc_methods', array( __CLASS__, 'jetpack_xmlrpc_methods' ) ); |
|
56 | } |
|
57 | ||
58 | /** |
|
59 | * Method that gets executed on the wp-cron call |
@@ 54-70 (lines=17) @@ | ||
51 | * @since 2.3.3 |
|
52 | * @return Heartbeat |
|
53 | */ |
|
54 | private function __construct() { |
|
55 | ||
56 | // Schedule the task. |
|
57 | add_action( $this->cron_name, array( $this, 'cron_exec' ) ); |
|
58 | ||
59 | if ( ! wp_next_scheduled( $this->cron_name ) ) { |
|
60 | // Deal with the old pre-3.0 weekly one. |
|
61 | $timestamp = wp_next_scheduled( 'jetpack_heartbeat' ); |
|
62 | if ( $timestamp ) { |
|
63 | wp_unschedule_event( $timestamp, 'jetpack_heartbeat' ); |
|
64 | } |
|
65 | ||
66 | wp_schedule_event( time(), 'daily', $this->cron_name ); |
|
67 | } |
|
68 | ||
69 | add_filter( 'jetpack_xmlrpc_methods', array( __CLASS__, 'jetpack_xmlrpc_methods' ) ); |
|
70 | } |
|
71 | ||
72 | /** |
|
73 | * Method that gets executed on the wp-cron call |