forked from seaster1970/migbin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwpinstall
More file actions
executable file
·49 lines (49 loc) · 1.63 KB
/
Copy pathwpinstall
File metadata and controls
executable file
·49 lines (49 loc) · 1.63 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
#!/bin/bash
function wpinstall() {
#check if the directory is (mostly) empty
check_path_files=`find . -maxdepth 1 -type f | wc -l`
check_path_dirs=`find . -maxdepth 1 -type d | wc -l`
if [[ $check_path_files == 0 ]] && [[ $check_path_dirs == 1 ]]; then
wget -q https://wordpress.org/latest.tar.gz
tar -xf latest.tar.gz --strip-components=1 wordpress/
rm -f latest.tar.gz
if [[ $1 == '-db' ]]; then
cp wp-config-sample.php wp-config.php
wpdbimport
wp config shuffle-salts
fi
echo -e "\e[32mWordpress installed. Go to the site now.\e[0m"
else
echo -e "\e[31mThere is content in this directory, aborting.\e[0m"
fi
}
function main_wpinstall() {
server=$(hostname)
if [[ $server == cp.mwp* ]]; then
echo "Maybe don't run this on an MWP account"
else
if test -f ./wp-includes/version.php ; then
wpVersionNo=$(grep -s '$wp_version =' ./wp-includes/version.php | cut -d "'" -f 2 )
if [[ -n {$wpVersionNo} ]] ; then
echo "WP version = $wpVersionNo"
echo "Downloading matching version..."
wget -q https://wordpress.org/wordpress-"$wpVersionNo".tar.gz
tar -xf wordpress-"$wpVersionNo".tar.gz --strip-components=1
rm -f wordpress-"$wpVersionNo".tar.gz
if [[ $1 == '-db' ]]; then
wpdbimport
wp config shuffle-salts
fi
echo -e "\e[32mWordpress installed. Go to the site now.\e[0m"
else
echo 'Defaulting to latest version'
wpinstall
fi
else
echo 'No Wordpress Includes folder found, attempting to install WordPress latest release'
wpinstall
fi
fi
}
main_wpinstall $1
tempurl