Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ianchanning
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianchanning/a4292ff1fe61621ea86f to your computer and use it in GitHub Desktop.
Save ianchanning/a4292ff1fe61621ea86f to your computer and use it in GitHub Desktop.
Upgrade a translated installation of WordPress-Skeleton
#!/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