Skip to content

Instantly share code, notes, and snippets.

@twogood
Created November 20, 2012 21:53
Show Gist options
  • Save twogood/4121473 to your computer and use it in GitHub Desktop.
Save twogood/4121473 to your computer and use it in GitHub Desktop.
.openshift/action_hooks/build for WordPress Multisite on OpenShift
#!/bin/bash
# This is a simple build script and will be executed on your CI system if
# available. Otherwise it will execute while your application is stopped
# before the deploy step. This script gets executed directly, so it
# could be python, php, ruby, etc.
WP_CONTENT=$OPENSHIFT_REPO_DIR/php/wp-content
for SUBDIR in plugins themes uploads blogs.dir; do
# if there is no data directory
if [ ! -d $OPENSHIFT_DATA_DIR/$SUBDIR ]; then
# if there is a directory in the repo, move it
if [ -d $WP_CONTENT/$SUBDIR ]; then
mv $WP_CONTENT/$SUBDIR $OPENSHIFT_DATA_DIR/
else
mkdir $OPENSHIFT_DATA_DIR/$SUBDIR
fi
fi
# remove directory from wp-content
if [ -d $WP_CONTENT/$SUBDIR ]; then
rm -rf $WP_CONTENT/$SUBDIR
fi
# link from wp-content to data
ln -sf $OPENSHIFT_DATA_DIR/$SUBDIR $WP_CONTENT/
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment