Skip to content

Commit

Permalink
Merge pull request #100 from wp-cli/fix/wpcs-3.0-issues
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Aug 30, 2023
2 parents 3de548b + 0138185 commit bc7e4bd
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"wp-cli/entity-command": "^1.3 || ^2",
"wp-cli/eval-command": "^2.0",
"wp-cli/server-command": "^2.0",
"wp-cli/wp-cli-tests": "^3.1"
"wp-cli/wp-cli-tests": "^4"
},
"config": {
"process-timeout": 7200,
Expand Down
2 changes: 1 addition & 1 deletion cron-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
return;
}

$wpcli_cron_autoloader = dirname( __FILE__ ) . '/vendor/autoload.php';
$wpcli_cron_autoloader = __DIR__ . '/vendor/autoload.php';
if ( file_exists( $wpcli_cron_autoloader ) ) {
require_once $wpcli_cron_autoloader;
}
Expand Down
3 changes: 0 additions & 3 deletions src/Cron_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public function test() {
} else {
WP_CLI::error( sprintf( 'WP-Cron spawn returned HTTP status code: %1$s %2$s', $code, $message ) );
}

}

/**
Expand Down Expand Up @@ -89,7 +88,5 @@ protected static function get_cron_spawn() {
$result = wp_remote_post( $cron_request['url'], $cron_request['args'] );

return $result;

}

}
11 changes: 2 additions & 9 deletions src/Cron_Event_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public function list_( $args, $assoc_args ) {
} else {
$formatter->display_items( $events );
}

}

/**
Expand Down Expand Up @@ -196,7 +195,6 @@ public function schedule( $args, $assoc_args ) {
} else {
WP_CLI::error( 'Event not scheduled.' );
}

}

/**
Expand Down Expand Up @@ -285,7 +283,7 @@ function ( $event ) use ( $args, $exclude ) {
$start = microtime( true );
$result = self::run_event( $event );
$total = round( microtime( true ) - $start, 3 );
$executed++;
++$executed;
WP_CLI::log( sprintf( "Executed the cron event '%s' in %ss.", $event->hook, $total ) );
}

Expand Down Expand Up @@ -337,7 +335,6 @@ public function unschedule( $args, $assoc_args ) {
)
);
}

}

/**
Expand All @@ -364,7 +361,6 @@ protected static function run_event( stdClass $event ) {
do_action_ref_array( $event->hook, $event->args );

return true;

}

/**
Expand Down Expand Up @@ -395,7 +391,7 @@ public function delete( $args, $assoc_args ) {
if ( $event->hook === $hook ) {
$result = self::delete_event( $event );
if ( $result ) {
$deleted++;
++$deleted;
} else {
WP_CLI::warning( sprintf( "Failed to the delete the cron event '%s'.", $hook ) );
}
Expand All @@ -408,7 +404,6 @@ public function delete( $args, $assoc_args ) {
} else {
WP_CLI::error( sprintf( "Invalid cron event '%s'.", $hook ) );
}

}

/**
Expand Down Expand Up @@ -495,7 +490,6 @@ protected static function get_cron_events( $is_due_now = false ) {
$events = array_map( 'Cron_Event_Command::format_event', $events );

return $events;

}

/**
Expand Down Expand Up @@ -562,5 +556,4 @@ private static function interval( $since ) {
private function get_formatter( &$assoc_args ) {
return new \WP_CLI\Formatter( $assoc_args, $this->fields, 'event' );
}

}
2 changes: 0 additions & 2 deletions src/Cron_Schedule_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public function list_( $args, $assoc_args ) {
} else {
$formatter->display_items( $schedules );
}

}

/**
Expand Down Expand Up @@ -124,5 +123,4 @@ protected static function sort( array $a, array $b ) {
private function get_formatter( &$assoc_args ) {
return new \WP_CLI\Formatter( $assoc_args, $this->fields, 'schedule' );
}

}

0 comments on commit bc7e4bd

Please sign in to comment.