我创建了一个bash脚本,以使用subversion更新Wordpressrecommend.
#!/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\\u wordpress\\u database\\u和用户。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/ .