Update update.sh
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 20 Feb 2010 22:16:41 +0000 (23:16 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 20 Feb 2010 22:26:22 +0000 (23:26 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
upgrade/account/copy_tables.php
upgrade/account/update.sh [new file with mode: 0644]
upgrade/account/upgrade.sh [deleted file]
upgrade/inc/pervasive.sh
upgrade/newdirectory-0.0.1/update.sh [deleted file]

index 143ebff..1fcc473 100755 (executable)
@@ -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 (file)
index 0000000..c105507
--- /dev/null
@@ -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 (file)
index c497ddb..0000000
+++ /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
index 0e15c34..f2eebd0 100755 (executable)
@@ -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 (executable)
index f27da2c..0000000
+++ /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