-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwordpress-cli-update.sh
More file actions
41 lines (35 loc) · 1.26 KB
/
wordpress-cli-update.sh
File metadata and controls
41 lines (35 loc) · 1.26 KB
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
#!/bin/csh
/usr/local/bin/wp cli check-update --allow-root --patch --quiet
# csh version bellow
if ( $status == 1 ) then
echo "Има налична нова версия на WP-CLI!"
/usr/local/bin/wp cli update --allow-root --yes --nightly
else
echo "WP-CLI е актуален."
endif
set sites = ( \
"/usr/local/www/ostreff.info/" \
)
set wp_cli = "sudo -u nobody -g nobody -- /usr/local/bin/wp"
foreach site ($sites)
if ( -d "$site" ) then
set site_url = `$wp_cli option get home --path=$site`
echo "--- Updating site: $site_url ---"
set update_output = `$wp_cli core update --path="$site"`
echo "$update_output"
echo "$update_output" | grep -q "is up to date"
if ( $status != 0 ) then
echo "Core updated, running database update..."
$wp_cli core update-db --path="$site"
endif
$wp_cli plugin update --all --path="$site"
$wp_cli theme update --all --path="$site"
$wp_cli language core update --path="$site"
$wp_cli language plugin update --all --path="$site"
$wp_cli language theme update --all --path="$site"
echo "Done with $site_url"
echo ""
else
echo "Directory $site not found. Skipping..."
endif
end