remove autogenerated file
[freeside.git] / rt / lib / RT.pm.in
index 065734e..c0a350a 100644 (file)
@@ -33,7 +33,6 @@ use RT::System;
 use vars qw($VERSION $System $SystemUser $Nobody $Handle $Logger
         $CORE_CONFIG_FILE
         $SITE_CONFIG_FILE
-        $VENDOR_CONFIG_FILE
         $BasePath
         $EtcPath
         $VarPath
@@ -94,7 +93,6 @@ $MasonSessionDir = '@MASON_SESSION_PATH@';
 =item LoadConfig
 
 Load RT's config file. First, go after the core config file. 
-After that, try to load the vendor config.
 After that, go after the site config.
 
 =cut
@@ -117,13 +115,10 @@ sub LoadConfig {
 =cut
 
 sub Init {
-    require RT::Handle;
+
     #Get a database connection
-        unless ($Handle && $Handle->dbh->ping) {
-    $Handle = RT::Handle->new();
-        } 
-    $Handle->Connect();
-    
+    ConnectToDatabase();
+
     #RT's system user is a genuine database user. its id lives here
     $SystemUser = new RT::CurrentUser();
     $SystemUser->LoadByName('RT_System');
@@ -137,6 +132,21 @@ sub Init {
    InitLogging(); 
 }
 
+  
+=head2 ConnectToDatabase
+
+Get a database connection
+
+=cut
+sub ConnectToDatabase {
+    require RT::Handle;
+    unless ($Handle && $Handle->dbh && $Handle->dbh->ping) {
+        $Handle = RT::Handle->new();
+    } 
+    $Handle->Connect();
+}
+    
 =head2 InitLogging
 
 Create the RT::Logger object. 
@@ -156,21 +166,23 @@ sub InitLogging {
     $RT::Logger=Log::Dispatch->new();
     
     if ($RT::LogToFile) {
-
-    unless (-d $RT::LogDir && -w $RT::LogDir) {
-        # localizing here would be hard when we don't have a current user yet
-        # die $self->loc("Log directory [_1] not found or couldn't be written.\n RT can't run.", $RT::LogDir);
-        die ("Log directory $RT::LogDir not found or couldn't be written.\n RT can't run.");
-    }
-
-       my $filename;
+       my ($filename, $logdir);
        if ($RT::LogToFileNamed =~ m![/\\]!) {
            # looks like an absolute path.
            $filename = $RT::LogToFileNamed;
+           ($logdir) = $RT::LogToFileNamed =~ m!^(.*[/\\])!;
        }
        else {
            $filename = "$RT::LogDir/$RT::LogToFileNamed";
+           $logdir = $RT::LogDir;
        }
+
+    unless ( -d $logdir && ( ( -f $filename && -w $filename ) || -w $logdir ) ) {
+        # localizing here would be hard when we don't have a current user yet
+        # die $self->loc("Log directory [_1] not found or couldn't be written.\n RT can't run.", $RT::LogDir);
+        die ("Log file $filename couldn't be written or created.\n RT can't run.");
+    }
+
     require Log::Dispatch::File;
 
 
@@ -219,7 +231,8 @@ sub InitLogging {
                                 return "$p{message} ($filename:$line)\n"}
                                },
              
-                      stderr => 1
+                      stderr => 1,
+               @RT::LogToSyslogConf
                     ));
     }
 
@@ -282,8 +295,15 @@ sub DropSetGIDPermissions {
 
 =head1 BUGS
 
+Please report them to rt-3.0-bugs@fsck.com, if you know what's broken and have at least some idea of what needs to be fixed.
+If you're not sure what's going on, report them rt-devel@lists.fsck.com.
+
 =head1 SEE ALSO
 
+L<RT::StyleGuide>
+L<DBIx::SearchBuilder>
+
+
 
 =begin testing