mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Merge branch 'trunk' into PCP-991-detach-vaulting-from-wc-subscriptions-support
This commit is contained in:
commit
e1d84af7f0
1 changed files with 38 additions and 0 deletions
38
.ddev/commands/web/wp-cleanup
Executable file
38
.ddev/commands/web/wp-cleanup
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
show-help() {
|
||||
echo -e "\nDelete all posts -p [post type]"
|
||||
echo -e "\tExample: ddev wp-cleanup -p shop_order,product"
|
||||
echo -e "\nDelete all logs -l [wp-content path]"
|
||||
echo -e "\tExample: ddev wp-cleanup -l uploads/wc-logs\n"
|
||||
}
|
||||
|
||||
delete-posts() {
|
||||
for post in $(wp post list --post_type=$1 --format=ids --path=.ddev/wordpress); do
|
||||
wp post delete $post --force --path=.ddev/wordpress
|
||||
done
|
||||
}
|
||||
|
||||
delete-logs() {
|
||||
rm .ddev/wordpress/wp-content/$1/*.log
|
||||
}
|
||||
|
||||
declare -i param_counter=0
|
||||
|
||||
while getopts "p:l:h" arg; do
|
||||
case $arg in
|
||||
p)
|
||||
delete-posts $OPTARG
|
||||
param_counter+=1
|
||||
;;
|
||||
l)
|
||||
delete-logs $OPTARG
|
||||
param_counter+=1
|
||||
;;
|
||||
h) show-help ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $param_counter -eq 0 ]; then
|
||||
show-help
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue