Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @since n.e.x.t
*/

use WordPress\Plugin_Check\Checker\CLI_Runner;
use WordPress\Plugin_Check\Plugin_Context;
use WordPress\Plugin_Check\CLI\Plugin_Check_Command;

Expand Down Expand Up @@ -44,15 +45,7 @@
WP_CLI::add_hook(
'before_wp_load',
function() {
if ( empty( $_SERVER['argv'] ) || 3 > count( $_SERVER['argv'] ) ) {
return;
}

if (
'wp' === substr( $_SERVER['argv'][0], -2 ) &&
'plugin' === $_SERVER['argv'][1] &&
'check' === $_SERVER['argv'][2]
) {
if ( CLI_Runner::is_plugin_check() ) {
if ( ! file_exists( ABSPATH . 'wp-content/object-cache.php' ) ) {
if ( ! copy( __DIR__ . '/object-cache.copy.php', ABSPATH . 'wp-content/object-cache.php' ) ) {
WP_CLI::error( 'Unable to copy object-cache.php file.' );
Expand Down
2 changes: 1 addition & 1 deletion includes/Checker/AJAX_Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AJAX_Runner extends Abstract_Check_Runner {
*
* @return bool Returns true if is an AJAX request for the plugin check else false.
*/
public function is_plugin_check() {
public static function is_plugin_check() {
if ( ! wp_doing_ajax() ) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/Checker/Abstract_Check_Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ abstract class Abstract_Check_Runner implements Check_Runner {
*
* @return bool Returns true if the check is for plugin else false.
*/
abstract public function is_plugin_check();
abstract public static function is_plugin_check();

/**
* Returns the plugin parameter based on the request.
Expand Down
2 changes: 1 addition & 1 deletion includes/Checker/CLI_Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CLI_Runner extends Abstract_Check_Runner {
*
* @return bool Returns true if is an CLI request for the plugin check else false.
*/
public function is_plugin_check() {
public static function is_plugin_check() {
if ( empty( $_SERVER['argv'] ) || 3 > count( $_SERVER['argv'] ) ) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/Checker/Check_Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface Check_Runner {
*
* @return boolean Returns true if the check is for plugin else false.
*/
public function is_plugin_check();
public static function is_plugin_check();

/**
* Prepares the environment for running the requested checks.
Expand Down