17th January
2010
Here is another script to pull the latest SVN. This one is for punbb 1.3. I no longer use this one, but figured I’d share it for those who are interested
#!/bin/sh
# Script created 2008-03-27 by Tommy Evans (hostbunch.com) to dump a production database and import it into a test database
# Update 2010-01-17 by Tommy Evans - Added variables
# This is for testing punbb 1.3 and extensions
#############################################
###### Configure the below variables ########
#############################################
# The domain in which to copy files from.
SRCDOMAIN="domain.com"
# The domain in which to copy files to.
DESTDOMAIN="punbb13.domain.com"
#SVN Path
PUNSVN="http://punbb.informer.com/svn/punbb/trunk/"
EXTSVN="http://punbb.informer.com/svn/additions/punbb-1.3/extensions/"
EXTPATH="punbb13.extensions"
#The source SQL database
SRCSQL="punsql.domain.com"
SRCUSER="srcuser"
SRCPSSWD="srcpassword"
SRCDB="pundb"
#The destination SQL database
DESTSQL="testsql.domain.com"
DESTUSER="destuser"
DESTPSSWD="destpassword"
DESTDB="pundb13"
## Modify the below for any custom SQL you wish to add. It will go at the bottom of this script
CUSTOMSQL1="TRUNCATE search_matches;"
CUSTOMSQL2="TRUNCATE search_words;"
#############################################
###### End of configured variables ########
#############################################
echo "Clear old cache direcory"
rm -f ${HOME}/${DESTDOMAIN}/cache/*
echo "Get the latest SVN from ${SVN}"
cd ${HOME}/${DESTDOMAIN}
svn up ${SVN} ${HOME}/${DESTDOMAIN}
echo "Get latest Extensions from SVN"
svn up ${EXTSVN} ${HOME}/${EXTPATH}
cp -ur ${HOME}/${EXTPATH}/* ${HOME}/${DESTDOMAIN}/extensions
echo "Remove install.php"
rm -f ${HOME}/${DESTDOMAIN}/admin/install.php
# Abort on any errors
set -e
cd ${HOME}
echo "clean up ${SRCDB} before the dump"
mysqlcheck --auto-repair -r -s -u${SRCUSER} -p${SRCPSSWD} -h ${SRCSQL} -B ${SRCDB}
echo "dump ${SRCDB} to ${DESTDB}"
mysqldump -u${SRCUSER} -p${SRCPSSWD} -h ${SRCSQL} --opt -f -n ${SRCDB} | mysql -u${DESTUSER} -p${DESTPSSWD} -h ${DESTSQL} -D ${DESTDB}
echo "Update database custom SQL"
mysql -f -n -u${DESTUSER} -p${DESTPSSWD} -h ${DESTSQL} -D ${DESTDB} -e "${CUSTOMSQL1}${CUSTOMSQL2}${CUSTOMSQL3}${CUSTOMSQL4}${CUSTOMSQL5}${CUSTOMSQL6}${CUSTOMSQL7}"
echo "Get the avatars from ${SRCDOMAIN}"
cp -u ${HOME}/${SRCDOMAIN}/img/avatars/* ${HOME}/${DESTDOMAIN}/img/avatars/
#move db_update.php and .htaccess
#cp -u ${HOME}/${DESTDOMAIN}/extras/db_update.php ${HOME}/${DESTDOMAIN}/
#cp -u ${HOME}/${DESTDOMAIN}/.htaccess.dist ${HOME}/${DESTDOMAIN}/.htaccess
#cp -u ${HOME}/${DESTDOMAIN}/.htaccess ${HOME}/${DESTDOMAIN}/.htaccessYou’ll need to make sure you add the config.php and edit to for the new database location and base url
<?php
$db_type = 'mysqli';
$db_host = 'localhost';
$db_name = 'pun13';
$db_username = 'root';
$db_password = '1234567';
$db_prefix = 'punbb_';
$p_connect = false;
$base_url = 'http://localhost';
$cookie_name = 'forum_cookie';
$cookie_domain = '';
$cookie_path = '/';
$cookie_secure = 0;
define('FORUM', 1);

