Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
WordAds_Cron
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 4
20
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 activate
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 deactivate
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 update_wordads_status
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * WordAds cron tasks.
4 *
5 * @package automattic/jetpack
6 */
7
8if ( ! defined( 'ABSPATH' ) ) {
9    exit( 0 );
10}
11
12/**
13 * WordAds cron tasks
14 *
15 * @since 4.5.0
16 */
17class WordAds_Cron {
18
19    /**
20     * Add the actions the cron tasks will use
21     *
22     * @since 4.5.0
23     */
24    public function __construct() {
25        add_action( 'wordads_cron_status', array( $this, 'update_wordads_status' ) );
26    }
27
28    /**
29     * Registered scheduled events on activation
30     *
31     * @since 4.5.0
32     */
33    public static function activate() {
34        wp_schedule_event( time(), 'daily', 'wordads_cron_status' );
35    }
36
37    /**
38     * Clear scheduled hooks on deactivation
39     *
40     * @since 4.5.0
41     */
42    public static function deactivate() {
43        wp_clear_scheduled_hook( 'wordads_cron_status' );
44    }
45
46    /**
47     * Grab WordAds status from WP.com API
48     *
49     * @since 4.5.0
50     */
51    public static function update_wordads_status() {
52        WordAds_API::update_wordads_status_from_api();
53    }
54}
55
56global $wordads_cron;
57$wordads_cron = new WordAds_Cron();