Add .ddev commands
This commit is contained in:
parent
9359e764d8
commit
71068e75af
2 changed files with 45 additions and 0 deletions
8
.ddev/host/qimport-db
Executable file
8
.ddev/host/qimport-db
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
## Description: Imports the last file you downloaded
|
||||
## Usage: qimport-db
|
||||
## Example: "ddev qimport-db"
|
||||
## OSTypes: darwin,linux
|
||||
|
||||
ddev import-db "--src=~/Downloads/$(ls -1t ~/Downloads | head -n 1)"
|
37
.ddev/web/wp-userrs
Executable file
37
.ddev/web/wp-userrs
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
## Description: Resets the password of all users using WP-Cli
|
||||
## Usage: wp-userrs
|
||||
## Example: "ddev wp-userrs"
|
||||
|
||||
WP_PATH=$(realpath $PWD/$DDEV_DOCROOT)
|
||||
WP_SITES=$(wp site list --quiet --path=$WP_PATH)
|
||||
IS_SINGLE_SITE=$?
|
||||
|
||||
if [[ $IS_SINGLE_SITE -eq 1 ]]; then
|
||||
echo 'Is singlesite.'
|
||||
WP_USERS=$(wp user list --path=$WP_PATH --fields=user_login --format=csv | sed -e '1d')
|
||||
echo 'Wordpress users:'
|
||||
echo $WP_USERS
|
||||
wp user update --path=$WP_PATH --user_pass=asdf1234 --skip-email $WP_USERS
|
||||
fi
|
||||
|
||||
if [[ $IS_SINGLE_SITE -eq 0 ]]; then
|
||||
echo 'Is multisite.'
|
||||
echo $WP_SITES
|
||||
for WP_SITE in $WP_SITES; do
|
||||
WP_USERS=$(wp user list --path=$WP_PATH --url="$WP_SITE" --fields=user_login --format=csv | sed -e '1d')
|
||||
echo 'Wordpress users:'
|
||||
echo $WP_USERS
|
||||
wp user update --path=$WP_PATH --url="$WP_SITE" --user_pass=asdf1234 --skip-email $WP_USERS
|
||||
done
|
||||
fi
|
||||
|
||||
#for WORDPRESS_URL in $(wp site list --field=url); do
|
||||
# # WORDPRESS_USERS=$(wp user list --path=$WORDPRESS_PATH --url='$WORDPRESS_URL' --fields=user_login --format=csv 2>/dev/null | sed -e '/eval/d;/^$/d;' | sed -e '1d')
|
||||
# echo === Site ===
|
||||
# echo $WORDPRESS_URL
|
||||
# echo === Users ===
|
||||
# wp user list --url=$WORDPRESS_URL --fields=user_login --format=csv 2>/dev/null | sed -e '/eval/d;/^$/d;' | sed -e '1d'
|
||||
# # echo $WORDPRESS_USERS
|
||||
#done
|
Loading…
Reference in a new issue