代码拉取完成,页面将自动刷新
#!/bin/sh
#
# WP Test - WP-CLI Quick Install Script
# http://wptest.io/
#
# Note: This script assumes you have wp-cli installed.
#####################################################################################
# Check for flag usage.
# If more flags are added here, this could probably be simplified a bit better.
case "$1" in
"--allow-root")
ALLOWROOT=$1
;;
"")
ALLOWROOT=""
;;
*)
printf "Invalid flag provided. Allowed flags: --allow-root.\n"
exit
;;
esac
# Ask user where WordPress is installed.
printf "Please provide the local path to your WordPress install: "
read WPPATH
# Ask the user what data they want to import.
printf "Use a local xml file? [y/N]"
read USELOCAL
# Move to the WordPress installation location.
cd $WPPATH
# Include the WordPress importer
wp plugin install wordpress-importer --activate $ALLOWROOT
# Check if a custom path is being used.
if [ "$USELOCAL" = 'y' ]; then
# Get the path to the xml file.
printf "Please provide the absolute local path to your xml file: "
read XMLPATH
# Import the local file.
wp import $XMLPATH --authors=create $ALLOWROOT
else
# Check for cURL.
if ! command -v curl > /dev/null 2>&1; then
printf "cURL is not installed or accessible. Install cURL to use remote xml files.\n"
exit
fi
# Get the xml file.
curl -OL https://raw.githubusercontent.com/poststatus/wptest/master/wptest.xml
# Import the file, then delete it.
wp import wptest.xml --authors=create $ALLOWROOT
rm wptest.xml
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。