Skip to content

Commit 169625a

Browse files
Improve documentation for core is-installed command (#237)
* improve documentation for core is-installed command * Regenerate README * Fix PHPCS issues --------- Co-authored-by: Daniel Bachhuber <[email protected]>
1 parent 893e18d commit 169625a

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,23 @@ to communicate whether WordPress is installed.
207207

208208
**EXAMPLES**
209209

210-
# Check whether WordPress is installed; exit status 0 if installed, otherwise 1
211-
$ wp core is-installed
212-
$ echo $?
213-
1
210+
# Bash script for checking if WordPress is not installed
214211

215-
# Bash script for checking whether WordPress is installed or not
216-
if ! wp core is-installed; then
212+
if ! wp core is-installed 2>/dev/null; then
213+
# WP is not installed. Let's try installing it.
217214
wp core install
218215
fi
219216

217+
# Bash script for checking if WordPress is installed, with fallback
218+
219+
if wp core is-installed 2>/dev/null; then
220+
# WP is installed. Let's do some things we should only do in a confirmed WP environment.
221+
wp core verify-checksums
222+
else
223+
# Fallback if WP is not installed.
224+
echo 'Hey Friend, you are in the wrong spot. Move in to your WordPress directory and try again.'
225+
fi
226+
220227

221228

222229
### wp core multisite-convert

src/Core_Command.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,23 @@ function () use ( $temp ) {
348348
*
349349
* ## EXAMPLES
350350
*
351-
* # Check whether WordPress is installed; exit status 0 if installed, otherwise 1
352-
* $ wp core is-installed
353-
* $ echo $?
354-
* 1
351+
* # Bash script for checking if WordPress is not installed
355352
*
356-
* # Bash script for checking whether WordPress is installed or not
357-
* if ! wp core is-installed; then
353+
* if ! wp core is-installed 2>/dev/null; then
354+
* # WP is not installed. Let's try installing it.
358355
* wp core install
359356
* fi
357+
*
358+
* # Bash script for checking if WordPress is installed, with fallback
359+
*
360+
* if wp core is-installed 2>/dev/null; then
361+
* # WP is installed. Let's do some things we should only do in a confirmed WP environment.
362+
* wp core verify-checksums
363+
* else
364+
* # Fallback if WP is not installed.
365+
* echo 'Hey Friend, you are in the wrong spot. Move in to your WordPress directory and try again.'
366+
* fi
367+
360368
*
361369
* @subcommand is-installed
362370
*/

0 commit comments

Comments
 (0)