This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdomain-update.sh
executable file
·62 lines (52 loc) · 1.53 KB
/
domain-update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /bin/bash
#
# Update WordPress, Plugins & Themes
#
# @cmd domain update all
# @cmd domain update domainname.extension
#
# @version 1.0.0
#
# @author Chris Winters https://github.com/ChrisWinters
#
# MIT License
# https://raw.githubusercontent.com/ChrisWinters/wp-cli-localhost/master/LICENSE
# Run Updater
update() {
# Required
if [[ $1 == "" ]]; then
echo $0: "=domain=> usage example: domain update all"
echo $0: " domain update domainname.extension"
return 1
fi
# Source Config File
source domain-config.sh
# Required
if [[ $1 != "all" && ! -d ${SITE_PATH}/${1} ]]; then
echo $0: "=domain=> usage example: domain update all"
echo $0: " domain update domainname.extension"
return 1
fi
# Update All Domains
if [[ $1 == "all" ]]; then
printf "\n=domain=> Updating All Domains\n"
sleep 1
while read DOMAIN_NAME; do
printf "==> Updating: ${DOMAIN_NAME}\n"
wp core update --path=${SITE_PATH}/${DOMAIN_NAME}
wp plugin update --path=${SITE_PATH}/${DOMAIN_NAME} --all
wp theme update --path=${SITE_PATH}/${DOMAIN_NAME} --all
done < ${WP_CLI_LOCALHOST_PATH}/domains.log
printf "\n=domain=> Update Completed\n\n"
fi
# Update Single Domain
if [[ $1 != "" && -d ${SITE_PATH}/${1} ]]; then
printf "=domain=> Updating ${1}\n"
sleep 1
wp core update --path=${SITE_PATH}/${1}
wp plugin update --path=${SITE_PATH}/${1} --all
wp theme update --path=${SITE_PATH}/${1} --all
printf "\n=domain=> Update Completed\n\n"
fi
}
update $@