[Rt-commit] r12002 - rt/branches/3.8-TESTING/html/installation
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu May 1 22:31:34 EDT 2008
Author: sunnavy
Date: Thu May 1 22:31:34 2008
New Revision: 12002
Modified:
rt/branches/3.8-TESTING/html/installation/DatabaseDetails.html
rt/branches/3.8-TESTING/html/installation/Sendmail.html
Log:
use SaveConfig method
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 May 1 22:31:34 2008
@@ -89,73 +89,69 @@
'installation/DatabaseType.html');
}
- require File::Spec;
- my $file = File::Spec->catfile($RT::EtcPath, 'RT_SiteConfig.pm');
-
- if ( open my $fh, '>', $file ) {
- for ( keys %{$RT::Installer->{InstallConfig}} ) {
- print $fh "Set( \$$_, '$RT::Installer->{InstallConfig}{$_}' );\n";
- }
- print $fh "1;\n";
- close $fh;
- RT->LoadConfig;
+ if ( $ARGS{Next} ) {
+ RT::Interface::Web::Redirect(RT->Config->Get('WebURL') .
+'installation/Basics.html');
}
-# dba connect systemdsn
- my $dbh = DBI->connect(
- RT::Handle->SystemDSN, $ARGS{DatabaseAdmin}, $ARGS{DatabaseAdminPassword}, { RaiseError => 0, PrintError => 0 },
- );
-
- if ( $dbh ) {
- push @results, 'connect succeed!';
- # dba connect dsn, which has table info
- $dbh = DBI->connect(
- RT::Handle->DSN, $ARGS{DatabaseAdmin}, $ARGS{DatabaseAdminPassword}, { RaiseError => 0, PrintError => 0 },
+ my ( $status, $msg ) = RT::Installer->SaveConfig;
+ if ( $status ) {
+ RT->LoadConfig;
+ # dba connect systemdsn
+ my $dbh = DBI->connect(
+ RT::Handle->SystemDSN, $ARGS{DatabaseAdmin}, $ARGS{DatabaseAdminPassword}, { RaiseError => 0, PrintError => 0 },
);
-
+
if ( $dbh ) {
- # check if Tickets table exists
- my $sth = $dbh->table_info('', '', 'Tickets', 'TABLE');
- # get 'Tickets' if it exists
- if ( ($sth->fetchrow_array)[2] ) {
-
- $sth = $dbh->prepare('select id from Users where Name=?');
- $sth->execute('RT_System');
- if ( $sth->fetchrow_array ) {
- $RT::Installer->{DatabaseAction} = 'none';
- push @results, "Database $RT::DatabaseName seems complete,
-don't need to initialize any more.";
+ push @results, 'connect succeed!';
+ # dba connect dsn, which has table info
+ $dbh = DBI->connect(
+ RT::Handle->DSN, $ARGS{DatabaseAdmin}, $ARGS{DatabaseAdminPassword}, { RaiseError => 0, PrintError => 0 },
+ );
+
+ if ( $dbh ) {
+ # check if Tickets table exists
+ my $sth = $dbh->table_info('', '', 'Tickets', 'TABLE');
+ # get 'Tickets' if it exists
+ if ( ($sth->fetchrow_array)[2] ) {
+
+ $sth = $dbh->prepare('select id from Users where Name=?');
+ $sth->execute('RT_System');
+ if ( $sth->fetchrow_array ) {
+ $RT::Installer->{DatabaseAction} = 'none';
+ push @results, "Database $RT::DatabaseName seems complete,
+ don't need to initialize any more.";
+ }
+ else {
+ $RT::Installer->{DatabaseAction} = 'acl,coredata,insert';
+ push @results, "Database $RT::DatabaseName already exists
+ and has RT tables in place, but does not contain RT's metadata. 'Initialize
+ Database' later can use this existing db and tables and insert metadata, if this's ok, click 'Customize Baisc' below to go on customizing RT";
+ }
}
else {
- $RT::Installer->{DatabaseAction} = 'acl,coredata,insert';
- push @results, "Database $RT::DatabaseName already exists
-and has RT tables in place, but does not contain RT's metadata. 'Initialize
-Database' later can use this existing db and tables and insert metadata, if this's ok, click 'Customize Baisc' below to go on customizing RT";
+ $RT::Installer->{DatabaseAction} = 'schema,acl,coredata,insert';
+ push @results, "Database $RT::DatabaseName already exists, but
+ does not contain RT's tables and metadata. 'Initialize Database' later can use
+ this existing db and insert tables and metadata, if this's ok, click
+ 'Customize Baisc' below to go on customizing RT";
}
+
}
else {
- $RT::Installer->{DatabaseAction} = 'schema,acl,coredata,insert';
- push @results, "Database $RT::DatabaseName already exists, but
-does not contain RT's tables and metadata. 'Initialize Database' later can use
-this existing db and insert tables and metadata, if this's ok, click
-'Customize Baisc' below to go on customizing RT";
+ $RT::Installer->{DatabaseAction} =
+ 'create,schema,acl,coredata,insert';
}
-
}
else {
- $RT::Installer->{DatabaseAction} =
-'create,schema,acl,coredata,insert';
+ $RT::Installer->{DatabaseAction} = 'error';
+ push @results, "Failed to connect: $DBI::errstr";
}
}
else {
- $RT::Installer->{DatabaseAction} = 'error';
- push @results, "Failed to connect: $DBI::errstr";
+ push @results, $msg;
}
- if ( $ARGS{Next} && $RT::Installer->{DatabaseAction} && $RT::Installer->{DatabaseAction} ne 'error' ) {
- RT::Interface::Web::Redirect(RT->Config->Get('WebURL') .
-'installation/Basics.html');
- }
}
Modified: rt/branches/3.8-TESTING/html/installation/Sendmail.html
==============================================================================
--- rt/branches/3.8-TESTING/html/installation/Sendmail.html (original)
+++ rt/branches/3.8-TESTING/html/installation/Sendmail.html Thu May 1 22:31:34 2008
@@ -81,16 +81,10 @@
unless ( @results ) {
- require File::Spec;
- my $file = File::Spec->catfile($RT::EtcPath, 'RT_SiteConfig.pm');
+ my ( $status, $msg ) = RT::Installer->SaveConfig;
- if ( open my $fh, '>', $file ) {
- for ( keys %{$RT::Installer->{InstallConfig}} ) {
- print $fh "Set( \$$_, '$RT::Installer->{InstallConfig}{$_}' );\n";
- }
- print $fh "1;\n";
- close $fh;
- RT->Config->LoadConfigs; #( File => $file );
+ if ( $status ) {
+ RT->LoadConfig;
if ( $RT::Installer->{DatabaseAction} ne 'none' ) {
RT::Interface::Web::Redirect(RT->Config->Get('WebURL') .
@@ -102,7 +96,7 @@
}
}
else {
- push @results, "Can't open config file $file to write: $!";
+ push @results, $msg;
}
}
}
More information about the Rt-commit
mailing list