Last active
April 24, 2018 08:56
-
-
Save mattradford/865f3eefa0e6ebf341e6b9d76bce7d27 to your computer and use it in GitHub Desktop.
Programatically flush a WP Engine object cache
This file contains hidden or 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 | |
# Programatically flush a WPE cache | |
# Requires https://github.com/a7/wpe-cache-flush/ | |
# Set private key in $private_key | |
# @params install | |
# @params private_key | |
# @returns HTTP status code | |
# Variables | |
$private_key=YOUR_PRIVATE_KEY | |
# User input | |
read -p 'Install to flush: ' install | |
# Get site URL, flush cache and return status | |
echo $(tput setaf 2)'Attempting to flush '$install$(tput sgr 0) | |
remoteurl=$(wp --ssh=$install@$install.ssh.wpengine.net --quiet option get siteurl) | |
curl -I $remoteurl/?wpe-cache-flush=$private_key 2>/dev/null | head -n 1 | cut -d$' ' -f2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment