[Rt-commit] r12550 - in rt/branches/3.8-TESTING: . share/html/installation

sartak at bestpractical.com sartak at bestpractical.com
Tue May 20 11:31:35 EDT 2008


Author: sartak
Date: Tue May 20 11:31:34 2008
New Revision: 12550

Modified:
   rt/branches/3.8-TESTING/   (props changed)
   rt/branches/3.8-TESTING/lib/RT/Handle.pm
   rt/branches/3.8-TESTING/share/html/installation/Initialize.html

Log:
 r56414 at onn:  sartak | 2008-05-20 11:31:17 -0400
 Avoid need to use Module::Refresh on RT::Handle by making its require-and-subclass logic a method


Modified: rt/branches/3.8-TESTING/lib/RT/Handle.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Handle.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/Handle.pm	Tue May 20 11:31:34 2008
@@ -70,19 +70,28 @@
 
 use strict;
 use warnings;
-
 use vars qw/@ISA/;
-eval "use DBIx::SearchBuilder::Handle::". RT->Config->Get('DatabaseType') .";
-\@ISA= qw(DBIx::SearchBuilder::Handle::". RT->Config->Get('DatabaseType') .");";
-
-if ($@) {
-    die "Unable to load DBIx::SearchBuilder database handle for '". RT->Config->Get('DatabaseType') ."'.\n".
-        "Perhaps you've picked an invalid database type or spelled it incorrectly.\n".
-        $@;
-}
 
 =head1 METHODS
 
+=head2 FinalizeDatabaseType
+
+Sets RT::Handle's superclass to the correct subclass of
+L<DBIx::SearchBuilder::Handle>, using the C<DatabaseType> configuration.
+
+=cut
+
+sub FinalizeDatabaseType {
+    eval "use DBIx::SearchBuilder::Handle::". RT->Config->Get('DatabaseType') .";
+    \@ISA= qw(DBIx::SearchBuilder::Handle::". RT->Config->Get('DatabaseType') .");";
+
+    if ($@) {
+        die "Unable to load DBIx::SearchBuilder database handle for '". RT->Config->Get('DatabaseType') ."'.\n".
+            "Perhaps you've picked an invalid database type or spelled it incorrectly.\n".
+            $@;
+    }
+}
+
 =head2 Connect
 
 Connects to RT's database using credentials and options from the RT config.
@@ -999,6 +1008,8 @@
     return $equiv_group->Id;
 }
 
+__PACKAGE__->FinalizeDatabaseType;
+
 eval "require RT::Handle_Vendor";
 die $@ if ($@ && $@ !~ qr{^Can't locate RT/Handle_Vendor.pm});
 eval "require RT::Handle_Local";

Modified: rt/branches/3.8-TESTING/share/html/installation/Initialize.html
==============================================================================
--- rt/branches/3.8-TESTING/share/html/installation/Initialize.html	(original)
+++ rt/branches/3.8-TESTING/share/html/installation/Initialize.html	Tue May 20 11:31:34 2008
@@ -92,10 +92,7 @@
 
     if ( $status ) {
 
-# XXX just found we need to refresh RT::Handle manually here
-# can anybody tell me why?
-        require Module::Refresh;
-        Module::Refresh->refresh_module('RT/Handle.pm');
+        RT::Handle->FinalizeDatabaseType();
 
         my $dbh = DBI->connect(
             RT::Handle->DSN, $RT::Installer->{InstallConfig}{DatabaseAdmin},


More information about the Rt-commit mailing list