mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
v-change-wordpress-admin-passwords: add option to skip content reassignment during user deletion
This commit is contained in:
parent
9eade5a7df
commit
f64968ba91
1 changed files with 10 additions and 1 deletions
|
@ -81,6 +81,7 @@ while IFS=',' read -r ID LOGIN EMAIL; do
|
|||
while true; do
|
||||
echo "-------------------------------------"
|
||||
read -r -p "Action for \"$TARGET\" [d/c/s/x]? " ACT < /dev/tty
|
||||
skip=0;
|
||||
case "$ACT" in
|
||||
[Dd]* )
|
||||
# read -r -p "Really DELETE \"$TARGET\" ? (y/n, default: y) " CONF < /dev/tty
|
||||
|
@ -97,17 +98,25 @@ while IFS=',' read -r ID LOGIN EMAIL; do
|
|||
fi
|
||||
echo "Available admin usernames for reassignment: ${OTHER_USERS[*]}"
|
||||
while true; do
|
||||
read -r -p "Reassign content to which username? [default: $DEFAULT_USER] " REASSIGN < /dev/tty
|
||||
read -r -p "Reassign content to which username? [default: $DEFAULT_USER, s: skip] " REASSIGN < /dev/tty
|
||||
REASSIGN=${REASSIGN:-$DEFAULT_USER}
|
||||
DEFAULT_USER=$REASSIGN
|
||||
if printf '%s\n' "${OTHER_USERS[@]}" | grep -qx "$REASSIGN"; then
|
||||
break
|
||||
fi
|
||||
if [[ "$REASSIGN" =~ ^[Ss]$ ]]; then
|
||||
echo "Skipping reassignment."
|
||||
skip=1;
|
||||
break
|
||||
fi
|
||||
if [[ "$REASSIGN" =~ ^[0-9]+$ ]]; then
|
||||
break
|
||||
fi
|
||||
echo "Invalid username. Please choose one of: ${OTHER_USERS[*]}"
|
||||
done
|
||||
if [ $skip -eq 1 ]; then
|
||||
break
|
||||
fi
|
||||
# delete by username, reassign by username
|
||||
RUN="$WP_RUN user delete $ID --reassign=$REASSIGN --yes --skip-plugins --skip-themes"
|
||||
eval "$RUN"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue