-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupgrade-wp.sh
executable file
·62 lines (55 loc) · 1.05 KB
/
upgrade-wp.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
# WP dir
echo "==="
echo "Starting upgrade..."
echo "==="
cd /home/lhl/www/randomfoo.net/htdocs
# Backup
echo ""
echo "==="
echo "Backing up..."
echo "==="
tar cvfz ~/backup/wp.old.tgz wp
mysqldump wp | gzip > ~/backup/wp.sql.gz
# Newest version
echo ""
echo "==="
echo "Getting latest version of WP..."
echo "==="
wget http://wordpress.org/latest.tar.gz
tar xvfz latest.tar.gz
# Fixups
echo ""
echo "==="
echo "Importing wp-config and wp-content..."
echo "==="
rm -rf wordpress/wp-content
cp wp/.htaccess wordpress/.htaccess
cp wp/wp-config.php wordpress/wp-config.php
cp -a wp/wp-content wordpress/wp-content
# Swap
echo ""
echo "==="
echo "Swapping to new version!"
echo "==="
mv wp wp.old
mv wordpress wp
echo ""
echo "==="
echo -n "Test your new WP. Does it work (y/n): "
read works
if [ "$works" == "y" ]; then
echo ""
echo "==="
echo "Great! Cleaning up."
echo "==="
rm -rf wp.old
rm latest.tar.gz
else
mv wp wordpress
mv wp.old wp
echo ""
echo "==="
echo "Reverted folder move. Check to see what's wrong!"
echo "==="
fi