for DebugLevel=2; improved reporting of version numbers
authorGalen Charlton <galen.charlton@liblime.com>
Thu, 27 Mar 2008 19:40:15 +0000 (14:40 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Tue, 1 Apr 2008 11:44:27 +0000 (06:44 -0500)
Koha software and DB version numbers now reported;
also improved formatting of multi-line error messages.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Context.pm

index f7043aa..4dcd743 100644 (file)
@@ -22,6 +22,8 @@ use vars qw($VERSION $AUTOLOAD $context @context_stack);
 BEGIN {
        if ($ENV{'HTTP_USER_AGENT'})    {
                require CGI::Carp;
+        # FIXME for future reference, CGI::Carp doc says
+        #  "Note that fatalsToBrowser does not work with mod_perl version 2.0 and higher."
                import CGI::Carp qw(fatalsToBrowser);
                        sub handle_errors {
                                my $msg = shift;
@@ -40,11 +42,12 @@ BEGIN {
                # a little example table with various version info";
                                        print "
                                                <h1>Koha error</h1>
-                                               <p>The following error has occurred:</p> 
-                        <p><code>$msg</code></p>
+                                               <p>The following fatal error has occurred:</p> 
+                        <pre><code>$msg</code></pre>
                                                <table>
                                                <tr><th>Apache</th><td>  $versions{apacheVersion}</td></tr>
                                                <tr><th>Koha</th><td>    $versions{kohaVersion}</td></tr>
+                                               <tr><th>Koha DB</th><td> $versions{kohaDbVersion}</td></tr>
                                                <tr><th>MySQL</th><td>   $versions{mysqlVersion}</td></tr>
                                                <tr><th>OS</th><td>      $versions{osVersion}</td></tr>
                                                <tr><th>Perl</th><td>    $versions{perlVersion}</td></tr>
@@ -53,8 +56,8 @@ BEGIN {
                                } elsif ($debug_level eq "1"){
                                        print "
                                                <h1>Koha error</h1>
-                                               <p>The following error has occurred:</p> 
-                        <p><code>$msg</code></p>";
+                                               <p>The following fatal error has occurred:</p> 
+                        <pre><code>$msg</code></pre>";
                                } else {
                                        print "<p>production mode - trapped fatal error</p>";
                                }       
@@ -960,7 +963,8 @@ Gets various version info, for core Koha packages, Currently called from carp ha
 # A little example sub to show more debugging info for CGI::Carp
 sub get_versions {
     my %versions;
-    $versions{kohaVersion}  = C4::Context->config("kohaversion");
+    $versions{kohaVersion}  = KOHAVERSION();
+    $versions{kohaDbVersion} = C4::Context->preference('version');
     $versions{osVersion} = `uname -a`;
     $versions{perlVersion} = $];
     $versions{mysqlVersion} = `mysql -V`;