This repository was archived by the owner on Mar 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdomain-import.sh
More file actions
executable file
·71 lines (54 loc) · 1.53 KB
/
Copy pathdomain-import.sh
File metadata and controls
executable file
·71 lines (54 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#! /bin/bash
#
# Download / Install Theme Unit Test Data
#
# @cmd domain import domainname.extension
#
# @version 1.0.0
#
# @author Chris Winters https://github.com/ChrisWinters
#
# MIT License
# https://raw.githubusercontent.com/ChrisWinters/wp-cli-localhost/master/LICENSE
# Source Config File
source domain-config.sh
# Download Unit Test Data
function get_xml_file() {
if [[ ! -f themeunittestdata.wordpress.xml ]]; then
wget https://raw.githubusercontent.com/WPTRT/theme-unit-test/master/themeunittestdata.wordpress.xml
printf "===> Theme Unit Test Data XML File Downloaded\n"
fi
}
# Active WordPress Importer Plugin
function activate_importer () {
wp plugin install wordpress-importer --activate --path=${LOCAL_DOMAIN_PATH}
printf "===> WordPress Importer Activated\n"
}
# Run WP Import
function wp_import () {
printf "===> Starting Import, This Will Take A Few Minutes...\n\n"
wp import themeunittestdata.wordpress.xml --authors=create --path=${LOCAL_DOMAIN_PATH}
printf "\n===> Import Completed\n"
}
# Run Remove Domain
function import() {
# Required
if [[ $1 == "" ]]; then
echo $0: "=domain=> usage example: domain import domainname.extension"
return 1
fi
# Start Display
clear
printf "\n\n"
read -p "== Press [y] to IMPORT Theme Unit Test Data for ${LOCAL_DOMAIN_URL} " -n 1 -r
printf "\n"
if [[ $REPLY =~ ^[Yy]$ ]]; then
printf "=domain=> Working on ${DOMAIN}\n"
sleep 1
get_xml_file
activate_importer
wp_import
printf "=domain=> Ctrl+Click To Open: ${LOCAL_DOMAIN_URL}\n\n"
fi
}
import $@