PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 13.3.3
Jetpack – WP Security, Backup, Speed, & Growth v13.3.3
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
jetpack / json-endpoints / jetpack / class.jetpack-json-api-maybe-auto-update-endpoint.php

class.jetpack-json-api-maybe-auto-update-endpoint.php in Jetpack – WP Security, Backup, Speed, & Growth 13.3.3, at json-endpoints/jetpack/class.jetpack-json-api-maybe-auto-update-endpoint.php

57 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2
3 /**
4 * Auto update endpoint class.
5 *
6 * POST /sites/%s/maybe_auto_update
7 */
8 class Jetpack_JSON_API_Maybe_Auto_Update_Endpoint extends Jetpack_JSON_API_Endpoint {
9
10 /**
11 * Needed capabilities.
12 *
13 * @var array
14 */
15 protected $needed_capabilities = array( 'update_core', 'update_plugins', 'update_themes' );
16
17 /**
18 * Update results.
19 *
20 * @var array
21 */
22 protected $update_results = array();
23
24 /**
25 * The result.
26 *
27 * @return array
28 */
29 protected function result() {
30 add_action( 'automatic_updates_complete', array( $this, 'get_update_results' ), 100, 1 );
31
32 wp_maybe_auto_update();
33
34 $result = array();
35 $result['log'] = $this->update_results;
36
37 if ( empty( $result['log'] ) ) {
38 $possible_reasons_for_failure = Jetpack_Autoupdate::get_possible_failures();
39
40 if ( $possible_reasons_for_failure ) {
41 $result['log']['error'] = $possible_reasons_for_failure;
42 }
43 }
44
45 return $result;
46 }
47
48 /**
49 * Get update results.
50 *
51 * @param array $results - the results.
52 */
53 public function get_update_results( $results ) {
54 $this->update_results = $results;
55 }
56 }
57