Last active
August 29, 2015 14:01
-
-
Save ianchanning/a4292ff1fe61621ea86f to your computer and use it in GitHub Desktop.
Upgrade a translated installation of WordPress-Skeleton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: upgrade_wordpress.sh X.X.X | |
# This is for upgrading a translated version of WordPress whilst using WordPress-Skeleton | |
# https://github.com/markjaquith/WordPress-Skeleton | |
# https://core.trac.wordpress.org/ticket/27752 | |
# licence MIT | |
die () { | |
echo >&2 "$@" | |
exit 1 | |
} | |
# check that there is one argument | |
[ "$#" -eq 1 ] || die "usage: upgrade_wordpress.sh X.X.X" | |
# http://stackoverflow.com/q/2220301/327074 | |
response=$(curl --write-out %{http_code} --silent --output /dev/null http://core.svn.wordpress.org/tags/$1/) | |
# check that the tag repository exists, i.e. returns a HTTP 200 status code | |
[ "$response" -eq 200 ] || die "Couldn't find Wordpress version, http error: $response" | |
# Take a backup | |
mysqldump -u [database-user] -p[database-password] [database-name] > wordpress_upgrade_to_$1_bak.sql | |
# Updating to a New Stable Version | |
cd ~/path/to/wp/ | |
# This assumes we've edited wp-includes/version.php | |
# stash the changes, upgrade, then put them back | |
git stash | |
git fetch --tags | |
git checkout $1 | |
git stash apply |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment