[Rt-commit] r7900 - in rt/branches/3.6-RELEASE: .

jesse at bestpractical.com jesse at bestpractical.com
Mon May 21 15:59:17 EDT 2007


Author: jesse
Date: Mon May 21 15:59:12 2007
New Revision: 7900

Modified:
   rt/branches/3.6-RELEASE/   (props changed)
   rt/branches/3.6-RELEASE/sbin/rt-setup-database.in

Log:
 r57019 at pinglin:  jesse | 2007-05-21 15:58:43 -0400
 RT-Ticket: 8387
 Update: correspond
 
 
 * Better debugging info when schema files are missing. - Nicholas Clark <nick at ccl4.org>


Modified: rt/branches/3.6-RELEASE/sbin/rt-setup-database.in
==============================================================================
--- rt/branches/3.6-RELEASE/sbin/rt-setup-database.in	(original)
+++ rt/branches/3.6-RELEASE/sbin/rt-setup-database.in	Mon May 21 15:59:12 2007
@@ -184,14 +184,20 @@
     my (@schema);
     print "Creating database schema.\n";
 
-    if ( -f $base_path . "/schema." . $RT::DatabaseType ) {
-        no warnings 'unopened';
-
-        open( SCHEMA, "<" . $base_path . "/schema." . $RT::DatabaseType );
-        open( SCHEMA_LOCAL, "<" . $RT::LocalEtcPath . "/schema." . $RT::DatabaseType );
+    my $schema_file = $base_path . "/schema." . $RT::DatabaseType;
+    if ( -f $schema_file ) {
+        open( SCHEMA, "<$schema_file"  ) or die "Can't open $schema_file: $!";
+	my @lines = <SCHEMA>;
+
+	my $local_schema_file = $RT::LocalEtcPath . "/schema." . $RT::DatabaseType;
+	if (-f $local_schema_file) {
+	    open( SCHEMA_LOCAL, "<$local_schema_file" )
+		or die "Can't open $local_schema_file: $!";
+	    push @lines, ';;', <SCHEMA_LOCAL>;
+	}
 
         my $statement = "";
-        foreach my $line (<SCHEMA>, ($_ = ';;'), <SCHEMA_LOCAL>) {
+        foreach my $line (@lines) {
             $line =~ s/\#.*//g;
             $line =~ s/--.*//g;
             $statement .= $line;


More information about the Rt-commit mailing list