summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-updates-status-endpoint.php')
-rw-r--r--plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-updates-status-endpoint.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-updates-status-endpoint.php b/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-updates-status-endpoint.php
index 48f9ae9d..f8bb2c06 100644
--- a/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-updates-status-endpoint.php
+++ b/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-updates-status-endpoint.php
@@ -1,23 +1,37 @@
-<?php
+<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
+/**
+ * Updates status class.
+ *
+ * GET /sites/%s/updates
+ */
class Jetpack_JSON_API_Updates_Status extends Jetpack_JSON_API_Endpoint {
- // GET /sites/%s/updates
+ /**
+ * Needed capabilities.
+ *
+ * @var string
+ */
protected $needed_capabilities = 'manage_options';
+ /**
+ * Endpoint callback.
+ *
+ * @return array|WP_Error
+ */
protected function result() {
wp_update_themes();
wp_update_plugins();
$update_data = wp_get_update_data();
- if ( ! isset( $update_data['counts'] ) ) {
+ if ( ! isset( $update_data['counts'] ) ) {
return new WP_Error( 'get_update_data_error', __( 'There was an error while getting the update data for this site.', 'jetpack' ), 500 );
}
$result = $update_data['counts'];
- include( ABSPATH . WPINC . '/version.php' ); // $wp_version;
- $result['wp_version'] = isset( $wp_version ) ? $wp_version : null;
+ include ABSPATH . WPINC . '/version.php'; // $wp_version;
+ $result['wp_version'] = isset( $wp_version ) ? $wp_version : null; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
if ( ! empty( $result['wordpress'] ) ) {
$cur = get_preferred_from_update_core();