From 5d57632743d676d750bef7d2d6f2308a63a41cc4 Mon Sep 17 00:00:00 2001 From: Peter Wise Date: Tue, 11 Jul 2023 10:14:13 -0400 Subject: [PATCH 1/3] improve documentation for core is-installed command --- src/Core_Command.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Core_Command.php b/src/Core_Command.php index 045ca3b1..466d4d4d 100644 --- a/src/Core_Command.php +++ b/src/Core_Command.php @@ -348,15 +348,23 @@ function () use ( $temp ) { * * ## EXAMPLES * - * # Check whether WordPress is installed; exit status 0 if installed, otherwise 1 - * $ wp core is-installed - * $ echo $? - * 1 + * # Bash script for checking if WordPress is not installed * - * # Bash script for checking whether WordPress is installed or not - * if ! wp core is-installed; then + * if ! wp core is-installed 2>/dev/null; then + * # WP is not installed. Let's try installing it. * wp core install * fi + * + * # Bash script for checking if WordPress is installed, with fallback + * + * if wp core is-installed 2>/dev/null; then + * # WP is installed. Let's do some things we should only do in a confirmed WP environment. + * wp core verify-checksums + * else + * # Fallback if WP is not installed. + * echo 'Hey Friend, you are in the wrong spot. Move in to your WordPress directory and try again.' + * fi + * * @subcommand is-installed */ From c7668414f1462ccebb63b7eda7eb4431a0da8749 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Tue, 11 Jul 2023 12:20:54 -0700 Subject: [PATCH 2/3] Regenerate README --- README.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 224105c2..ead932b4 100644 --- a/README.md +++ b/README.md @@ -207,16 +207,23 @@ to communicate whether WordPress is installed. **EXAMPLES** - # Check whether WordPress is installed; exit status 0 if installed, otherwise 1 - $ wp core is-installed - $ echo $? - 1 + # Bash script for checking if WordPress is not installed - # Bash script for checking whether WordPress is installed or not - if ! wp core is-installed; then + if ! wp core is-installed 2>/dev/null; then + # WP is not installed. Let's try installing it. wp core install fi + # Bash script for checking if WordPress is installed, with fallback + + if wp core is-installed 2>/dev/null; then + # WP is installed. Let's do some things we should only do in a confirmed WP environment. + wp core verify-checksums + else + # Fallback if WP is not installed. + echo 'Hey Friend, you are in the wrong spot. Move in to your WordPress directory and try again.' + fi + ### wp core multisite-convert From 8bde5ef138af9c71954bab6c9ea15576b119ca54 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Tue, 11 Jul 2023 12:22:56 -0700 Subject: [PATCH 3/3] Fix PHPCS issues --- src/Core_Command.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core_Command.php b/src/Core_Command.php index 466d4d4d..7f3a7560 100644 --- a/src/Core_Command.php +++ b/src/Core_Command.php @@ -358,7 +358,7 @@ function () use ( $temp ) { * # Bash script for checking if WordPress is installed, with fallback * * if wp core is-installed 2>/dev/null; then - * # WP is installed. Let's do some things we should only do in a confirmed WP environment. + * # WP is installed. Let's do some things we should only do in a confirmed WP environment. * wp core verify-checksums * else * # Fallback if WP is not installed.