Skip to content

Commit 0603224

Browse files
authored
Merge branch 'main' into phpunit-coverage-config
2 parents 99122ac + fb8ac18 commit 0603224

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

php/WP_CLI/Runner.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,14 @@ private static function guess_url( $assoc_args ) {
344344
return false;
345345
}
346346

347+
/**
348+
* Checks if the arguments passed to the WP-CLI binary start with the specified prefix.
349+
*
350+
* @param array $prefix An array of strings specifying the expected start of the arguments passed to the WP-CLI binary.
351+
* For example, `['user', 'list']` checks if the arguments passed to the WP-CLI binary start with `user list`.
352+
*
353+
* @return bool `true` if the arguments passed to the WP-CLI binary start with the specified prefix, `false` otherwise.
354+
*/
347355
private function cmd_starts_with( $prefix ) {
348356
return array_slice( $this->arguments, 0, count( $prefix ) ) === $prefix;
349357
}

php/class-wp-cli.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ public static function log( $message ) {
772772
/**
773773
* Display success message prefixed with "Success: ".
774774
*
775-
* Success message is written to STDOUT.
775+
* Success message is written to STDOUT, or discarded when `--quiet` flag is supplied.
776776
*
777777
* Typically recommended to inform user of successful script conclusion.
778778
*
@@ -852,7 +852,7 @@ public static function debug( $message, $group = false ) {
852852
/**
853853
* Display warning message prefixed with "Warning: ".
854854
*
855-
* Warning message is written to STDERR.
855+
* Warning message is written to STDERR, or discarded when `--quiet` flag is supplied.
856856
*
857857
* Use instead of `WP_CLI::debug()` when script execution should be permitted
858858
* to continue.

php/wp-cli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
// Set common headers, to prevent warnings from plugins.
2121
$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.0';
22-
$_SERVER['HTTP_USER_AGENT'] = '';
22+
$_SERVER['HTTP_USER_AGENT'] = ( ! empty( getenv( 'WP_CLI_USER_AGENT' ) ) ? getenv( 'WP_CLI_USER_AGENT' ) : 'WP CLI ' . WP_CLI_VERSION );
2323
$_SERVER['REQUEST_METHOD'] = 'GET';
2424
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
2525

0 commit comments

Comments
 (0)