Sample additional tasks for WordPress plugins installed via Peasant.
#!/bin/bash
#
# vvv-init-setup-plugins-post.sh
#
# This file will perform some additional tasks on installed plugins.
# Get Peasant from https://github.com/andrezrv/peasant-vvv-provider.
# Include config file.
this_dir="$(dirname `readlink -f $(dirname $0)/vvv-init.sh`)"
. "${this_dir}/config.sh"
# Get full path to this directory.
link=`readlink -f ${this_dir}/vvv-init.sh`
this_dir_path=`dirname ${link}`
# We're gonna use the content directory a lot, so we store its path into a
# variable.
content="${APPLICATION_PATH}/content"
# Move to application directory
cd "${APPLICATION_PATH}"
# Batcache
if [[ ! -f "${content}/mu-plugins/batcache.php" && -f "${content}/plugins/batcache/batcache.php" ]]; then
# Move to mu-plugins folder.
mv "${content}/plugins/batcache/batcache.php" "${content}/mu-plugins/"
mv "${content}/plugins/batcache/advanced-cache.php" "${content}/"
rm -rf "${content}/plugins/batcache"
# Create Batcache config file.
cp "${APPLICATION_PATH}/cache-config-sample.php" "${APPLICATION_PATH}/cache-config.php"
fi
# APC
if [[ ! -f "${content}/object-cache.php" && -f "${content}/plugins/apc/object-cache.php" ]]; then
# Move to mu-plugins folder.
mv "${content}/plugins/apc/object-cache.php" "${content}/"
rm -rf "${content}/plugins/apc"
fi