Skip to content

Instantly share code, notes, and snippets.

@JacobDorman
Created March 18, 2016 03:37
Show Gist options
  • Save JacobDorman/ca6af0c1dae4de418d72 to your computer and use it in GitHub Desktop.
Save JacobDorman/ca6af0c1dae4de418d72 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
dir=$(dirname $0)
echo "Pulling latest from prod"
ssh solar@solarmdg "
set -e
cd www
mr db:dump --stdout --quiet --compression=gz
" > "$dir"/../.DB/prod.sql.gz
echo "Importing to dev"
ssh -t solar.dev "
set -e
cd /srv/www/solaronline/current/magento
ls -la ../.DB/prod.sql.gz
mr db:import --compression=gz --drop ../.DB/prod.sql.gz
"
#FIXME modules in Mage_All.xml aren't disabled by dev:module:disable
echo "Migrating dev"
ssh -t solar.dev "
set -e
cd /srv/www/solaronline/current/magento
mr sys:setup:run
mr script ../.config/updates.magerun -d soa_domain='solaronline.dev' -d sga_domain='sungear.dev'
mr db:query 'UPDATE cms_block SET content = REPLACE(content, \"https://www.solaronline.com.au/\", \"/\") WHERE identifier = \"solar_information_menu\";'
mr db:query 'INSERT INTO permission_block (block_id, block_name, is_allowed) VALUES (10, \"catalog/navigation\", 1);'
mr db:import ../.config/shipping_premiumrate.sql
for m in Mage_Rss Mage_AdminNotification Mage_Api Mage_Api2 Mage_Wishlist Mage_Authorizenet Mage_Downloadable Mage_GiftMessage Mage_GoogleCheckout Mage_Newsletter Mage_Oauth Mage_PaypalUk Mage_Poll Mage_Rating Mage_Sendfriend Mage_Tag Mage_Usa Mage_Review Mage_XmlConnect Phoenix_Moneybookers; do mr dev:module:disable \$m; done
mr cache:flush
mr index:reindex:all
"
echo "Exporting new dev"
ssh -t solar.dev "
set -e
cd /srv/www/solaronline/current/magento
mr db:dump --compression=gz ../.DB/latest.sql.gz
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment