Skip to content

Instantly share code, notes, and snippets.

@dkobia
Created December 1, 2011 21:33
Show Gist options
  • Save dkobia/1420031 to your computer and use it in GitHub Desktop.
Save dkobia/1420031 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Syncs Local Git Repo with Web
rm -rf /home/.sites/swiftriver/web/*
# Sync Files
# ** rsync doesn't copy over everything for some reason ... ??
#rsync -a --exclude ".git/" --exclude ".gitignore" --exclude ".DS_Store" /home/repo/ /home/.sites/swiftriver/web/
cp -rf /home/repo/* /home/.sites/swiftriver/web/
cp -rf /home/repo/.htaccess /home/.sites/swiftriver/web/
# Wipe the Database
mysql --user=[user] --password=[password] -BNe "show tables" [database] | tr '\n' ',' | sed -e 's/,$//' | awk '{print "SET FOREIGN_KEY_CHECKS = 0;DROP TABLE IF EXISTS " $1 ";SET FOREIGN_KEY_CHECKS = 1;"}' | mysql --user=[user] --password=[password] [database]
# Import Dump
mysql [database] -u[user] -p[password] < /home/.sites/swiftriver/web/install/sql/swiftriver.sql
# Remove leftover database.php file
rm -rf /home/.sites/swiftriver/web/application/config/database.php
# Copy over an updated database.php file
cp -f /home/reset/database.php /home/.sites/swiftriver/web/application/config/database.php
# We'll turn on Twitter plugin by default
# Turn on the Twitter Plugin
mysql -u[user] -p[password]<<EOFMYSQL
USE [database];
INSERT INTO plugins (id, plugin_path, plugin_name, plugin_description, plugin_enabled) VALUES (1,'twitter','Twitter','Adds the twitter service to Swiftriver.',1);
INSERT INTO plugins (id, plugin_path, plugin_name, plugin_description, plugin_enabled) VALUES (2,'tagthenet','TagThe.net','TagThe.net is a simple webservice that helps tag textual content.',1);
EOFMYSQL
# Update Permissions
mkdir /home/.sites/swiftriver/web/application/cache
mkdir /home/.sites/swiftriver/web/application/logs
chmod 0777 /home/.sites/swiftriver/web/application/cache
chmod 0777 /home/.sites/swiftriver/web/application/logs
# Finally change ownership of files back to adminftp
chown -R adminftp /home/.sites/swiftriver/web
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment