[Rt-commit] rt branch, 4.2/report-os-details, updated. rt-4.0.6-450-g655a7df

Thomas Sibley trs at bestpractical.com
Thu Oct 11 14:42:34 EDT 2012


The branch, 4.2/report-os-details has been updated
       via  655a7df2068f7098e4745fd8c6f24675570ef96b (commit)
      from  8dceabbf40ed06e20d965b1780cb27b8627f03df (commit)

Summary of changes:
 share/html/Admin/Tools/Configuration.html | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit 655a7df2068f7098e4745fd8c6f24675570ef96b
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Oct 11 11:39:58 2012 -0700

    Report web server info for Apache, nginx, and lighttpd
    
    This doesn't necessarily determine which webserver is in use for RT if there
    are multiple servers installed on the box.
    
    With the added information, a consistent ordering starts to matter more.
    Switch to splicing arrays instead of hashes.

diff --git a/share/html/Admin/Tools/Configuration.html b/share/html/Admin/Tools/Configuration.html
index 86b9027..eeedf20 100644
--- a/share/html/Admin/Tools/Configuration.html
+++ b/share/html/Admin/Tools/Configuration.html
@@ -259,18 +259,34 @@ if ($item =~ /^\s*(.*?)\s*v(\S+);/) {
 <&|/Widgets/TitleBox, title => loc("Operating System") &>
 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
 <%perl>
-my %os = (
+my @os = (
     "Distribution"   => 'lsb_release --all',
     "uname -a"       => 'uname -a',
     "SELinux status" => 'getenforce',
+    "Apache"         => [map { "$_ -V" } qw(apache2ctl apachectl httpdctl)],
+    "nginx"          => 'nginx -V 2>&1',
+    "lighttpd"       => 'lighttpd -V',
 );
+my @os_info;
+
+while (my ($name, $cmd) = splice @os, 0, 2) {
+    $cmd = [$cmd] unless ref $cmd eq 'ARRAY';
+    for my $run (@$cmd) {
+        $run .= " </dev/null";
+        $run .= " 2>/dev/null" unless $run =~ /2>/;
+        my $result = `$run`;
+        if (defined $result and $result =~ /\S/) {
+            push @os_info, $name => $result;
+            last;
+        }
+    }
+}
 my $row = 0;
 </%perl>
-% while (my ($name, $cmd) = each %os) {
-% my $res = `$cmd </dev/null 2>/dev/null` or next;
+% while (my ($name, $output) = splice @os_info, 0, 2) {
 <tr class="collection-as-table <% $row++ % 2 ? "oddline" : "evenline" %>">
 <td class="collection-as-table"><% $name %></td>
-<td class="collection-as-table" style="white-space: pre-wrap; font-family: monospace"><% $res %></td>
+<td class="collection-as-table" style="white-space: pre-wrap; font-family: monospace"><% $output %></td>
 </tr>
 % }
 </table>

-----------------------------------------------------------------------


More information about the Rt-commit mailing list