Skip to content

Instantly share code, notes, and snippets.

@mityukov
Last active April 20, 2018 07:52
Show Gist options
  • Save mityukov/070a8427c91f9d21098826cf3e99551c to your computer and use it in GitHub Desktop.
Save mityukov/070a8427c91f9d21098826cf3e99551c to your computer and use it in GitHub Desktop.
Script for rebuilding X-Cart 5 cache
# ATTENTION: Only works on local installations in Mac OS X (because of that `open` command in the end)
#
# INSTALLATION:
# 1. make sure it's placed in a directory, covered by your $PATH variable
# 2. re-name to xcrebuild (.sh is added to the filename only for syntax highlighting on Gist)
# 3. `chmod a+x /path/to/xcrebuild`
#
# USAGE: `cd xcart_dir && xcrebuild`
CONFIG_FILE=`([[ -f etc/config.local.php ]] && echo 'etc/config.local.php') || echo 'etc/config.php'`
echo Config: $CONFIG_FILE
HOST=`cat $CONFIG_FILE | grep '^http_host' | sed 's/^.*= *"//' | sed 's/".*$//'`
echo Host: $HOST
WEBDIR=`cat $CONFIG_FILE | grep '^web_dir' | sed 's/^.*= *"//' | sed 's/".*$//'`
echo Webdir: $WEBDIR
echo
echo Clearing cache…
rm -rf var/run
rm var/.rebuildStarted
echo Done. Starting re-building process. Please do not close the browser until done.
open http://$HOST$WEBDIR/admin.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment