[Rt-commit] r7231 - rt/branches/3.7-EXPERIMENTAL-TUNIS/sbin

ruz at bestpractical.com ruz at bestpractical.com
Tue Mar 13 10:47:35 EDT 2007


Author: ruz
Date: Tue Mar 13 10:47:34 2007
New Revision: 7231

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/sbin/rt-setup-database.in

Log:
* use new RT::Handle each time
* initilize correct things at each step

Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/sbin/rt-setup-database.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/sbin/rt-setup-database.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/sbin/rt-setup-database.in	Tue Mar 13 10:47:34 2007
@@ -135,8 +135,6 @@
     ."Type:\t$db_type\nHost:\t$db_host\nName:\t$db_name\n"
     ."User:\t$db_user\nDBA:\t$dba_user\n";
 
-$RT::Handle ||= new RT::Handle;
-
 foreach my $action ( @actions ) {
     if ( $action eq 'create' ) {
         my $dbh = get_system_dbh();
@@ -157,36 +155,39 @@
         my $dbh = get_admin_dbh();
         check_db_compatibility( $dbh );
 
+        $RT::Handle = new RT::Handle;
         $RT::Handle->dbh( $dbh );
 
         print "Now populating database schema.\n";
-        $RT::Handle->insert_schema($dbh, $args{'datadir'});
+        $RT::Handle->InsertSchema( $dbh, $args{'datadir'} );
     }
     elsif ( $action eq 'acl' ) {
         my $dbh = get_admin_dbh();
         check_db_compatibility( $dbh );
 
+        $RT::Handle = new RT::Handle;
         $RT::Handle->dbh( $dbh );
 
         print "Now inserting database ACLs\n";
         $RT::Handle->InsertACL( $dbh, $args{'datadir'} ) # unless $db_type eq 'Oracle'
     }
     elsif ( $action eq 'coredata' ) {
-        my $dbh = get_rt_dbh();
-        check_db_compatibility( $dbh );
-
-        $RT::Handle->dbh( $dbh );
+        $RT::Handle = new RT::Handle;
+        $RT::Handle->dbh( undef );
+        RT::ConnectToDatabase();
+        RT::InitLogging();
+        check_db_compatibility( $RT::Handle->dbh );
 
         print "Now inserting RT core system objects\n";
-        $RT::Handle->insert_initial_data();
+        $RT::Handle->InsertInitialData();
     }
     elsif ( $action eq 'insert' ) {
-        my $dbh = get_rt_dbh();
-        check_db_compatibility( $dbh );
-
-        $RT::Handle->dbh( $dbh );
+        $RT::Handle = new RT::Handle;
+        RT::Init();
+        check_db_compatibility( $RT::Handle->dbh );
 
-        $RT::Handle->insert_data( $args{'datafile'} || ($args{'datadir'}."/content") );
+        print "Now inserting data\n";
+        $RT::Handle->InsertData( $args{'datafile'} || ($args{'datadir'}."/content") );
     }
 }
 


More information about the Rt-commit mailing list