Skip to content

Instantly share code, notes, and snippets.

@JacobDorman
Created March 18, 2016 03:43
Show Gist options
  • Save JacobDorman/ca30f430e6997a7f7f9c to your computer and use it in GitHub Desktop.
Save JacobDorman/ca30f430e6997a7f7f9c to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
#TODO pull from imago: ssh epstore@imago -t 'cd www/ && n98-magerun/n98-magerun.phar db:dump --compression=gz --stdout' > IMAGO.sql.gz FIXME doesnt work. archive is messed up
#TODO shipping table
#TODO images
mr='/srv/www/eplc-store/current/n98-magerun/bin/n98-magerun'
STARTTIME=$(date +%s)
echo
echo " == Disable xdebug == "
sudo php5dismod xdebug
sudo service php5-fpm reload
sudo service nginx reload
#sudo service mysql restart
echo
echo " == Create DB == "
DBTIME=$(date +%s)
${mr} db:import -v --drop --compression=gz ../.DB/IMAGO.sql.gz
DBENDTIME=$(date +%s)
echo "DB Recreated, in $(($DBENDTIME - $DBTIME)) seconds"
#read -p "Press [Enter] key"
echo
echo " == Setup == "
#$mr db:maintain:check-tables TODO
$mr sys:setup:run
$mr sys:setup:incremental --no-interaction
$mr sys:setup:compare-versions
echo
echo " == Config Scripts == "
$mr script --stop-on-error --quiet -d secure_url='https://store.eplc.dev/' ../config/web.magerun
$mr script --stop-on-error --quiet -d joomla_url='https://www.eplc.dev/' ../config/magebridge.magerun
$mr script --stop-on-error --quiet ../config/amshopby.magerun
$mr script --stop-on-error --quiet ../config/carriers.magerun
$mr script --stop-on-error --quiet ../config/catalog.magerun
$mr script --stop-on-error --quiet ../config/SCP_options.magerun
$mr script --stop-on-error --quiet ../config/payment.magerun
$mr script --stop-on-error --quiet ../config/logs-off.magerun
$mr script --stop-on-error --quiet ../config/wsalogmenu.magerun
$mr script --stop-on-error --quiet ../config/general.magerun
$mr script --stop-on-error --quiet ../config/magemonitoring.magerun
$mr db:import ../config/amshopby.sql
$mr db:import ../config/shipping_premiumrate.sql
echo
echo '== Turning off db logging and deleting logfile =='
$mr dev:log:db --off
$mr dev:log --off --global
if [ -a ../magento/var/debug/pdo_mysql.log ]; then
rm ../magento/var/debug/pdo_mysql.log
fi
if [ -a ../magento/var/log/*.log ]; then
rm ../magento/var/log/*.log
fi
$mr dev:log --on --global
$mr dev:log:db --on
echo
echo " == Enable xdebug == "
sudo php5enmod xdebug
sudo service php5-fpm reload
sudo service nginx reload
sudo service mysql restart
echo
echo '== Start import =='
cd ../scripts
php config-products.php
php categories.php
echo
echo " == Optimising and exporting database to latest == "
$mr db:maintain:clean-tables --force
$mr db:query "TRUNCATE core_url_rewrite"
$mr db:dump --strip="@log" --compression=gz ../.DB/latest.sql.gz
echo
echo " == Reindex and flush cache"
$mr index:reindex:all
$mr cache:enable
$mr cache:flush
$mr cache:dir:flush
$mr cache:clean
ENDTIME=$(date +%s)
echo
echo
echo "Done, in $(($ENDTIME - $STARTTIME)) seconds"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment