[Koha-patches] [PATCH] bug 2083: requiring that the test database have a different name from the production database

Andrew Moore andrew.moore at liblime.com
Wed May 7 22:23:25 CEST 2008


This patch requires that the test database name be different from the production database name.
The object here is to prevent people from specifying the same database for both, and then
losing all of their data in the production database.

This may cause problems for people who want to do that, though I consider that bad practice.
It may also cause problems for people if they have two different servers, each with identically
named database, and they want to use one for testing and the other for production. If we ever
find that someone like that exists, we can deal with that case.

I don't think there are any necessary documentation changes here yet since we're recommending
that users answer "no" to the question about setting up a test database.
---
 Makefile.PL |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/Makefile.PL b/Makefile.PL
index bae8dbc..bd0ea58 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1094,7 +1094,11 @@ doing it in a database that you don't want to lose.
 Please specify the name of the test database to be
 used by Koha);
       
-    $config{'TEST_DB_NAME'} = _get_value('TEST_DB_NAME', $msg, $defaults->{'TEST_DB_NAME'}, $valid_values, $install_log_values);
+      $config{'TEST_DB_NAME'} = _get_value('TEST_DB_NAME', $msg, $defaults->{'TEST_DB_NAME'}, $valid_values, $install_log_values);
+      while ( $config{'TEST_DB_NAME'} eq $config{'DB_NAME'} ) {
+          $msg = q(Please do not use the same database for testing as you do for production. You run the severe risk of data loss.);
+          $config{'TEST_DB_NAME'} = _get_value('TEST_DB_NAME', $msg, $defaults->{'TEST_DB_NAME'}, $valid_values, $install_log_values);
+      }
 
       $msg = q(
 Please specify the user that owns the database to be
-- 
1.5.5.rc0.16.g02b00




More information about the Koha-patches mailing list