mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 13:01:52 -07:00
v-change-wordpress-admin-passwords: accept integer as id of user, support for custom php version
This commit is contained in:
parent
d20bc94866
commit
54abc58c4e
1 changed files with 10 additions and 3 deletions
|
@ -24,7 +24,12 @@ WP_PATH="/home/$USER/web/$DOMAIN/public_html"
|
||||||
[ ! -f "$WP_PATH/wp-config.php" ] && { echo "WordPress is not installed on this domain."; exit 1; }
|
[ ! -f "$WP_PATH/wp-config.php" ] && { echo "WordPress is not installed on this domain."; exit 1; }
|
||||||
|
|
||||||
# WP-CLI wrapper
|
# WP-CLI wrapper
|
||||||
WP_RUN=(/usr/local/vesta/bin/v-run-wp-cli $DOMAIN --skip-plugins --skip-themes)
|
if [ ! -z "$PHP" ]; then
|
||||||
|
WP_RUN=(PHP=$PHP /usr/local/vesta/bin/v-run-wp-cli $DOMAIN --skip-plugins --skip-themes)
|
||||||
|
else
|
||||||
|
WP_RUN=(/usr/local/vesta/bin/v-run-wp-cli $DOMAIN --skip-plugins --skip-themes)
|
||||||
|
fi
|
||||||
|
|
||||||
return_code=$?
|
return_code=$?
|
||||||
|
|
||||||
if [ $return_code -ne 0 ]; then
|
if [ $return_code -ne 0 ]; then
|
||||||
|
@ -86,9 +91,11 @@ while IFS=',' read -r ID LOGIN EMAIL; do
|
||||||
REASSIGN=${REASSIGN:-$DEFAULT_USER}
|
REASSIGN=${REASSIGN:-$DEFAULT_USER}
|
||||||
if printf '%s\n' "${OTHER_USERS[@]}" | grep -qx "$REASSIGN"; then
|
if printf '%s\n' "${OTHER_USERS[@]}" | grep -qx "$REASSIGN"; then
|
||||||
break
|
break
|
||||||
else
|
|
||||||
echo "Invalid username. Please choose one of: ${OTHER_USERS[*]}"
|
|
||||||
fi
|
fi
|
||||||
|
if [[ "$REASSIGN" =~ ^[0-9]+$ ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo "Invalid username. Please choose one of: ${OTHER_USERS[*]}"
|
||||||
done
|
done
|
||||||
# delete by username, reassign by username
|
# delete by username, reassign by username
|
||||||
"${WP_RUN[@]}" user delete "$LOGIN" --reassign="$REASSIGN" --yes --skip-plugins --skip-themes
|
"${WP_RUN[@]}" user delete "$LOGIN" --reassign="$REASSIGN" --yes --skip-plugins --skip-themes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue