diff options
Diffstat (limited to 'plugins/jetpack/_inc/lib/debugger/class-jetpack-debug-data.php')
-rw-r--r-- | plugins/jetpack/_inc/lib/debugger/class-jetpack-debug-data.php | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/plugins/jetpack/_inc/lib/debugger/class-jetpack-debug-data.php b/plugins/jetpack/_inc/lib/debugger/class-jetpack-debug-data.php index f128d38d..b67fc472 100644 --- a/plugins/jetpack/_inc/lib/debugger/class-jetpack-debug-data.php +++ b/plugins/jetpack/_inc/lib/debugger/class-jetpack-debug-data.php @@ -1,13 +1,16 @@ <?php /** - * Jetpack Debug Data for the legacy Jetpack debugger page and the WP 5.2-era Site Health sections. + * Jetpack Debug Data for the Site Health sections. * - * @package jetpack + * @package automattic/jetpack */ +use Automattic\Jetpack\Connection\Tokens; +use Automattic\Jetpack\Connection\Urls; use Automattic\Jetpack\Constants; +use Automattic\Jetpack\Identity_Crisis; +use Automattic\Jetpack\Redirect; use Automattic\Jetpack\Sync\Modules; -use Automattic\Jetpack\Sync\Functions; use Automattic\Jetpack\Sync\Sender; /** @@ -42,7 +45,7 @@ class Jetpack_Debug_Data { * @return string Human readable time. */ public static function seconds_to_time( $seconds ) { - $seconds = intval( $seconds ); + $seconds = (int) $seconds; $units = array( 'week' => WEEK_IN_SECONDS, 'day' => DAY_IN_SECONDS, @@ -56,7 +59,7 @@ class Jetpack_Debug_Data { } $human_readable = ''; foreach ( $units as $name => $divisor ) { - $quot = intval( $seconds / $divisor ); + $quot = (int) ( $seconds / $divisor ); if ( $quot ) { $human_readable .= "$quot $name"; $human_readable .= ( abs( $quot ) > 1 ? 's' : '' ) . ', '; @@ -95,8 +98,8 @@ class Jetpack_Debug_Data { */ public static function core_debug_data( $debug ) { $support_url = Jetpack::is_development_version() - ? 'https://jetpack.com/contact-support/beta-group/' - : 'https://jetpack.com/contact-support/'; + ? Redirect::get_url( 'jetpack-contact-support-beta-group' ) + : Redirect::get_url( 'jetpack-contact-support' ); $jetpack = array( 'jetpack' => array( @@ -165,7 +168,7 @@ class Jetpack_Debug_Data { ); $debug_info['master_user'] = array( 'label' => 'Jetpack Master User', - 'value' => self::human_readable_master_user(), + 'value' => self::human_readable_master_user(), // Only ID number and user name. 'private' => false, ); @@ -179,8 +182,8 @@ class Jetpack_Debug_Data { * If a token does not contain a period, then it is malformed and we report it as such. */ $user_id = get_current_user_id(); - $blog_token = Jetpack_Data::get_access_token(); - $user_token = Jetpack_Data::get_access_token( $user_id ); + $blog_token = ( new Tokens() )->get_access_token(); + $user_token = ( new Tokens() )->get_access_token( $user_id ); $tokenset = ''; if ( $blog_token ) { @@ -263,7 +266,7 @@ class Jetpack_Debug_Data { $debug_info[ $header ] = array( 'label' => 'Server Variable ' . $header, 'value' => ( $_SERVER[ $header ] ) ? $_SERVER[ $header ] : 'false', - 'private' => false, + 'private' => true, // This isn't really 'private' information, but we don't want folks to easily paste these into public forums. ); } } @@ -282,7 +285,7 @@ class Jetpack_Debug_Data { foreach ( $sync_statuses as $sync_status => $sync_status_value ) { $human_readable_sync_status[ $sync_status ] = in_array( $sync_status, array( 'started', 'queue_finished', 'send_started', 'finished' ), true ) - ? date( 'r', $sync_status_value ) : $sync_status_value; + ? gmdate( 'r', $sync_status_value ) : $sync_status_value; } $debug_info['full_sync'] = array( 'label' => 'Full Sync Status', @@ -323,8 +326,8 @@ class Jetpack_Debug_Data { * Must follow sync debug since it depends on sync functionality. */ $idc_urls = array( - 'home' => Functions::home_url(), - 'siteurl' => Functions::site_url(), + 'home' => Urls::home_url(), + 'siteurl' => Urls::site_url(), 'WP_HOME' => Constants::is_defined( 'WP_HOME' ) ? Constants::get_constant( 'WP_HOME' ) : '', 'WP_SITEURL' => Constants::is_defined( 'WP_SITEURL' ) ? Constants::get_constant( 'WP_SITEURL' ) : '', ); @@ -341,7 +344,7 @@ class Jetpack_Debug_Data { ); $debug_info['idc_optin'] = array( 'label' => 'IDC Opt-in', - 'value' => Jetpack::sync_idc_optin(), + 'value' => Identity_Crisis::should_handle_idc(), 'private' => false, ); @@ -392,6 +395,6 @@ class Jetpack_Debug_Data { private static function human_readable_user( $user ) { $user = new WP_User( $user ); - return sprintf( '#%1$d %2$s (%3$s)', $user->ID, $user->user_login, $user->user_email ); // Format: "#1 username (user@example.com)". + return sprintf( '#%1$d %2$s', $user->ID, $user->user_login ); // Format: "#1 username". } } |