Last active
January 14, 2020 22:17
-
-
Save jonathonsim/09b9fc5ca9c387fed01cdcb618df1520 to your computer and use it in GitHub Desktop.
Sript to install a test copy of wp for benchmarking and testing. Usage is ` curl https://gist.githubusercontent.com/jonathonsim/09b9fc5ca9c387fed01cdcb618df1520/raw/install-test-wp.sh | bash -s -- wpdb dbuser dbpass`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ -z $5 ]]; then | |
echo "Usage $0 url dbhost dbname dbuser dbpass" | |
exit 1 | |
fi | |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
chmod +x wp-cli.phar | |
mkdir ~/bin | |
mv wp-cli.phar ~/bin/wp | |
cd ~/public_html | |
wp core download #Download wordpress | |
#Generate a random table prefix. This is a good security enhancement | |
PREFIX=wp_$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 11 | head -n 1)_ | |
#Create a configuration file. | |
wp config create --dbhost=$2 --dbname=$3 --dbuser=$4 --dbpass="$5" --dbprefix=$PREFIX | |
wp core install --url=$1 --title=test --admin_user=admin --admin_password=$PREFIX --admin_email=test@idealstack.io |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment