Skip to content

Commit

Permalink
Various: Ensure WP CLI is defined before extending (#23207)
Browse files Browse the repository at this point in the history
* Ensure there is a check before extending a WP CLI class
  • Loading branch information
kraftbj authored Mar 2, 2022
1 parent c698649 commit a6b7c0b
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 2 deletions.
4 changes: 4 additions & 0 deletions projects/packages/search/changelog/update-cli-classes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Ensure that WP CLI is present before extending the class.
2 changes: 1 addition & 1 deletion projects/packages/search/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jetpack-search",
"version": "0.10.0",
"version": "0.10.1-alpha",
"description": "Package for Jetpack Search products",
"main": "main.js",
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/search/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Automattic\Jetpack\Search;

define( 'JETPACK_SEARCH_PKG__VERSION', '0.10.0' );
define( 'JETPACK_SEARCH_PKG__VERSION', '0.10.1-alpha' );
define( 'JETPACK_SEARCH_PKG__DIR', __DIR__ . '/' );
define( 'JETPACK_SEARCH_PKG__SLUG', 'search' );

Expand Down
4 changes: 4 additions & 0 deletions projects/packages/search/src/class-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
use \WP_CLI_Command;
use \WP_Error;

if ( ! class_exists( 'WP_CLI_Command' ) ) {
return;
}

/**
* Provide functionality by WPCLI.
*/
Expand Down
4 changes: 4 additions & 0 deletions projects/plugins/beta/changelog/update-cli-classes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Ensure that WP CLI is present before extending the class.
4 changes: 4 additions & 0 deletions projects/plugins/beta/src/class-clicommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
use WP_CLI;
use WP_CLI_Command;

if ( ! class_exists( 'WP_CLI_Command' ) ) {
return;
}

/**
* Control your local Jetpack Beta Tester plugin.
*/
Expand Down
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/update-cli-classes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: compat

Ensure WP CLI is present before extending the class.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/class.jetpack-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
use Automattic\Jetpack\Sync\Queue;
use Automattic\Jetpack\Sync\Settings;

if ( ! class_exists( 'WP_CLI_Command' ) ) {
return;
}

WP_CLI::add_command( 'jetpack', 'Jetpack_CLI' );

/**
Expand Down

0 comments on commit a6b7c0b

Please sign in to comment.