Using v-wp-cli in v-change-wordpress-admin-passwords

This commit is contained in:
Peca 2025-06-22 23:53:53 +02:00
parent fd6eb44bae
commit d37473b5e8
2 changed files with 3 additions and 13 deletions

View file

@ -5,6 +5,7 @@
# d → delete user (with content reassignment)
# c → change password (random 10-char alnum)
# s → skip
# x → exit
#----------------------------------------------------------#
# Variable & Function #
@ -22,19 +23,8 @@ USER="$(/usr/local/vesta/bin/v-search-domain-owner "$DOMAIN")"
WP_PATH="/home/$USER/web/$DOMAIN/public_html"
[ ! -f "$WP_PATH/wp-config.php" ] && { echo "WordPress is not installed on this domain."; exit 1; }
# ensure WP-CLI binary
if ! command -v wp >/dev/null 2>&1; then
echo "WP-CLI is not installed, installing..."
wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/local/bin/wp
chmod +x /usr/local/bin/wp
fi
PHPVER=$(/usr/local/vesta/bin/v-get-php-version-of-domain "$DOMAIN")
PHP_BIN=$(command -v "php$PHPVER" 2>/dev/null || command -v php)
[ -z "$PHP_BIN" ] && { echo "Could not find a PHP binary."; exit 1; }
# WP-CLI wrapper
WP_RUN=(sudo -u "$USER" "$PHP_BIN" /usr/local/bin/wp --skip-plugins --skip-themes)
WP_RUN=(/usr/local/vesta/bin/v-run-wp-cli $DOMAIN --skip-plugins --skip-themes)
# random 10-char password
gen_pass() { tr -dc 'A-Za-z0-9' </dev/urandom | head -c 10; }

View file

@ -30,7 +30,7 @@ fi
# absolute paths to maintenance scripts, in desired order
declare -a tasks=(
"/usr/local/vesta/bin/v-change-database-password-for-wordpress"
"/usr/local/vesta/bin/v-change-wordpress-admins-pass"
"/usr/local/vesta/bin/v-change-wordpress-admin-passwords"
"/usr/local/vesta/bin/v-fix-wordpress-core"
"/usr/local/vesta/bin/v-wf-malware-hyperscan-with-remediate"
"INTERACTIVE=1 /usr/local/vesta/bin/v-wf-malware-hyperscan-with-remediate"