MODX Upgrade Script

Make Upgrading MODX Sites Easy

With another feature packed release of MODX Revolution everybody is itching to get their sites upgraded. Some people have even written some one-click coolness. So on that note, I decided to share an upgrade script I’ve been using to upgrade MODX sites using SSH.

Hopefully it helps some people out, but maybe you can help me out? What’s your build script look like? What are some of your favorite tips and tricks?

cd /absolute/path/to/modx
#clean up old files if they exist
rm -rf modx-2.2.7-pl.zip
rm -rf modx-2.2.7-pl
rm -rf _html

# clone site
cp -R html _html
cd _html

# make it easier to merge
mv connectors _connectors
mv core _core
mv manager _manager
cd /absolute/path/to/modx

# get the good stuff
wget http://modx.com/download/direct/modx-2.2.7-pl.zip
unzip modx-2.2.7-pl.zip

# move new modx files over
mv modx-2.2.7-pl/connectors _html
mv modx-2.2.7-pl/core _html
mv modx-2.2.7-pl/manager _html
mv modx-2.2.7-pl/setup _html
cd _html

# copy components over
cp -Rf _core/components core

# move packages over make sure not to bring old core files
rm -rf _core/packages/core 
rm -rf _core/packages/core.transport.zip 
cp -Rf _core/packages/* core/packages/

# bring our config files over
cd /absolute/path/to/modx
cp -f html/config.core.php _html
cp -f html/connectors/config.core.php _html/connectors
cp -f html/manager/config.core.php _html/manager
cp -f html/core/config/config.inc.php _html/core/config

# backup setup to make it easy to re-run
cd _html
rm -rf setup.tar
tar -cvf setup.tar setup
cd /absolute/path/to/modx

# swap old site with new site
mv html html_2.2.6 && mv _html html

# it worked? cool. clean up
rm -rf html/_core && rm -rf html/_connectors && rm -rf html/_manager && rm -rf html_2.2.6

# think twice now...
rm -rf html_2.2.6

Comments (0)

Add a Comment

Allowed tags: <b><i><br>Comment:

** I'll show you mine if you show me yours **