sh 从WP引擎下载站点(数据库,主题,插件,上传文件夹),然后压缩。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 从WP引擎下载站点(数据库,主题,插件,上传文件夹),然后压缩。相关的知识,希望对你有一定的参考价值。
#!/bin/sh
# Requirement:
# Create a keychain entry with an account name of "wpe-sftp" & set the pw
#
# Usage:
# sh download-wpe-site.sh install_name
# sh download-wpe-site.sh gz2015
# http://hints.macworld.com/article.php?story=20130722033452283
# http://blog.macromates.com/2006/keychain-access-from-shell/
get_keychain_pw () {
keychain_pw_account="wpe-sftp"
security 2>&1 >/dev/null find-generic-password -ga $keychain_pw_account \
| ruby -e 'print $1 if STDIN.gets =~ /^password: "(.*)"$/'
}
SFTP_USER=$1
SFTP_PASS=get_keychain_pw
SFTP_HOST="${SFTP_USER}.wpengine.com"
USER_FOLDER=`whoami`
LOCAL_FOLDER="/Users/$USER_FOLDER/Downloads/migrations/${SFTP_USER}.wpengine.com"
LFTP_OPTIONS="open sftp://${SFTP_HOST}:2222
user ${SFTP_USER} ${SFTP_PASS}
set sftp:auto-confirm yes
set net:reconnect-interval-base 9
set net:reconnect-interval-max 9
set cache:enable
set mirror:use-pget-n 10
set net:max-retries 2
"
mkdir -p $LOCAL_FOLDER
echo '=== Downloading ===\n'
echo "--- Downloading database"
lftp -e "get /wp-content/mysql.sql -o $LOCAL_FOLDER/mysql.sql; bye" -u $SFTP_USER,$SFTP_PASS sftp://$SFTP_HOST -p 2222
echo "--- Downloading themes"
lftp -c "$LFTP_OPTIONS mirror --verbose /wp-content/themes $LOCAL_FOLDER/themes"
echo "-- Downloading plugins"
lftp -c "$LFTP_OPTIONS mirror --verbose /wp-content/plugins $LOCAL_FOLDER/plugins"
echo "-- Downloading content"
lftp -c "$LFTP_OPTIONS mirror --verbose /wp-content/uploads $LOCAL_FOLDER/uploads"
echo '=== Zipping up ===\n'
zip -r ${SFTP_HOST}.zip $LOCAL_FOLDER
以上是关于sh 从WP引擎下载站点(数据库,主题,插件,上传文件夹),然后压缩。的主要内容,如果未能解决你的问题,请参考以下文章
sh 终端命令通过WP CLI压缩插件/主题发布和安装
sh 本地化WordPress主题和插件(https://github.com/Phoenix2k/wp-theme-localization)
将 wordpress 站点从一个本地主机转移到另一个本地主机
wordpress上传主题出错
Wordpress 数据库和 WP 迁移
wordpress上传主题以及安装插件 出现ftp的问题解决方案