]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 390148: Prevent Bugzilla from throwing warnings if we're on IIS
authormkanat%bugzilla.org <>
Tue, 31 Jul 2007 06:11:11 +0000 (06:11 +0000)
committermkanat%bugzilla.org <>
Tue, 31 Jul 2007 06:11:11 +0000 (06:11 +0000)
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=glob, a=mkanat

Bugzilla.pm

index 679695bf24976ae37726734a5f8c5dc36c751b6e..7be74b173a635b143b174919a481956498855bfd 100644 (file)
@@ -86,6 +86,20 @@ sub init_page {
     # PATH is undefined.
     $ENV{'PATH'} = '';
 
+    # IIS prints out warnings to the webpage, so ignore them, or log them
+    # to a file if the file exists.
+    if ($ENV{SERVER_SOFTWARE} && $ENV{SERVER_SOFTWARE} =~ /microsoft-iis/i) {
+        $SIG{__WARN__} = sub {
+            my ($msg) = @_;
+            my $datadir = bz_locations()->{'datadir'};
+            if (-w "$datadir/errorlog") {
+                my $warning_log = new IO::File(">>$datadir/errorlog");
+                print $warning_log $msg;
+                $warning_log->close();
+            }
+        };
+    }
+
     # If Bugzilla is shut down, do not allow anything to run, just display a
     # message to the user about the downtime and log out.  Scripts listed in 
     # SHUTDOWNHTML_EXEMPT are exempt from this message.