Replaced deprecated is_staging_site call.

...and added Jetpack\Status package.
This commit is contained in:
Peter Fabian 2020-02-13 20:16:32 +01:00
parent 33e6aee1af
commit 19c32c4fca
3 changed files with 55 additions and 13 deletions

View File

@ -10,6 +10,7 @@
"php": ">=5.6|>=7.0",
"automattic/jetpack-autoloader": "^1.2.0",
"automattic/jetpack-constants": "^1.1",
"automattic/jetpack-status": "^1.1.1",
"composer/installers": "1.7.0",
"maxmind-db/reader": "1.6.0",
"pelago/emogrifier": "^3.1",

56
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c674cf272eafa6cfdb1bf5d82004c974",
"content-hash": "580681dcf68ec92314065d6ee8f18fda",
"packages": [
{
"name": "automattic/jetpack-autoloader",
@ -72,6 +72,38 @@
"description": "A wrapper for defining constants in a more testable way.",
"time": "2019-11-08T21:16:05+00:00"
},
{
"name": "automattic/jetpack-status",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/Automattic/jetpack-status.git",
"reference": "c688b03859381e66164c821971e851408a5e232a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Automattic/jetpack-status/zipball/c688b03859381e66164c821971e851408a5e232a",
"reference": "c688b03859381e66164c821971e851408a5e232a",
"shasum": ""
},
"require-dev": {
"brain/monkey": "2.4.0",
"php-mock/php-mock": "^2.1",
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-or-later"
],
"description": "Used to retrieve information about the current status of Jetpack and the site overall.",
"time": "2020-01-27T11:04:11+00:00"
},
{
"name": "composer/installers",
"version": "v1.7.0",
@ -2509,16 +2541,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.13.1",
"version": "v1.14.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3"
"reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38",
"reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38",
"shasum": ""
},
"require": {
@ -2530,7 +2562,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
"dev-master": "1.14-dev"
}
},
"autoload": {
@ -2563,7 +2595,7 @@
"polyfill",
"portable"
],
"time": "2019-11-27T13:56:44+00:00"
"time": "2020-01-13T11:15:53+00:00"
},
{
"name": "theseer/tokenizer",
@ -2695,16 +2727,16 @@
},
{
"name": "wp-cli/i18n-command",
"version": "v2.2.1",
"version": "v2.2.2",
"source": {
"type": "git",
"url": "https://github.com/wp-cli/i18n-command.git",
"reference": "6a0582103ecf4a28b3086eac55a9fe590bd3dc96"
"reference": "2804c5246d9338da59951737b03c54d257be8e47"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/6a0582103ecf4a28b3086eac55a9fe590bd3dc96",
"reference": "6a0582103ecf4a28b3086eac55a9fe590bd3dc96",
"url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/2804c5246d9338da59951737b03c54d257be8e47",
"reference": "2804c5246d9338da59951737b03c54d257be8e47",
"shasum": ""
},
"require": {
@ -2748,7 +2780,7 @@
],
"description": "Provides internationalization tools for WordPress projects.",
"homepage": "https://github.com/wp-cli/i18n-command",
"time": "2019-11-12T06:57:35+00:00"
"time": "2019-12-13T09:00:43+00:00"
},
{
"name": "wp-cli/mustangostang-spyc",

View File

@ -11,6 +11,7 @@
*/
use Automattic\Jetpack\Constants;
use Automattic\Jetpack\Status;
defined( 'ABSPATH' ) || exit;
@ -111,9 +112,17 @@ class WC_Tracker {
$data['inactive_plugins'] = $all_plugins['inactive_plugins'];
// Jetpack & WooCommerce Connect.
$is_jp_staging = false;
if ( class_exists( '\Automattic\Jetpack\Status' ) ) {
$jp_status = new Status();
if ( is_callable( '$jp_status->is_staging_site()' ) && $jp_status->is_staging_site() ) {
$is_jp_staging = true;
}
}
$data['jetpack_version'] = Constants::is_defined( 'JETPACK__VERSION' ) ? Constants::get_constant( 'JETPACK__VERSION' ) : 'none';
$data['jetpack_connected'] = ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_active' ) && Jetpack::is_active() ) ? 'yes' : 'no';
$data['jetpack_is_staging'] = ( class_exists( 'Jetpack' ) && is_callable( 'Jetpack::is_staging_site' ) && Jetpack::is_staging_site() ) ? 'yes' : 'no';
$data['jetpack_is_staging'] = $is_jp_staging ? 'yes' : 'no';
$data['connect_installed'] = class_exists( 'WC_Connect_Loader' ) ? 'yes' : 'no';
$data['connect_active'] = ( class_exists( 'WC_Connect_Loader' ) && wp_next_scheduled( 'wc_connect_fetch_service_schemas' ) ) ? 'yes' : 'no';
$data['helper_connected'] = self::get_helper_connected();