[Rt-commit] r6412 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Sun Nov 12 13:20:21 EST 2006


Author: ruz
Date: Sun Nov 12 13:20:20 2006
New Revision: 6412

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Config.pm

Log:
 r4120 at cubic-pc:  cubic | 2006-11-12 21:01:18 +0300
 * port load config checks from 3.6


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Config.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Config.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Config.pm	Sun Nov 12 13:20:20 2006
@@ -222,7 +222,37 @@
     };
     if( $@ ) {
         return 1 if $is_site && $@ =~ qr{^Can't locate \Q$args{File}};
-        die ("Couldn't load config file '$args{File}': $@");
+
+        my ($our_user, $our_group) = (scalar getpwuid $>, scalar getgrgid $();
+
+        my ($file_path, $fileuid, $filegid);
+        foreach ( $RT::LocalEtcPath, $RT::EtcPath, @INC ) {
+            my $tmp = File::Spec->catfile( $_, $args{File} );
+            ($fileuid,$filegid) = (stat( $tmp ))[4,5];
+            if ( defined $fileuid ) {
+                $file_path = $tmp;
+                last;
+            }
+        }
+
+        my $message;
+        if ( $file_path ) {
+            my ($file_user, $file_group) = (scalar getpwuid $fileuid, scalar getgrgid $filegid);
+            $message = qq{Couldn't load RT config file $file_path as user $our_user / group $our_group.
+The file is owned by user $file_user and group $file_group.
+This usually means that the user/group your webserver/script is running as cannot read the file.
+Be careful not to make the permissions on this file too liberal, because it contains database
+passwords.  You may need to put the webserver user in the appropriate group ($file_group) or change
+permissions be able to run succesfully};
+        } else {
+            $message = qq{Couldn't load RT config file $args{'File'} as user $our_user / group $our_group.
+The file couldn't be find in $RT::LocalEtcPath and $RT::EtcPath.
+This usually means that the user/group your webserver/script is running as cannot read the file
+or has no access to the dirs. Be careful not to make the permissions on this file too liberal,
+because it contains database passwords.};
+        }
+
+        die "$message\n$@";
     }
     return 1;
 }


More information about the Rt-commit mailing list