我创建了一个bash脚本来按照他们的建议使用Subversion更新Wordpress 。
#!/bin/bash
# usage: upgrade_wordpress.sh X.X.X
# http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion
# http://stackoverflow.com/a/699613/327074
die () {
echo >&2 "$@"
exit 1
}
# check that there is one argument
[ "$#" -eq 1 ] || die "usage: upgrade_wordpress.sh X.X.X"
# http://stackoverflow.com/a/2220646/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 root -p wordpress > wordpress_upgrade_to_$1_bak.sql
# Updating to a New Stable Version
cd /path/to/wordpress/dir/
svn sw http://core.svn.wordpress.org/tags/$1/ .
我已经对此进行了修改以进行安装。第二个脚本未经测试,但可以帮助您入门。您将需要编写自己的create_wordpress_database_and_user.sql-但是无论如何您都没有要求输入该内容,因此也许可以忽略它。
#!/bin/bash
# usage: install_wordpress.sh X.X.X /path/to/wordpress/dir
# http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion
# http://stackoverflow.com/a/699613/327074
die () {
echo >&2 "$@"
exit 1
}
# check that there are two arguments
[ "$#" -eq 2 ] || die "usage: install_wordpress.sh X.X.X /path/to/wordpress/dir"
# http://stackoverflow.com/a/2220646/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 "Could not find Wordpress version, http error: $response"
# create directory if needed
if [ ! -d $2 ]; then
mkdir $2
fi
# Install the database
mysql -u root -p < create_wordpress_database_and_user.sql
# Checking out stable version
cd $2
svn co http://core.svn.wordpress.org/tags/$1/ .