From 9d5e108738768e57f6d445fbdf433b94afc419f2 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sat, 20 Feb 2010 23:16:41 +0100 Subject: [PATCH] Update update.sh Signed-off-by: Florent Bruneau --- upgrade/account/copy_tables.php | 2 +- upgrade/account/update.sh | 38 ++++++++++++++++++++++++++++++++++++ upgrade/account/upgrade.sh | 21 -------------------- upgrade/inc/pervasive.sh | 4 +++- upgrade/newdirectory-0.0.1/update.sh | 34 -------------------------------- 5 files changed, 42 insertions(+), 57 deletions(-) create mode 100644 upgrade/account/update.sh delete mode 100644 upgrade/account/upgrade.sh delete mode 100755 upgrade/newdirectory-0.0.1/update.sh diff --git a/upgrade/account/copy_tables.php b/upgrade/account/copy_tables.php index 143ebff..1fcc473 100755 --- a/upgrade/account/copy_tables.php +++ b/upgrade/account/copy_tables.php @@ -57,7 +57,7 @@ copyTable('#groupex#.evenements_items', 'group_event_items'); copyTable('#groupex#.evenements_participants', 'group_event_participants'); copyTable('#groupex#.membres', 'group_members'); copyTable('#groupex#.membres_sub_requests', 'group_member_sub_requests'); -copyTable('#x4dat#.groupesx_auth'), 'group_auth'); +copyTable('#x4dat#.groupesx_auth', 'group_auth'); copyTable('#x4dat#.axletter', 'axletter'); copyTable('#x4dat#.axletter_ins', 'axletter_ins'); diff --git a/upgrade/account/update.sh b/upgrade/account/update.sh new file mode 100644 index 0000000..c105507 --- /dev/null +++ b/upgrade/account/update.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +. ../inc/pervasive.sh + +########################################################### +echo "Setting up new database: target db is $DATABASE, source prefix is $DBPREFIX" +echo "* press ^D to start import" +cat + +echo -n "* copying tables " +./copy_tables.php || die "ERROR" +echo "OK" + +for sql in ../newdirectory-0.0.1/*.sql +do + echo -n "* running $sql " + (sed -e "s/#\([0-9a-z]*\)#/${DBPREFIX}\1/g" < $sql | $MYSQL $DATABASE &>/dev/null) || die "ERROR" + echo "OK" +done + +for sql in *.sql +do + echo -n "* running $sql " + (sed -e "s/#\([0-9a-z]*\)#/${DBPREFIX}\1/g" < $sql | $MYSQL $DATABASE &>/dev/null) || die "ERROR" + echo "OK" +done + +########################################################### +echo -n "Importing phone numbers " + +./newdirectory-0.0.1/phones.php || die "ERROR" +echo "OK" + +########################################################### +echo "Updating birthday dates " + +./birthday.php || die "ERROR" +echo "OK" diff --git a/upgrade/account/upgrade.sh b/upgrade/account/upgrade.sh deleted file mode 100644 index c497ddb..0000000 --- a/upgrade/account/upgrade.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -. ../inc/pervasive.sh - -########################################################### -echo "Setting up new database: target db is $DATABASE, source prefix is $DBPREFIX" -echo -n "* copying tables" -./copy_tables.php || die "ERROR" -echo " OK" - -for sql in *.sql -do - echo -n "* running $sql" - (sed -e "s/#\([0-9a-z]*\)#/${DBPREFIX}\1/g" < $sql | $MYSQL $DATABASE &>/dev/null) || die "ERROR" - echo " OK" -done - -########################################################### -echo "Updating birthday dates" - -./birthday.php diff --git a/upgrade/inc/pervasive.sh b/upgrade/inc/pervasive.sh index 0e15c34..f2eebd0 100755 --- a/upgrade/inc/pervasive.sh +++ b/upgrade/inc/pervasive.sh @@ -13,7 +13,9 @@ fi if [[ -n "${DBPREFIX}" ]]; then echo "Using non-default database ${DBPREFIX}x4dat." fi -declare -r DATABASE="${DBPREFIX}x4dat" +if [[ -n "${DATABASE}" ]]; then + declare -r DATABASE="${DBPREFIX}x4dat" +fi function die() { echo $1 diff --git a/upgrade/newdirectory-0.0.1/update.sh b/upgrade/newdirectory-0.0.1/update.sh deleted file mode 100755 index f27da2c..0000000 --- a/upgrade/newdirectory-0.0.1/update.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -. ../inc/pervasive.sh - -mailman_stop -mailman_templates -mailman_start - -########################################################### -for sql in *.sql -do - echo -n $sql - (sed -e "s/#\([0-9a-z]*\)#/${DBPREFIX}\1/g" < $sql | $MYSQL $DATABASE &>/dev/null) || echo -n " ERROR" - echo . -done - -########################################################### - -echo "Importing phone numbers" - -./phones.php - -########################################################### - -echo "we will now upgrade the search table (this may be a long operation) - -please hit ^D to continue -" - -cat - -pushd ../../bin -./search.rebuild_db.php -popd -- 2.1.4