mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 02:28:05 -07:00
v-change-database-password-for-wordpress: enhance database name and user retrieval to support both single and double quotes in wp-config.php
This commit is contained in:
parent
3801e8d6cf
commit
403dd65400
1 changed files with 6 additions and 0 deletions
|
@ -70,6 +70,12 @@ if [ -f "/home/$user/web/$domain/public_html/wp-config.php" ]; then
|
|||
fi
|
||||
db_name=$(grep "DB_NAME" $wp_config_path | grep -oP "define\s*\(\s*'DB_NAME'\s*,\s*'\K[^']+")
|
||||
db_user=$(grep "DB_USER" $wp_config_path | grep -oP "define\s*\(\s*'DB_USER'\s*,\s*'\K[^']+")
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(grep "DB_NAME" $wp_config_path | grep -oP "define\s*\(\s*'DB_NAME'\s*,\s*\"\K[^\"]+")
|
||||
fi
|
||||
if [ -z "$db_user" ]; then
|
||||
db_user=$(grep "DB_USER" $wp_config_path | grep -oP "define\s*\(\s*'DB_USER'\s*,\s*\"\K[^\"]+")
|
||||
fi
|
||||
new_password=''
|
||||
found_existing_password=0
|
||||
if [ -f "/root/remember-db-user-pass.txt" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue