Skip to content

Instantly share code, notes, and snippets.

@tehsquidge
Created September 3, 2015 15:13
Show Gist options
  • Save tehsquidge/20522fbae2a4451d9fe4 to your computer and use it in GitHub Desktop.
Save tehsquidge/20522fbae2a4451d9fe4 to your computer and use it in GitHub Desktop.
Upgrade MODX
#!/bin/bash
#run in parent directory of public_html
read -e -p "what is the account username? " -i `stat -c "%U" ./` NAME #get the FTP owner account
wget http://modx.com/download/latest -O modx-latest.zip
unzip modx-latest.zip -d modx-latest
cp -R modx-latest/*/* public_html/
cd public_html/setup/
echo "---upgrading MODX---"
php index.php --installmode=upgrade
cd ../../
read -p "delete setup folder? " -n 1 -r -i "Y"
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
rm -R public_html/setup
echo "---setup folder deleted---"
fi
echo "---fixing permissions---"
chown -R $NAME:$NAME public_html/
chown -R $NAME:www-data public_html/core/{cache,export,components,import} public_html/assets/
chmod 775 -R public_html/core/{cache,export,components,import} public_html/assets/
read -p "delete temp files (upgrade zip)? " -n 1 -r -i "Y"
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
rm -R modx-latest*
echo "---temp files deleted---"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment