1 | <?php |
||
3 | class Jetpack_Sync_Module_Updates extends Jetpack_Sync_Module { |
||
4 | function name() { |
||
5 | return 'updates'; |
||
6 | } |
||
7 | |||
8 | public function init_listeners( $callable ) { |
||
9 | add_action( 'set_site_transient_update_plugins', $callable, 10, 1 ); |
||
10 | add_action( 'set_site_transient_update_themes', $callable, 10, 1 ); |
||
11 | add_action( 'set_site_transient_update_core', $callable, 10, 1 ); |
||
12 | |||
13 | // full sync |
||
14 | add_action( 'jetpack_full_sync_updates', $callable ); |
||
15 | |||
16 | add_filter( 'jetpack_sync_before_enqueue_set_site_transient_update_plugins', array( $this, 'filter_update_keys' ), 10, 2 ); |
||
17 | add_filter( 'jetpack_sync_before_enqueue_upgrader_process_complete', array( $this, 'filter_upgrader_process_complete' ), 10, 2 ); |
||
18 | } |
||
19 | |||
20 | public function init_before_send() { |
||
24 | |||
25 | public function enqueue_full_sync_actions() { |
||
36 | |||
37 | function get_full_sync_actions() { |
||
40 | |||
41 | public function get_all_updates() { |
||
42 | return array( |
||
43 | 'core' => get_site_transient( 'update_core' ), |
||
44 | 'plugins' => get_site_transient( 'update_plugins' ), |
||
45 | 'themes' => get_site_transient( 'update_themes' ), |
||
46 | ); |
||
47 | } |
||
48 | |||
49 | // removes unnecessary keys from synced updates data |
||
50 | function filter_update_keys( $args ) { |
||
51 | $updates = $args[0]; |
||
52 | |||
53 | if ( isset( $updates->no_update ) ) { |
||
54 | unset( $updates->no_update ); |
||
55 | } |
||
56 | |||
57 | return $args; |
||
58 | } |
||
59 | |||
60 | function filter_upgrader_process_complete( $args ) { |
||
64 | |||
65 | public function expand_updates( $args ) { |
||
72 | } |
||
73 |