[Rt-commit] r11867 - rt/branches/3.8-TESTING/html/installation

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Apr 24 03:06:11 EDT 2008


Author: sunnavy
Date: Thu Apr 24 03:06:10 2008
New Revision: 11867

Modified:
   rt/branches/3.8-TESTING/html/installation/Basics.html
   rt/branches/3.8-TESTING/html/installation/DatabaseDetails.html

Log:
make database connectivity check a must except for SQLite

Modified: rt/branches/3.8-TESTING/html/installation/Basics.html
==============================================================================
--- rt/branches/3.8-TESTING/html/installation/Basics.html	(original)
+++ rt/branches/3.8-TESTING/html/installation/Basics.html	Thu Apr 24 03:06:10 2008
@@ -74,6 +74,8 @@
 </&>
 <%init>
 my @results;
+push @results, 'Connected Database with success!' unless
+$RT::Installer->{InstallConfig}{DatabaseType} eq 'SQLite';
 
 my @types = qw/rtname Organization TimeZone MinimumPasswordLength/;
 my %title = (

Modified: rt/branches/3.8-TESTING/html/installation/DatabaseDetails.html
==============================================================================
--- rt/branches/3.8-TESTING/html/installation/DatabaseDetails.html	(original)
+++ rt/branches/3.8-TESTING/html/installation/DatabaseDetails.html	Thu Apr 24 03:06:10 2008
@@ -83,10 +83,11 @@
 </table>
 <input type="hidden" name="Run" value="1">
 
-% if ( $RT::Installer->{InstallConfig}{DatabaseType} ne 'SQLite' ) {
-<input type="submit" value="check if we can connect" name="Connect" />
-% }
+% if ( $RT::Installer->{InstallConfig}{DatabaseType} eq 'SQLite' ) {
 <& /Elements/Submit, Label => loc('Next: Customize Basics') &>
+% } else {
+<& /Elements/Submit, Label => loc('Next: Check Database Connectivity') &>
+% }
 </form>
 </&>
 <%init>
@@ -132,41 +133,35 @@
     }
     $RT::Installer->{TimeStamp} = time;
 
-    if ( $Connect ) {
-        my $handle = DBIx::SearchBuilder::Handle->new();
-        my $db_type = $RT::Installer->{InstallConfig}{DatabaseType};
-        
-        my $dsn;
-        $dsn = "dbi:$db_type:";
-        if ( $db_type eq 'Pg' ) {
-            # with postgres, you want to connect to template1 database
-            $dsn .= 'dbname=template1';
-        }
-        $dsn .= ";host=$ARGS{DatabaseHost}" if $ARGS{DatabaseHost};
-        $dsn .= ";port=$ARGS{DatabasePort}" if $ARGS{DatabasePort};
-        $dsn .= ";requiressl=1" if $ARGS{DatabaseRequireSSL};
-        
-        my $dbh = DBI->connect(
-            $dsn, $ARGS{DatabaseUser}, $ARGS{DatabasePassword},
-            { RaiseError => 0, PrintError => 0 },
-        );
+    my $handle = DBIx::SearchBuilder::Handle->new();
+    my $db_type = $RT::Installer->{InstallConfig}{DatabaseType};
     
-        if ( $dbh ) {
-            push @results, "Connect succeed!";
-        }
-        else {
-            push @results, "Failed to connect: $DBI::errstr";
-        }
+    my $dsn;
+    $dsn = "dbi:$db_type:";
+    if ( $db_type eq 'Pg' ) {
+        # with postgres, you want to connect to template1 database
+        $dsn .= 'dbname=template1';
     }
-    else {
+    $dsn .= ";host=$ARGS{DatabaseHost}" if $ARGS{DatabaseHost};
+    $dsn .= ";port=$ARGS{DatabasePort}" if $ARGS{DatabasePort};
+    $dsn .= ";requiressl=1" if $ARGS{DatabaseRequireSSL};
+    
+    my $dbh = DBI->connect(
+        $dsn, $ARGS{DatabaseUser}, $ARGS{DatabasePassword},
+        { RaiseError => 0, PrintError => 0 },
+    );
+
+    if ( $dbh ) {
         RT::Interface::Web::Redirect(RT->Config->Get('WebURL') .
 'installation/Basics.html');
     }
+    else {
+        push @results, "Failed to connect: $DBI::errstr";
+    }
 }
 
 </%init>
 
 <%args>
-$Connect => undef
 $Run => 0
 </%args>


More information about the Rt-commit mailing list