Skip to content

Commit 1d8fcbc

Browse files
authored
add alias to wp-cli to the user's .bashrc and fix error handling. (hestiacp#3569)
1 parent 3bd0589 commit 1d8fcbc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bin/v-add-user-wp-cli

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ check_hestia_demo_mode
4343
WPCLI_DIR="/home/$user/.wp-cli"
4444
WPCLI_BIN="$WPCLI_DIR/wp"
4545

46-
if [ -f "$WPCLI_DIR" ]; then
47-
echo "WP-CLI already available"
46+
if [ -f "$WPCLI_BIN" ]; then
47+
check_result "$E_EXISTS" "For user name '$user' WP-CLI already available!"
4848
exit
4949
fi
5050

@@ -56,6 +56,7 @@ chown $user:$user "$WPCLI_DIR"
5656

5757
user_exec wget --tries=3 --timeout=15 --read-timeout=15 --waitretry=3 --no-dns-cache --quiet -O "$WPCLI_BIN" https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
5858
user_exec chmod +x "$WPCLI_BIN"
59+
user_exec echo -e "#add wp-cli alias for user\nalias wp='php $WPCLI_BIN'" >> ~/.bashrc
5960

6061
#----------------------------------------------------------#
6162
# Hestia #

0 commit comments

Comments
 (0)