나는 그들이 추천 한대로 subversion을 사용하여 Wordpress를 업데이트하기위한 bash 스크립트를 만들었다 .
#!/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/ .